fix(agent-toolkit): write a numeric assetId in finalize_asset_upload - #486
Open
marcin-polak-monday wants to merge 2 commits into
Open
Conversation
The tool wrapped the new asset's id in String() before putting it into the file column value. monday.com compares that stored value against the asset's own numeric id when it decides whether a file column grants a user access to a file, and a string never matches an integer, so guests on boards that have permission rules got "File not found or deleted" for every file uploaded through this tool. Board members and admins were unaffected because their membership short-circuits the check before the comparison happens. Write assetId as a number. Also send isImage so image uploads render a thumbnail in the cell, and pass column_id to complete_upload so the asset is recorded as column bound instead of being left with no columnless metadata. https://monday.monday.com/boards/8297269624/pulses/12889382164 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… to a number complete_upload.id is a GraphQL ID scalar, which the API serializes as a string, so passing it through unchanged still wrote a string assetId into the file column. Coerce it with Number() before building the added_file value and in the returned asset_id, type the interface as string, and use a string id in the test mock so the number assertion actually exercises the coercion. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Guests on boards with column permission rules saw "File not found or deleted" for every file uploaded through
finalize_asset_upload.The tool wrote
assetIdinto the file column value as a string.complete_upload.idis a GraphQLIDscalar, so the API serializes it as a string even though the hand writtenCompleteUploadMutationinterface declared it asnumber. monday.com compares the storedassetIdstrictly against the asset's numeric id when deciding whether a file column grants access to a file, and a string never matches.Fix
complete_upload.idwithNumber()before building theadded_filevalue and in the returnedasset_id.complete_upload.idasstringto match the GraphQL schema.isImageso image uploads render a thumbnail in the cell.column_idtocomplete_uploadso the asset is recorded as column bound.Companion monolith change: DaPulse/dapulse#114323 makes the server side comparison tolerant of ids already stored as strings.
Tests
yarn jest src/core/tools/platform-api-tools/finalize-asset-upload-toolpasses (6 tests).🤖 Generated with Claude Code