Repository navigation
scan: fetch the unscanned backlog, not the newest ten posts again - #22
Merged
jackparnell merged 1 commit intoAug 18, 2026
Merged
Conversation
Reported 2026-08-17: `make run` appeared to do nothing. It fetched the ten newest posts, recognised all ten from local memory, skipped them, and exited reporting success — because the Sentinel keeps up with the front page, so the newest ten are exactly the ten it has already moderated. `--limit 10` meant "ten posts, probably none of which need moderating". The filtering was happening in the wrong place. Asking the server for unscanned posts and filtering locally by remembered ids look equivalent and are not: one returns work, the other returns the front page and then throws it away. Production had 12,830 unscanned posts at the time. So scan mode now sends `?sentinel_scanned=false` by default, via the colony-sdk parameter added in 1.34.0 (hence the requirements floor — an older SDK raises TypeError on the keyword rather than silently ignoring it, which is the right way round). `--force` continues to mean "revisit finished work" and so sends no filter; new `--include-scanned` asks for the same without also discarding local memory. The policy is a named function rather than an inline conditional because it is a decision worth testing directly: `scanned_filter_for(args)` returns False / None, and `None` must never be sent as a filter value. Verified by mutation — reverting it to the old always-None behaviour kills 4 tests, and leaving the helper correct while the fetch ignores it kills 1. The suite passes against a spec-free fake, so it was also checked end to end against the real installed SDK: sentinel -> ColonyClient -> the URL on the wire is `/posts?sort=new&limit=20&sentinel_scanned=false`, and the `--force` path sends no filter at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pxqw6ZyFv5f4rt5HFwtafs
jackparnell
approved these changes
Aug 18, 2026
This was referenced Aug 18, 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.
Reported 2026-08-17:
make runappeared to do nothing.It fetched the ten newest posts, recognised all ten from local memory, skipped them, and exited reporting success — because the Sentinel keeps up with the front page, so the newest ten are exactly the ten it has already moderated.
--limit 10meant "ten posts, probably none of which need moderating".The filtering was in the wrong place. Asking the server for unscanned posts and filtering locally by remembered ids look equivalent and are not: one returns work, the other returns the front page and then throws it away.
Measured against production just now:
12,877 + 2,761 = 15,638. The filter partitions the corpus exactly, and the backlog is 12,877 posts deep.
What changed
Scan mode now sends
?sentinel_scanned=falseby default.--forcecontinues to mean "revisit finished work" and sends no filter; new--include-scannedasks for the same without also discarding local memory.The policy is a named function rather than an inline conditional because it is a decision worth testing directly:
scanned_filter_for(args)returnsFalse/None, andNonemust never be sent as a filter value.Why this was blocked until today
It needs
sentinel_scanned=oniter_posts(), which shipped in colony-sdk 1.34.0 — published to PyPI today. Hence the>=1.34.0,<2floor in requirements: an older SDK raisesTypeErroron the keyword rather than silently ignoring it, which is the right way round. A silently-ignored keyword would have reproduced the original bug with no signal, which is the same failure shape as the API dropping an undeclared query param.Verification
Installed from a clean venv against the published 1.34.0 (not a local build) and captured what actually goes on the wire:
201 tests pass, ruff clean. Mutation-verified: reverting
scanned_filter_forto the old always-Nonebehaviour kills 4 tests; leaving the helper correct while the fetch ignores it kills 1.Caveat worth knowing when you run it
Marking while iterating shifts the result set.
iter_postspaginates by offset, so a post you mark leaves thesentinel_scanned=Falseset and everything behind it slides forward — the next page skips as many posts as you marked. Collect the run before marking, or re-request from offset 0 each pass. A single page (--limit<= page size) is unaffected, which is the usual moderation-pass shape.🤖 Generated with Claude Code
https://claude.ai/code/session_01Pxqw6ZyFv5f4rt5HFwtafs