Repository navigation
ingest_stored deletes its own refused, unregistered object - #554
Conversation
Codex review, round 1 (gpt-6.1-sol, max), on the earlier design (discard_unregistered)VERDICT: APPROVE No blocker, major, or minor findings.
Validation: 16 related unit tests passed; CI quality passed. PostgreSQL integration CI was pending. No containers started or files modified. Design change (commit 6225dd0)The team-lead decided that |
6225dd0 to
9b9ce0f
Compare
Codex review, round 2 (gpt-6.1-sol, max)VERDICT: REQUEST_CHANGES
Otherwise, expected refusals are covered. Validation: 163 related local tests passed; CI quality/unit passed, worker database tests remained pending. No files modified or containers started. Dispositions (commit 9b9ce0f, rebased on main)
|
|
Round 3 of the Codex review was stopped before it finished. The team-lead and UMC asked to keep a public |
Codex review, round 3 (gpt-6.1-sol, max)VERDICT: APPROVE No blocker, major, or minor findings at
Validation: 168 local tests passed, Ruff and diff checks passed. CI quality/unit passed; database integration remained pending at last check. No files modified or containers started. |
A host whose ingest_stored call was refused cannot tell whether the key is already some content's raw object (a refused re-registration of a registered key). discard_unregistered deletes the object only when no content keeps it, and returns whether it did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
Team-lead decision: instead of a separate discard method, a refusal (size, content type, metering, forgotten identity, invalid metadata) raises StoredObjectRefusedError(refusal, raw_object_deleted). The engine deletes the refused object unless a content keeps the key as its raw object. Storage and database failures delete nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
Streaming the object runs outside the refusal handler, so a read failure (even one raised as ValueError, like a malformed Content-Length) deletes nothing and can be retried. The changelog line moves out of the already published 0.18.2; the 0.18.3 release prep carries it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
Team-lead and UMC: a public UploadIngestor.discard_unregistered deletes an object no content keeps (abandoned before registration; unregistered bytes escape hard forget). ingest_stored's refusal path uses it. The changelog gets an Unreleased section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
dca26b0 to
78ad589
Compare
Summary
UMC needs this for large direct uploads (UMC #804). When
ingest_storedrefuses an object, UMC can't tell whether the key is already registered, so refused uploads of up to 5 GiB would stay in storage unbilled. Per the team-lead's decision, the engine now deletes its own refused, unregistered object.ingest_storednow raisesStoredObjectRefusedError(refusal=..., raw_object_deleted=...), aValueErrorthat carries the original error. That covers:ContentDetectionError);ManagedTextClassificationError);ForgottenSourceError);DocumentCatalog.raw_object_registered, anEXISTSlookup oncontent_objects.raw_uri). A refused replay of a registered key keeps its object.raw_object_deletedsays which happened.ForgetInProgressError), raise unchanged, so a retry can succeed. A key outsideuploads/is still a plainValueErrorand deletes nothing.UploadIngestor.discard_unregistered(*, deployment_id, key) -> boolapplies the same rule on its own, for UMC's sweeper of uploads abandoned before registration (unregistered bytes escape hard forget).False.True; a missing object also returnsTrue.uploads/raisesValueError.ingest_stored's refusal path uses it.ingest_storedshipped in v0.18.2 with the original refusal types. A caller that catchesContentDetectionError,ManagedTextClassificationErrororForgottenSourceErrorfrom it must now catchStoredObjectRefusedErrorand inspect.refusal. A caller catchingValueErrorkeeps working. UMC (#804) is the only known caller and has been told. The engine is pre-1.0.ValueError(such as a malformedContent-Length).Test plan
ruff, pyright, unit lane (3154 passed)
test_ingest_routability.py::test_a_storage_failure_while_streaming_deletes_nothingtest_ingest_stored_pg.py::test_a_refused_object_is_deleted_unless_a_content_keeps_it: a refused new key is deleted, and a refused replay of a registered key is kept. Also coversdiscard_unregistered: an abandoned object is deleted, a missing one counts as success, a registered one is kept, and a key outsideuploads/is refused.test_managed_metering_sql.py: the metering refusal (source_bytes_limit_exceeded) wraps the original error and deletes the object.The PostgreSQL tests run in CI; local containers are off-limits.
I have read and agree to the RememberStack Contributor License Agreement v1.0.
🤖 Generated with Claude Code
https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm