Repository navigation
S1 (#359): characterize what the prediction store returns, including failure-by-return-value - #365
Merged
Conversation
Story 1 of epic #359. Tests only — no production code changes, no route, output or partner-facing file differs. The epic moves the Appwrite delivery write behind a gateway. Nothing can be substituted for a contract nobody wrote down, so this records the one the port actually has, in Feathers' sense: what it does today, not what it should do. Three of the five adapted store methods had no test at all. The fake store carried no `get_latest_file_id` and no `get_file_metadata`, and the upload helper discarded the port's return value — so `upload` could have returned None on the happy path with all 43 tests in the file still green. Recorded, with the asymmetries a substitute has to reproduce: - the five methods are not uniform: three return an OperationResult, one a bare string or None, one a bare list - `get_predictions_by_metadata` RAISES MetadataSearchIncomplete rather than reporting failure in its return value, which is the exception to this epic's headline fact and the thing a gateway author is most likely to miss - `upload` fails CLOSED on `success` and OPEN on the file id - `latest_file_id` forwards a no-match untouched; the refusal lives one layer up in delivery/findability, and must not be moved down - `file_metadata` collapses the store document to the four declared identity keys and is the only one of the five that transforms rather than forwards Also characterized as a GAP, not an endorsement: a partial upload's refusal drops the orphan's file id although the store supplies it. Tracked as #364 with an instruction in the test to invert the assertion when it is fixed. Validation, on the supported interpreter (3.11.15 in the views-models env, not the 3.10 shell default — see C-125): - tests/test_store_port.py: 77 passed, was 43 - full suite: 621 passed, 1 failed, 3 skipped, 41 xfailed. The failure is test_the_installed_runtime_dependencies_match_the_lockfile, pre-existing and confirmed failing the same way on clean development: the env holds pipeline-core 3.3.5 while the lock says 3.6.0 (views-models#757) - ruff 0.14.13: clean - ten mutations applied to production code and reverted, each caught: renaming the key the upload return reads, discarding that return, passing filters positionally, moving findability's refusal into the port, turning an empty list into None, dropping the forwarded file id, making the metadata adapter drop absent keys instead of reporting None, swallowing the search exception, adding the orphan id to the refusal, and editing the filters dict in place Four defects in the first draft of these tests, found by /code-review high and fixed here rather than shipped: an expectation built out of the actual result (so it passed on an empty dict), a filters assertion that compared a shared dict with itself, a docstring that planted a `file_id` vs `fileId` defect that does not exist, and a justification claiming findability reads a length when it iterates with `or ()`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ANY1CCy9Xo7zjMY4XJ69v9
This was referenced Nov 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.
Closes #360. Story 1 of epic #359. Tests only — no production code changed, so no route, output or partner-facing file differs.
Why
The epic moves the Appwrite delivery write behind a gateway. Nothing can be substituted for a contract nobody wrote down, and three of the five store methods the port adapts had no test at all: the fake store carried neither
get_latest_file_idnorget_file_metadata, and the upload helper discarded the port's return value. Souploadcould have returnedNoneon the happy path with all 43 tests in the file still green.These are characterization tests in Feathers' sense — they record what the code does today, not what it should do. A failure means the behaviour moved.
What is recorded
The asymmetries a substitute has to reproduce:
OperationResult;get_latest_file_idreturns a bare string orNone;get_predictions_by_metadatareturns a bare list. A gateway that wrapped every answer in one envelope would break two of them; one that unwrapped everything would break three.get_predictions_by_metadataRAISES. It throwsMetadataSearchIncompleterather than reporting failure in its return value — the exception to this epic's headline fact. pipeline-core's own comment says why: returning[]would be "a statement about the shelf rather than about the lookup", and the FAO delivery would report nothing to deliver, "a false negative to an external counterparty". The first draft of these tests asserted the opposite for this method. Register C-104 records a review that made the same mistake and declared the handling dead code.uploadfails CLOSED onsuccessand OPEN on the file id: anything butTrueraises, while a successful result with no usable id returnsNoneto a caller that cannot tell it from "no upload happened".latest_file_idforwards a no-match untouched. The refusal lives one layer up indelivery/findability, and moving it down would make the two layers disagree about what an empty answer means.file_metadatais the only one of the five that transforms rather than forwards — it collapses the store document to the four declared identity keys. It also has no caller on the delivery path, which is parked in [Tracking] Epic #359 — make the store seam switchable #363 rather than decided here.A gap, characterized rather than fixed
⚠ A partial upload's refusal drops the orphan's file id, although the store supplies it in the very result the refusal is built from (
data={"file_id": ...},code="PARTIAL_SUCCESS"). The operator is told an orphan exists and not told which file it is, on a bucket that held 1,007 files at the last count. Filed as #364; the test asserts today's behaviour and carries an instruction to invert the assertion when it is fixed.Validation
On the supported interpreter — 3.11.15 in
views-models/envs/views-postprocessing, not the 3.10 shell default, which is below this project's own declared floor and makes the suite abort at collection (register C-125):tests/test_store_port.pyruff0.14.13The one failure is
test_the_installed_runtime_dependencies_match_the_lockfile, pre-existing and confirmed failing identically on cleandevelopment: the environment holds pipeline-core 3.3.5 while the lock says 3.6.0, which is views-models#757.Mutations, each applied to both partner copies and reverted: renaming the key the upload return reads; discarding that return; passing filters positionally; moving findability's refusal into the port; turning an empty list into
None; dropping the forwarded file id; making the metadata adapter drop absent keys instead of reportingNone; swallowing the search exception; adding the orphan id to the refusal; and editing the filters dict in place.Four defects in my first draft, fixed rather than shipped
Found by
/code-review high, all four verified against the installed source before acting on them:{key: expected.get(key) for key in got}), so it passed on an empty dict and on an adapter that dropped absent keys. Now a literal four-key dict per row — and the mutation that previously slipped through is caught.file_idvsfileIdwas a bug. It is not:upload_databuildsdata={"file_id": ...}, whilefileIdis Appwrite's spelling inside metadata documents. Both are correct where they appear, and the docstring now says so.TypeErroronNone. It iterates withfor doc in ... or (). The guard was real; only its stated reason was wrong, and the correction is kept in place rather than deleted.Two smaller ones also fixed: the double's field order now matches the real
OperationResult(success, data, error, code), and a line-number citation was replaced with a citation by file and wording, for the reasonstore_port.uploadgives about its own.Not in this PR
reports/falsification_2026-11-25_nothing_is_broken.pystays untracked. It is from a different story and carries three claims that are now stale.🤖 Generated with Claude Code
https://claude.ai/code/session_01ANY1CCy9Xo7zjMY4XJ69v9