Sync upstream v11.1.0 (merge conflicts)#71
Conversation
Co-authored-by: Alexander Kolotov <alexander.kolotov@gmail.com> Co-authored-by: Maxim Filonov <53992153+sl1depengwyn@users.noreply.github.com> Co-authored-by: Victor Baranov <baranov.viktor.27@gmail.com> Co-authored-by: Qwerty5Uiop <105209995+Qwerty5Uiop@users.noreply.github.com>
…oints (blockscout#14227) Co-authored-by: Alexander Kolotov <alexander.kolotov@gmail.com> Co-authored-by: Maxim Filonov <53992153+sl1depengwyn@users.noreply.github.com> Co-authored-by: Victor Baranov <baranov.viktor.27@gmail.com> Co-authored-by: Qwerty5Uiop <105209995+Qwerty5Uiop@users.noreply.github.com>
…ut#14251) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Alexander Kolotov <alexander.kolotov@gmail.com> Co-authored-by: Victor Baranov <baranov.viktor.27@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nikita Pozdniakov <nikitosing4@mail.ru> Co-authored-by: Maxim Filonov <53992153+sl1depengwyn@users.noreply.github.com> Co-authored-by: Qwerty5Uiop <alex000010@bk.ru> Co-authored-by: Qwerty5Uiop <105209995+Qwerty5Uiop@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#14350) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Victor Baranov <baranov.viktor.27@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…14385) Co-authored-by: Cursor <cursoragent@cursor.com>
…CY (blockscout#14390) Co-authored-by: Victor Baranov <baranov.viktor.27@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…14396) Co-authored-by: Victor Baranov <baranov.viktor.27@gmail.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive OpenAPI specification framework, including a new openapi-spec skill, detailed reference guides, and automated spec generation scripts. It also applies these standards to the AdvancedFilter and Arbitrum controllers by integrating OpenApiSpex and CastAndValidate. The review feedback identifies critical issues where existing pagination helpers in both controllers still use string keys; since CastAndValidate now casts parameters to atom keys, these helpers will fail to match or return empty cursors, breaking pagination. Additionally, a pattern match in AdvancedFilterController.paging_options/1 was flagged as too strict for optional query parameters.
|
|
||
| next_page_params = | ||
| next_page |> next_page_params(advanced_filters, Map.take(params, ["items_count"]), false, &paging_params/1) | ||
| next_page |> next_page_params(advanced_filters, Map.take(params, [:items_count]), false, &paging_params/1) |
There was a problem hiding this comment.
The paging_params/1 callback (defined at line 608) needs to be updated to use atom keys. Since CastAndValidate is now active, the items in advanced_filters (which are passed to this callback by next_page_params/5) will have atom keys. The current implementation of paging_params/1 uses string keys ("block_number", etc.), which will result in an empty cursor and broken pagination links in the response.
| defp paging_options(%{ | ||
| "block_number" => block_number_string, | ||
| "transaction_index" => transaction_index_string, | ||
| "internal_transaction_index" => internal_transaction_index_string, | ||
| "token_transfer_index" => token_transfer_index_string, | ||
| "token_transfer_batch_index" => token_transfer_batch_index_string | ||
| block_number: block_number_string, | ||
| transaction_index: transaction_index_string, | ||
| internal_transaction_index: internal_transaction_index_string, | ||
| token_transfer_index: token_transfer_index_string, | ||
| token_transfer_batch_index: token_transfer_batch_index_string | ||
| }) do |
There was a problem hiding this comment.
The pattern match in paging_options/1 is too strict. It requires all five keys (block_number, transaction_index, etc.) to be present in the map. Since these are optional query parameters, CastAndValidate will only include the ones provided by the client. If any are missing, this clause will fail to match, causing the controller to fall back to default paging options (line 635) and ignore the user's cursor. Consider using Map.get/2 or individual assignments to handle optional parameters.
| def messages(conn, %{"direction" => direction} = params) do | ||
| def messages(conn, %{direction: direction} = params) do | ||
| options = | ||
| params |
There was a problem hiding this comment.
The paging_options/1 function (called here) needs to be updated to handle atom keys. With CastAndValidate active, params will contain atom keys (e.g., :id), but the implementation at line 588 still expects string keys ("id"). This will cause pagination options to be ignored for cross-chain messages.
| """ | ||
| @spec batch_by_anytrust_da_info(Plug.Conn.t(), map()) :: Plug.Conn.t() | {:error, :not_found} | ||
| # For AnyTrust, data_key is the hash of the data itself | ||
| def batch_by_anytrust_da_info(conn, %{data_hash: data_hash} = params) do |
There was a problem hiding this comment.
The batches/2 action (called indirectly via all_batches_by_data_availability_info) relies on paging_options/1 and paging_params/1 which still use string keys (lines 592 and 605). Since CastAndValidate is now active, these helpers must be updated to use atom keys (:number) to avoid breaking pagination for batches.
Upstream Sync - v11.1.0
Auto-merge with upstream
v11.1.0failed. Version/workflow conflicts were auto-resolved,but the following files have code conflicts that need manual resolution:
To resolve:
v11.1.0to trigger Docker buildUpstream release notes