Skip to content

fix(transfer): trust axon upload s3 key#83

Merged
shark0F0497 merged 2 commits into
mainfrom
keystone-worktree2-main
May 27, 2026
Merged

fix(transfer): trust axon upload s3 key#83
shark0F0497 merged 2 commits into
mainfrom
keystone-worktree2-main

Conversation

@shark0F0497
Copy link
Copy Markdown
Collaborator

Summary

This PR changes the upload_complete handler to trust the s3_key provided by axon in the WebSocket message, instead of reconstructing it from factory ID, device ID, date, and task ID.

Motivation

Previously, onUploadComplete computed 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 the s3_key that axon reports in the upload_complete payload, 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 the s3_key field from the WebSocket message payload.
    • uploadCompleteSidecarS3Key() — derives the sidecar JSON key by replacing the .mcap suffix with .json, with a safety check that the MCAP key actually ends in .mcap.

    When s3_key is missing or invalid, the handler logs a warning and skips the ACK flow gracefully (no crash, no retry loop).

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Impact Analysis

Breaking Changes

None

Backward Compatibility

Fully backward compatible — axon already includes s3_key in the upload_complete message payload.

@shark0F0497 shark0F0497 merged commit 99861e1 into main May 27, 2026
5 checks passed
@shark0F0497 shark0F0497 deleted the keystone-worktree2-main branch May 27, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant