Feeder: close the hardening items and test gaps from the PR #57 reviews #58
Labels
No labels
boundary:crosses
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/messages-mind-mcp#58
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR #57 (issue #9, the Feeder) merged as
037c7bb, pinned to the gated head08484b3. A correctness review and a security review ran on each head. The reviews of26539ccfound three blockers, and rework round 2 fixed them (spec rows R10-R20). The last pair reviewed08484b3and found no blocker. The items below were found and not fixed in that PR. Each was checked against the code by its reviewer. "Mutation survives" means the change left both suites green.The Feeder serves no real history before #10 (ruling F), so no item below affects a real history today. Items 1 and 2 must be fixed before #10 serves one.
Should fix before #10
503 source-unavailable, and sync stalls (Router.swift:122, reproduced). sync halves thelimitonly onresponse-too-large(README: "For an oversized page,syncthen asks again with half thelimit"). Reproduction: 400 rows with 1024 attachments each;after=999&limit=500gives 503,limit=250gives 200. Fix: answerresponse-too-large, or cut the page as the 1 MiB body cut does. The response is also encoded twice (up to 32 MiB transient per request, 8 concurrent): encode once and measure the bytes. The encode fallback atRouter.swift:49sends an error body under status 200.Operations.swift:95-133, reasoned).rowPagestops at 10,000 examined rows;changed-rowsandrecently-deletedloop until the source is exhausted. Under a deny policy every such request walks the whole history. The loop also cannot advance on a source row with a nil edited time; only the dependency'sWHERE … date_edited > 0prevents that. Give both time pages therowPagebudget.rowPagescan budget lives in two literals, and a mismatch hangs (reproduced). Changingscanned < 10000atOperations.swift:73to< 20000makestestScanBudgetIs10000Rowsloop forever, because the innerbreakat line 78 makes no progress. Use one constant, and give the test suites a time limit per test.Router.swift:65constructsOpenPolicy(), andConfig.swift:66defaults toOpenPolicy.servesOwnerHistory. #10 can touch onlyFilter.swiftif it keeps the type name.Should fix
open(p, O_WRONLY | O_CREAT, 0o600)plusFileHandle(fileDescriptor:).writebuilds and passes. It adds one Swift-mangled symbol,Darwin.open(_:_:_:)with a mode, that no deny pattern matches. Add the 3-argumentopen,FileHandle.write, andDarwin.write,pwrite,ftruncate,mkdir,creatandopenatto the Swift deny patterns (tests/test_feeder_real.py:922-933), and ban the write flags andFileHandle(fileDescriptor:inFORBIDDEN(tests/test_feeder_package.py:11-21).FileManager.removeItem,FileHandle(forWritingAtPath:)orcreateDirectorypassestest_the_binary_links_only_allowed_symbols. The source scan still catches them. Correct the test's claim, or check the Objective-C selectors in the binary.dlsymwith a composed name evades the scan (reproduced).dlsym(…, "posix_" + "spawn")passes. No Feeder source callsdlsym: ban it infeeder/Sources, and fold"a" + "b"across the whole scan, not only for the edit-blob name.SQLCipher.frameworkimports_dlopen,_rename,_unlink,_write,_pwrite,_ftruncateand_mkdir, and loads through@rpathfrom the build directory (ruling D). Say so in the test comment, or scan the framework too.GLOSSARY.md,contracts/feeder-v1/README.md). The round-2 stale-socket rule makes anAF_UNIXconnect()probe. Say "never starts a connection off the host".GLOSSARY.mdis an operator ruling surface.FeederLog.bindRetrytakes a free string, which weakens the closed-forms rule of the log. Take the closederrnoNameresult only.Test gaps
source-unavailablestore-open branch is never executed, so a path leak there is unproven: adding the canonical path to thecatchatSource.swift:89survives. Add a file that passes every rule but is not a database, assert 503, and run the closedFeederLogcheck over all stderr in every black-box test (fromserving()teardown).info.st_uid == getuid()fromprivateParent(Config.swift:117), fromhistoryIsSafeToOpen(:124) or from the rechecklstat(:221) survives. Split owner and mode into a pure function, asstaleSocketIsOursis, and call it with another uid.S_IFREGhalf oftokenMetadataIsSafe(Config.swift:138) and of the config-file guard (:72) survives. Add cases with a non-regular mode.let handle = row.fromOwner ? nil : unfilteredchanged tounfiltered(Operations.swift:217) survives;schema.json:86-87requires a null sender whenfrom_owneris true.Shaping.identifierdropped in the recent path) and on hard-deletion records (record.guid ?? ""atOperations.swift:144) survive.requireCap(config.maxResultsHardCap)removed fromSource.initsurvives; the test covers only the pure function..waiting, the ready gate on accept, and the chmod verify (== 0o600totrue) each survive.millis % 1000through aDoublesurvives; no test uses a value that loses precision.sleep(0.1)and is timing-sensitive.Notes
MessagesCoreopen by path, a process can swap the file in and back before the post-read check, which the(st_dev, st_ino)pair cannot see. The spec records the window. Thest_nlink,S_IFREGand history-path rules still block pointing the Feeder at the real history, and such a process can already read the token (SECURITY.md).0700parent. Record the wider placement in the ADR or the config document. ADRs are an operator surface.checknewest-date walk has no budget.-shmand-walfiles beside a history that has none. The read-only test uses onlyjournal_mode=DELETE.otherto 2006, whichMessagesCorereads asemoji. No fixture uses it.README.md,SECURITY.mdandcontracts/feeder-v1/README.mdstill say the Feeder is not built. Ruling F leaves these to #10.Acceptance criteria
Triage rulings (2026-11-15)
These rulings replace the matching text above.
GLOSSARY.mdandcontracts/feeder-v1/README.md, replace "never starts a connection" with exactly: "The Feeder starts no network connection. It makes one local connection to its own socket path, to test whether an old socket is live." Change no other text inGLOSSARY.md.Blocked by
Filed under: operator word "merge 57" sha256:1361536e73d8
Feeder follow-ups from the PR #57 gateto Feeder: close the hardening items and test gaps from the PR #57 reviewsTriage
Route:
ready-for-agent. The operator ruled the open items on 2026-11-15 and told the session to triage this issue and dispatch it after #13.Rulings that apply to this issue:
GLOSSARY.mdandcontracts/feeder-v1/README.md, replace "never starts a connection" with: "The Feeder starts no network connection. It makes one local connection to its own socket path, to test whether an old socket is live."0700directory that the Owner owns. ADRs are an operator surface.Order: items 1 to 4 must merge before #10 serves a real history. This issue goes before #10.
Not decided here: item 13 (token strength). The spec proposes a rule, and the architect gate checks it.
Filed under: operator word "accept leans / after #13, triage #58 and dispatch" sha256:a999fb29c997
⏸ SVD architect gate: dev/messages-mind-mcp#58 feeder-close-the-hardening-items-and-test-gaps-from-the-pr-5
Status: CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity
substrate· dispatch efforthighRun:
20261115T001412Z-0a6259f4Held because: CLEAN but 6 open risk(s) (3 verification · 3 decision) — HOLD-ALL parks everything. The risks, verbatim:
Open risks:
Change: Organised by file.
scanBudgetconstant (10_000), pluspageBodyBytesandresponseBytes(16 MiB). InrowPage(:67-93) andchatPage(:154-171), one localfull()predicate drives both the outer loop and the inner break, so the two can never disagree (item 3).PageBytesmeasures each item's encoded size and cuts the page before the item that would pass 16 MiB. A cut page keeps at least one item and saysmore. This mirrors the 1 MiB cut at :73/:78/:86, and intimePageit copies the early return at :109/:126 (item 1).scanBudgetonce they hold an item. A progress guard throwssource-unavailablewhen a batch cannot advance the cursor (item 2, contract-preserving default).Responseholds the body bytes, encoded once. An encode error becomes 503. Refusal bodies are built from the closed raw value (item 1).FeederPolicy()replacesOpenPolicy()(item 4).FeederLog.bindRetrytakes a closedBindRetryCodeenum (item 11).public typealias FeederPolicy = OpenPolicy(item 4).FeederPolicy.servesOwnerHistory(item 4).privateDirectoryandopenableHistory, shaped likeListener.staleSocketIsOurs(Listener.swift:30-32) (item 15).configMetadataIsSafe(item 16).tokenIsAcceptable: 32-4096 visible ASCII characters with at least 8 distinct (items 10 and 13).init(historyPath:cap: = 5001)(item 19).prepareSocketwith anafterProbehook (item 20).nextDelay,acceptsandsocketIsPrivate; anapply(state)method; adelayUnitand a snapshot for tests (item 21).serving(); the 16 MiB reproduction;lsof -Uwaits in place of sleeps (item 23); new scan patterns, a selector scan and a load-command scan (items 5-8).Files:
feeder/Sources/FeederCore/Router.swift·feeder/Sources/FeederCore/Operations.swift·feeder/Sources/FeederCore/Filter.swift·feeder/Sources/FeederCore/Config.swift·feeder/Sources/FeederCore/Source.swift·feeder/Sources/FeederCore/Listener.swift·feeder/Tests/FeederCoreTests/FeederCoreTests.swift·tests/test_feeder_real.py·tests/test_feeder_package.py·GLOSSARY.md·contracts/feeder-v1/README.mdDecision: accept the 6 open risk(s) above and dispatch this spec (
svd:go), or park (svd:skip) / re-spec (svd:respec)?Your call (when this issue is held at the gate via
svd:hold):svd:go— approve; Half-B dispatch accepts exactly this spec (open risks accepted)svd:firebesidesvd:go— approve AND authorise the Half-B fire from the phone; never on its ownsvd:skip— park it; dispatch refuses it and the issue stays for a humansvd:respec— discard this spec; the next Half-A run re-produces it with this record as prior-attempt contextSpec:
/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-15-feeder-close-the-hardening-items-and-test-gaps-from-the-pr-5.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-15-feeder-close-the-hardening-items-and-test-gaps-from-the-pr-5.mdspec-verify-dispatch Half B for dev/messages-mind-mcp#58 feeder-close-the-hardening-items-and-test-gaps-from-the-pr-5 completed integration verify.
d803a1b2e0codex-svd ship --run-id 20261115T003753Z-926cdc02 --confirm-merge)spec-verify-dispatch Half B for dev/messages-mind-mcp#58 feeder-close-the-hardening-items-and-test-gaps-from-the-pr-5 completed integration verify.
ea8b70c011uv run, which collected 219 tests in the three feeder test files.codex-svd ship --run-id 20261115T003753Z-926cdc02 --confirm-merge)