fix(transfer): trust axon upload s3 key#83
Merged
Conversation
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.
Summary
This PR changes the
upload_completehandler to trust thes3_keyprovided by axon in the WebSocket message, instead of reconstructing it from factory ID, device ID, date, and task ID.Motivation
Previously,
onUploadCompletecomputed the MCAP S3 key using a hardcoded pattern ({factory}/{device}/{date}/{taskID}.mcap). If axon uploaded the file to a different path (e.g., a different key prefix or naming convention), the ACK verification would fail with a "file not found" error, causing the upload to be stuck in an unacknowledged state. By trusting thes3_keythat axon reports in theupload_completepayload, keystone always looks for the exact file that was actually uploaded.Changes
Modified Files
internal/api/handlers/transfer.go— Replaced the hardcoded S3 key construction with two new helper functions:uploadCompleteS3Key()— extracts thes3_keyfield from the WebSocket message payload.uploadCompleteSidecarS3Key()— derives the sidecar JSON key by replacing the.mcapsuffix with.json, with a safety check that the MCAP key actually ends in.mcap.When
s3_keyis missing or invalid, the handler logs a warning and skips the ACK flow gracefully (no crash, no retry loop).Type of Change
Impact Analysis
Breaking Changes
None
Backward Compatibility
Fully backward compatible — axon already includes
s3_keyin theupload_completemessage payload.