fix: resolve recorder upload task conflicts#94
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.
Pull Request Checklist
Please ensure your PR meets the following requirements:
Summary
This PR prevents recorder config/begin flows and finish callbacks from racing with tasks that have already moved into upload-related states. It also expands transfer status handling so Keystone can reconcile missed upload requests from transfer status snapshots.
Motivation
uploading,completed, or another non-runnable status.upload_requestmessages when transfer status proves the upload is not already active.Changes
Modified Files
[internal/api/handlers/axon_rpc.go](internal/api/handlers/axon_rpc.go)- Adds task status guards before recorderconfigandbeginRPC calls, including recorder state sync/freshness checks for begin.[internal/api/handlers/task.go](internal/api/handlers/task.go)- Rejects config reads for non-pending tasks and tightens finish callback handling across uploadable, idempotent, and terminal statuses.[internal/api/handlers/task_uploading.go](internal/api/handlers/task_uploading.go)- Aligns upload status transition behavior with the guarded finish callback flow.[internal/api/handlers/transfer.go](internal/api/handlers/transfer.go)- Parses richer transfer status payloads and reconciles eligible failed upload requests with a cooldown.[internal/services/transfer_hub.go](internal/services/transfer_hub.go)- Adds transfer status fields and upload snapshot records used by the status endpoint and reconciliation.[internal/api/handlers/recorder_axon_interaction_test.go](internal/api/handlers/recorder_axon_interaction_test.go)- Updates recorder RPC tests for the new pre-RPC task guards.[internal/api/handlers/task_state_recovery_test.go](internal/api/handlers/task_state_recovery_test.go)- Adds finish callback idempotency, terminal status, and config guard coverage.Added Files
[docs/designs/task-recorder-upload-guard-design.md](docs/designs/task-recorder-upload-guard-design.md)- Documents the recorder/upload guard design.[internal/api/handlers/transfer_status_test.go](internal/api/handlers/transfer_status_test.go)- Covers transfer upload snapshots and upload request reconciliation behavior.Deleted Files
Type of Change
Impact Analysis
Breaking Changes
None
Backward Compatibility
Fully backward compatible. Existing recorder and transfer APIs remain the same; invalid task-state transitions now return conflict responses instead of forwarding unsafe RPC/upload requests.
Testing
Test Environment
httptestlisteners.Test Cases
go test -run 'TestRecorder|TestRecordingFinish|TestGetTaskConfig|TestTransferStatus' ./internal/api/handlers/...Manual Testing Steps
Not run.
Test Coverage
Screenshots / Recordings
Not applicable.
Performance Impact
Documentation
Related Issues
Additional Notes
Reviewers
None requested.
Notes for Reviewers
config/beginand finish callback handling.Checklist for Reviewers