Repository navigation
fix(plugins): key failure records by run ID - #587
Conversation
Failure records were keyed by the client-supplied X-Request-ID, so a client could reuse an ID to overwrite an earlier record or collide with other clients' records. Key them by the server-generated run ID and keep the request ID as the field request_id. Document the change in the new migration guide for 0.20.0. Closes #575 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Link 0.18.0 as the previous guide, list the change under breaking changes and explain lookups during the transition. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Reviewer's GuideThis PR prevents failed-run records from colliding when clients reuse request IDs by keying them with each run’s server-generated ID, while retaining the request ID for correlation. It adds focused regression coverage and documents the breaking lookup change, including compatibility guidance for legacy records. Sequence diagram for failure record persistence by run IDsequenceDiagram
participant Client
participant PipelineRun
participant ProvenanceStore
participant MongoDB
Client->>PipelineRun: request()
PipelineRun->>ProvenanceStore: save_failure(run, error)
ProvenanceStore->>MongoDB: replace_one(_id=run-run_id, request_id=request_id, upsert=true)
MongoDB-->>ProvenanceStore: failure record stored
ProvenanceStore-->>PipelineRun: true
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #587 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 56 56
Lines 7068 7068
=========================================
Hits 7068 7068
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Linked issues
#575 fix(plugins): key failure records by run ID · 4 of 4 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Failure records keyed by a server-generated run ID | ✅ Met | save_failure uses run-<run_id>; PipelineRun generates run_id with uuid.uuid4().hex. |
| 2 | Request ID kept as a field | ✅ Met | The request ID remains in the provenance record as request_id. |
| 3 | Tests that reused request IDs don't overwrite | ✅ Met | The added test saves failures from two runs with the same request ID and asserts both records remain. |
| 4 | Docs and upgrade notes | ✅ Met | The provenance docs and 0.20.0 migration guide describe the new keys and explain how to look up records during the transition while old records remain. |
Sourcery assessment
Needs a human reviewer. Failure records are now stored under server-generated run IDs, so code that expects request IDs in _id will miss new records; they remain recoverable through request_id, and reverting would not change keys already written. The change also prevents reused client request IDs from overwriting one another’s records.
Summary
Failure records (
record_failed) are keyed byrun-<server-generated run ID>instead of the client-suppliedX-Request-ID; the request ID stays in the record asrequest_id. New migration guide for 0.20.0 (breaking change for consumers that look up failure records by_id), docs updated.Closes #575
Verification
pytest(full suite, local MongoDB 7.0 on its own port): 3241 passed, 2 skipped;coverage report: 100%ruff check,ruff format --check,mypy: cleanmkdocs build --strict, ast-grep, Helm tests, integration tests (left to CI)Review
Regular lane: adversarial reviewer found nothing; quality reviewer found 2 medium + 1 low in the migration guide, all fixed (docs only, no second round).
Declined review findings
None.
Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Key stored failure records by server-generated run IDs while retaining request IDs for correlation.
Bug Fixes:
Enhancements:
request_idfield for failure-record correlation.Documentation:
Tests: