Repository navigation
refactor(adapters): delete the port reads that only the slice's list and search used - #164
Merged
Merged
Conversation
…and search used Step 5c-3b of moving off /api/_slice (the owner's order for 5c-3 is the core, then the adapters, then the create limiter, one PR each). #161 deleted the core functions that called the port's `list_work_items` and `search_work_items`; nothing but tests calls them now. `get_work_item` and the `Tx` writes stay, because `create_issue`, `delete_issue` and `put_attachment` use them; the Postgres adapter's `like_pattern` stays too, because the workspace search uses it. Deleted: the two methods on the `Database` port and their memory and Postgres implementations. `mutant_search_case_sensitive` was planted in both searches of the memory adapter; it is in the workspace search now (the one /api/v1 and the engine pass go through), and the engine pass still kills it: 2 of its 4 tests fail. The tests that read through the two methods read what is left, and each replacement keeps what the read was for: - memory adapter: the reset test checks each seeded row is gone in any state (`get_work_item` with `WithDeleted`, stronger than the old live list); a refused creation leaves one live item (the `total` of a page); the not-there update test checks both rows of the project, the only two, by id with `WithDeleted`. - Postgres adapter: tests of a rollback, an abandoned transaction, a soft delete and a refused update read the table with SQL (`every_item_name`, `live_item_count`). That is the table's state and not the adapter's reading of it, so a row that a failed write leaked cannot hide behind the adapter's own filter. - Postgres model: `Op::List` becomes `Op::Table`, the project's live rows or every row read with SQL and compared with the model's. It is kept because it is the model's only way to see an extra row (`Op::Get` picks from rows the model knows). The step classes go from 214 to 213: `ListedWrongWorkspace` went with the method, since a SQL read has no scope check to probe (`GotWrongWorkspace` keeps the tenant probe of `get_work_item`). - statement-counting model: `Step::List` becomes `Step::Get`; each is one statement. One assertion is removed and not replaced, under AGENTS rule 3: tests/history.rs checked that "the item as the list reads it carries the name", and the page assertion just above it already compares the whole row with the updated one (`after` sets the name). Its subject, the list read, is gone. Two doctests in thrust-core's `authorize` called the port's `list_work_items`. They use `get_work_item` now, with the same arguments in the failing example and in its compiling control. Before, the failing example called a two-argument method with three, so it failed on arity and not on the proof it exists to guard. I first tagged it `compile_fail,E0308` and said rustdoc enforces the code; a control (the example given the wrong kind of error) still passed, so on stable it does not, and the tag is removed. What shows the reason is the control: the same call with the proof in the first place compiles. G-24 in status.md still said nine requests and the slice's list; it says eight (step 5c-1 missed it). G-26 records this step; mutation.md says where the search mutant is. Checked: the Postgres adapter tests against a container 70 of 70 (DOCKER_HOST set; no Docker errors); `cargo nextest run` 3866 of 3866 (4 skipped); core doctests 3 of 3; native-memory main 70 of 70, sweeper 3 of 3, csrfoff 6 of 6, engine 4 of 4; clippy and rustfmt clean on the workspace. Controls, all temporary and reverted: - `ROLLBACK` changed to `COMMIT` in `PgTx::rollback`: the Postgres model fails, at its end-of-case outbox depth check and not at the table op; the rollback test and the counting model do not see it. - the table op's expectation inverted: the model fails at step 1 with "the project's rows in the table", so the new observation runs and compares. - `mutant_search_case_sensitive`: the engine pass fails 2 of 4. The other three targets run in CI. Refs: #58 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
aRustyDev
deleted the
refactor/delete-adapter-slice-work-item-methods
branch
November 14, 2026 07:35
This was referenced Nov 15, 2026
Closed
Merged
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.
Summary
Step 5c-3b of moving off
/api/_slice: delete the port reads that only the slice's list and search used. The owner's order for step 5c-3 is the core (#161, merged), then the adapters (this), then the create limiter, one PR each. #161 deleted the core functions that called the port'slist_work_itemsandsearch_work_items, so nothing but tests calls them now.What goes
list_work_itemsandsearch_work_itemson theDatabaseport, and their memory and Postgres implementations.get_work_itemand theTxwrites stay:create_issue,delete_issueandput_attachmentuse them. The Postgres adapter'slike_patternstays too, because the workspace search uses it.mutant_search_case_sensitivewas planted in both searches of the memory adapter; it is in the workspace search now (the one/api/v1and the engine pass go through).How the tests that read through them change
Each replacement keeps what the read was for.
get_work_itemwithWithDeleted, stronger than the old live list); a refused creation leaves one live item (thetotalof a page); the not-there update test checks both rows of the project, the only two, by id.every_item_name,live_item_count). That is the table's state and not the adapter's reading of it, so a row that a failed write leaked cannot hide behind the adapter's own filter.Op::ListbecomesOp::Table, the project's live rows or every row read with SQL and compared with the model's. It is kept because it is the model's only way to see an extra row (Op::Getpicks from rows the model knows). The step classes go from 214 to 213:ListedWrongWorkspacewent with the method, since a SQL read has no scope check to probe (GotWrongWorkspacekeeps the tenant probe ofget_work_item).Step::ListbecomesStep::Get; each is one statement.One assertion is removed and not replaced
tests/history.rschecked that "the item as the list reads it carries the name". The page assertion just above it already compares the whole row with the updated one (aftersets the name), and its subject, the list read, is gone. The commit message says so, as AGENTS rule 3 asks.Two doctests in
thrust-coreThe two
authorizedoctests called the port'slist_work_items. They useget_work_itemnow, with the same arguments in the failing example and in its compiling control. Before, the failing example called a two-argument method with three, so it failed on arity and not on the proof it exists to guard.A correction to my own first attempt: I tagged the example
compile_fail,E0308and said rustdoc enforces the code. A control (the example given the wrong kind of error) still passed, so on stable it does not; the tag is removed and the compiling control is what shows the reason.Docs
G-24 in
docs/src/testing/status.mdstill said nine requests and the slice's list; it says eight (step 5c-1 missed it). G-26 records this step, andmutation.mdsays where the search mutant is.Verification
cargo nextest run --ignore-default-filter -E 'binary(pg_adapter)',DOCKER_HOSTset to OrbStack's socket): 70 of 70, no Docker errors.cargo nextest run: 3866 of 3866 (4 skipped).cargo test --doc -p thrust-core: 3 of 3.cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --all --checkclean. Main has not moved since this branch was cut (c32e4bc), so nothing was merged.Controls (all temporary and reverted):
ROLLBACKchanged toCOMMITinPgTx::rollback: the Postgres model fails, at its end-of-case outbox depth check and not at the table op. The rollback test and the counting model do not see it.mutant_search_case_sensitive: the engine pass fails 2 of its 4 tests.Not run locally: native-pg, worker-memory and worker-cf contract cells (they run in CI), and the passes outside main, sweeper, csrfoff and engine.
Still to come in step 5c-3
The create limiter:
RL_CREATE,THRUST_CREATE_RATE_LIMIT,THRUST_EXPECT_CREATE_LIMIT,Target::create_limitand the pages that describe them.Part of #58; this PR does not close it.
🤖 Generated with Claude Code