Repository navigation
3.x.x: answer 404, not 500, for a public artifact whose legacy body is not on the host yet (#735) - #796
Merged
Conversation
…s not on the host yet (#735) `/public/v1/artifacts/<sha>` turned every legacy-body failure into a 500, including a body that `import-audits` has not stored and that is not on that host. The legacy body reader now says why it failed: absent (the body file, or a share segment its envelope names, is not there), a fault (there but unreadable, not JSON, failing verification or its digest, which includes 2.x v2 bodies until #731), or internal. The artifact routes answer absence with a no-store 404 and keep every fault at 500, logged with its reason; read timeouts are unchanged. The block's audit views keep their 404s and messages. Errors were already never cached (no-store, no CDN headers, the origin cache stores successes only); the new test pins that for the 404, checks the 5xx count sees only faults, and serves the body as soon as it arrives. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The settlement-artifacts route asks `artifact()` whether a legacy body is servable before linking it, so a faulty body logged the artifact route's warn on every settlement compute without serving a 500. Who reads a legacy body is now a `BodyReader`: the audit views (404s, no logs, as before), `/public/v1/artifacts/<sha>` (a 500 logged at warn, an absent body at debug) and the link check (both at debug). Each event names the block, the artifact sha256 and the recorded body URI, in the server log only. The test now covers an envelope that proves itself but is another audit's body (500, "audit bundle body hash mismatch"), asserts the reader's log events at every step (warn per served fault, debug for absence and for the link check, nothing from the audit view), and labels each step. The OpenAPI 404 declares `Cache-Control: no-store`, and the docs name a missing share segment and the `unknown PRISM block` race as 404s. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… content address (#735) A bundle read now fails with a `BundleError`: `Absent` for a proven absence (the legacy body or a share segment is not at its recorded location, or the row went away between lookup and read), `Other` for anything else. The artifact routes let only `Absent` through as a 404, whatever code another error carries; a read timeout keeps its 503. An artifact read now checks that the row it reads by block still answers the address it was found by, so a row re-imported in between is the unknown-artifact 404 instead of another audit's body under the old address. A body URI with a scheme other than `file://` is a fault (500, warn), not a permanent 404, and `qbit_prism` resolves a `file://` share segment to its local path for every reader, the import included; every segment is digest-checked, so only the path changes. The reader's arms are merged: the audit views answer and log absence like the other readers, and the link check logs no fault. The docs say that a 2.x v2 body whose segments are missing is a 404 like any absent body. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…efuse segments in other stores (#735) `audit_canonical_bytes_admitted` takes the artifact address the row was found by and refuses a row that no longer advertises it with `AuditReaddressed`, before any work proportional to the window. The public route answers that with the unknown-artifact 404, so a re-import between the lookup and the stored-bytes read can no longer serve the new bytes as an immutable response under the old address. The bundle read's second query, for bytes stored after its first, checks the address the same way instead of failing the old digest with a 500. The race test now covers all three reads. `qbit_prism` refuses a share segment URI with a scheme other than `file://` (a fault, for the API, the import and the CLIs alike) and resolves `file://localhost/<path>` to the absolute path. The link check logs its faults at debug again, and the audit views log nothing, as before. The docs list the re-import 404. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
Closing and reopening to re-run CI (this token can't re-run workflows). Shard 1's only failure was |
This was referenced Oct 28, 2026
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.
Fixes #735.
/public/v1/artifacts/<sha>answered 500 for every legacy-body failure, including an audit whose legacy bodyimport-auditshas not stored yet and that is not on the serving host.What changes
bundle_withreturns a typedBundleError { Absent, Other }, and only a proven absence reaches/public/v1/artifactsas a 404, with no-store and no CDN or immutable headers. Every fault stays a 500, logged at warn with the block, artifact sha and body URI. Read timeouts are unchanged.unknown public PRISM artifactinstead of serving another audit's body.file://segments.qbit_prism::resolve_body_uristripsfile://for share segments, so the API, import-audits and the audit CLIs resolve them correctly.Cache-Control: no-storeand lists its messages) are updated.Tests
api_2xtests cover the absent body and absent segment (uncached 404), each fault class (500), a body that arrives later, the audit views' messages, the log events at each step, and a re-import race under a held lock. Lib unit tests cover the typed fallback, the scheme rule andfile://resolution. Each fails without its fix.api_2x,api_database,artifact_admission,api_contract, theledger_postgreslegacy-artifact subset,migration_rollbackfrozen 2.x import, libapi::, and theqbit-prismlib and audit tests all pass. fmt, clippy and the guards pass.Final round (4ad2e77)
AuditReaddressedbefore any decode, so the old address answers 404 instead of serving the new bytes with the old ETag.file://segment scheme is a fault (500).file://localhost/<path>resolves to/<path>.Out of scope: alerting on a missing audit volume, which needs a reason-labelled counter.
🤖 Generated with Claude Code