Repository navigation
TD-5444: Code feed: scrub before the cut; scrubbed frames made once per change - #305
Merged
Merged
Conversation
…er change Text over its cap (a card's 4,000/200-character fields, an event's 2,000- character text and 200-character source) is scrubbed before it is cut: a secret split by the cut, or a private key that lost its END line to it, was no longer one the scrubber knew, and part of it showed. The watcher keeps the current feed's scrubbed frames, one for a window and one for a phone or another computer, emptied when its fingerprint changes; the push and get_code_feed share them. Every reply still goes through the reply funnel's scrub. Rebased onto TD-5445 (#304) as one commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SPdoY5jgXgTw6gUHBMBngR
captcrock
force-pushed
the
td/5444-code-feed-scrub-then-cut
branch
from
December 3, 2026 07:17
9d5b03d to
554e8d0
Compare
…rames The watcher noted nothing about register_secret_value, so a value registered after the frames were made went out raw in the next push (main scrubs at push time). The frames are now kept with the number of registered secrets, emptied when it grows, and a frame scrubbed while one was being registered isn't kept. The backlog names every cut: 4,000, 2,000, 200 and 64 characters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SPdoY5jgXgTw6gUHBMBngR
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.
Two follow-ups to the Code feed, from TD-5443's review.
What changes
Scrub before the cut. Card text over 4,000 characters and event text over 2,000 were cut first and scrubbed later. A token that straddled the cut was then no longer a token the scrubber knew, and its first 20 characters showed. Text over its cap is now scrubbed, then cut. Text that fits is scrubbed once, with the whole feed, as before.
Scrubbed frames made once per change. The watcher keeps the current feed's scrubbed frames in two kinds:
It empties them when the same fingerprint the watcher already uses says the folder changed. The push and
get_code_feedshare them, and a feed that is no longer the current one is never cached.Every reply still goes through the reply funnel's scrub, unchanged. The cache saves only the off-loop scrubs that built each frame.
Docs: the TD-5444 backlog entry.
Before / after
where,now,next,needs_you) or the event cutNew tests that fail on main's code (9):
tests/test_code_feed.pypasses on this branch.One existing test changed:
test_the_push_serializes_off_the_event_loop. It slowedscrub_wire_jsonwhere the daemon used to call it. The frame is now built incode_feed, so the test slows it there instead. The assertion is the same.Cost
Scrubbing the cut text before the cut costs a second scrub of that text only. Medians, interleaved with main, on a loaded machine:
read_feedwent from 42–45 ms to 51–53 ms.read_feedruns off the event loop and only when the folder changes.An earlier version scrubbed every field twice and roughly doubled
read_feed. The review round replaced it.Merging with #304
This branch and #304 (TD-5445) both start from main 3837191. Whichever merges second conflicts in
core/tests/test_code_feed.pyanddocs/tst-desk-backlog.md;core/tstd/code_feed.pymerges cleanly. I'll rebase this branch once #304 is merged, rerun the tests and push.Full suite
On
9d5b03dd, on a heavily loaded shared machine (load average 35 to 50): 6 failed, 10,336 passed, 13 skipped, 4 deselected. None of the 6 is in the Code feed.I reran the 6 on their own, three times on this branch and three times with main's
code_feed.pyanddaemon.pyin place of this branch's (the only source files it changes):test_remote_approve.py::TestDoubleResolve::test_second_client_cannot_flip_an_approvefailed; run 3,test_audit_set_aside_errors.py::test_concurrent_set_asides_keep_one_file_one_note_and_every_rowfailed.test_audit_set_aside_errors…andtest_drain.py::test_shutdown_gives_an_open_turn_a_short_settlefailed; runs 2 and 3, all passed.test_second_client_cannot_flip_an_approvefailed 3 of 33 times on this branch and 0 of 33 on main's code, counting the 3 runs above plus single runs. Each failure wasTimeoutError: daemon did not bind, the test's 2.5 s wait for a fresh daemon to listen. That count leans against this branch, though it doesn't settle it. I found no link:CI on a clean runner is the reference. I'll look again if it fails there.
Checks
release_scan --git: 0 hits.Independent review
A fresh reviewer agent reviewed the branch with read-only access and no access to my conclusions.
What it checked:
Its findings, each reproduced before acting:
tsshowed in the problem reason. This is older than this change and is fixed separately in TD-5445: Code feed: a problem reason never echoes a value #304.The funnel's on-loop scrub of a near-cap
get_code_feedreply was measured separately at 255–339 ms (stalls up to 786 ms for a heavier reply). That gets its own ticket and is not changed here.🤖 Generated with Claude Code
https://claude.ai/code/session_01SPdoY5jgXgTw6gUHBMBngR