Repository navigation
fix(likes): prune spent records from flags.json - #249
Merged
jamesconwaydev merged 1 commit intoNov 6, 2026
Merged
Conversation
jamesconwaydev
approved these changes
Nov 6, 2026
jamesconwaydev
left a comment
Collaborator
There was a problem hiding this comment.
Clean. Pruning only on exactly the test _due already uses means nothing about when issues open can change, and only touching records this run saw is the right answer to the 409 case. Good that the existing test caught the first version. I'll merge once CI is green.
Collaborator
flags.json only ever grew: each hourly write laid this run's records over the stored copy and never removed anything. The write now also drops records nothing reads again: those for entries no longer in entries.json, and reviewed ones whose cooldown has run out (1 day for a burst, 7 for a drip), which _due already treats the same as no record. Only records this run has seen are pruned. On a 409 re-read, a record another writer added since (rot moving a renamed entry's key, say) is left alone, since this run's list may not know that name yet. The trust cache half of the issue already landed in 7df8824, which drops entries past their TTL on every write.
foothillsdigital
force-pushed
the
fix/prune-flags-trust
branch
from
November 6, 2026 18:36
0f12944 to
c630c4c
Compare
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.
What and why
Closes #44.
flags.json. The hourly write lays this run's new and changed records over the stored copy, so nothing was ever removed.
_merge_flagsnow also drops records nothing reads again:entries.jsonat all. Hidden, archived and other entries still on the list keep theirs.reviewed_atis set and older thanCOOLDOWN[kind](1 day for a burst, 7 for a drip)._duealready treats that the same as no record, so the next burst or drip opens an issue exactly as before.Unreviewed records are never pruned while their entry is listed. Only records this run has seen get pruned. On a 409 re-read, a record another writer added since is left for the next run. My first version pruned those too, and
test_flags_409_then_success_keeps_both_recordscaught it: rot moving a renamed entry's flags to the new key could have been undone by a sync that read the old list. A rename in flight already stops sync before any write (_rename_in_flight), so the old key isn't pruned mid-rename either.Trust cache. This half already landed in 7df8824, after the issue was filed: each run writes back only entries still inside their refresh age (
cache.get(k, now) is not None). Nothing to change there.Dry run. I read the live
flags.jsonfromstatsand ran the new merge against the currententries.json. It's empty right now, so this prunes nothing today.New test: a mix of records with a burst inside and past its cooldown, a drip inside and past its cooldown, and a pending record for a removed entry. Exactly the spent ones are dropped, a hidden entry keeps its live record, and the next run writes nothing. It fails on
main.Checks
python3 -m unittest discover -s scripts -t .passes (598)npm --prefix site testpasses (if you touchedsite/)npx prettier --check .passesdata/entries.jsonby hand (submissions go through the form)