From 627512e1fb06a7dd891d8693709d3cb8ddde4d6d Mon Sep 17 00:00:00 2001 From: Edbert Chan Date: Wed, 16 Sep 2026 14:15:22 -0700 Subject: [PATCH] Keep approved fix-later items in every status update A recap that lists only finished work makes the deferred half disappear. Add the learned rule and a test that pins it. Co-Authored-By: Claude Opus 5 (1M context) Change-Id: Ifec2cad4fd573aee970dd3c6b7839cd19192302a --- corpus/CLAUDE.learned.md | 1 + tests/test_deferred_items_rule.py | 40 +++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/test_deferred_items_rule.py diff --git a/corpus/CLAUDE.learned.md b/corpus/CLAUDE.learned.md index 5258abcb..a0915658 100644 --- a/corpus/CLAUDE.learned.md +++ b/corpus/CLAUDE.learned.md @@ -44,3 +44,4 @@ Engine-only install drops this file; reflect Accepted global rules land here. - The shell behind the Bash tool may be zsh, which does not split an unquoted variable into words: `for x in $LIST` runs once with the whole list as one item, exits 0, and reads as "all done". Run any loop over a list under bash (`bash <<'EOF' ... EOF`), count lookups that failed as unchecked rather than done, and spot-check one item before acting on the loop's summary. This is zsh's `SH_WORD_SPLIT` option being off by default (zsh manual, Options, https://zsh.sourceforge.io/Doc/Release/Options.html#index-SH_005fWORD_005fSPLIT). - Before asking me whether to run a script, read its whole body, not its header comment, usage text, or `--dry-run` output, and name in the question every process it kills, file it deletes, and service it restarts. A header states what the author meant; the body is what runs, so a consent question built from the header asks me to approve something other than what will happen. No known prior art. - When finishing a merge or rebase, reconcile three things before calling it resolved: what each side declared (its commit messages and PR description: the intent, and the tests it names), what each side's code actually does, and what the resolved result does. All three must agree: every declared intent is still visible in `git diff -- `, and every test either side named still passes on the result. A merge with no textual conflict can still break one side's declared behavior, so a clean merge is checked the same way. Never take one side's whole file (`git checkout --theirs` / `--ours `, or copying the file from one branch) unless the other side's changes to that file are provably empty; taking a whole side silently reverts what the other branch added, including hunks that never conflicted (git-checkout(1), `--ours`/`--theirs`: https://git-scm.com/docs/git-checkout#Documentation/git-checkout.txt---ours). When a declaration and its code disagree, or the two sides' intents contradict, stop and flag it to me instead of choosing: run `why` on the conflicting lines (`git log -L` or `git log -S` plus each commit's PR body) and apply `principle-prove-it`, so the flag names the two commits or PRs, quotes the declared intent next to the code, and pastes the failing test output. Brun, Holmes, Ernst and Notkin, "Proactive Detection of Collaboration Conflicts" (ESEC/FSE 2011, https://doi.org/10.1145/2025113.2025139), across Git, Perl5 and Voldemort, found "that 33% of merges that were reported to contain no textual conflicts by the VCS in fact contained higher-order conflicts" (build or test failures), so a clean textual merge is not evidence the two intentions still hold. +- An item I approved as "fix it properly later" stays in every status update and every final summary, marked open, until it is done or I drop it. A recap that lists only what finished makes the deferred half disappear, and the next session never learns it was owed. No known prior art. diff --git a/tests/test_deferred_items_rule.py b/tests/test_deferred_items_rule.py new file mode 100644 index 00000000..5f577cc1 --- /dev/null +++ b/tests/test_deferred_items_rule.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +"""Pin the learned rule: an approved "fix later" item stays in every update. + +A detector cannot judge this reliably, so the test proves the rule is present +with its trigger, required action, and reason; deleting or hollowing it fails here. +""" +import os +import unittest + +REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +LEARNED = os.path.join(REPO_ROOT, "corpus", "CLAUDE.learned.md") + + +def working_style_section(): + with open(LEARNED, encoding="utf-8") as handle: + text = handle.read() + start = text.index("# Working style") + end = text.find("\n# ", start + 1) + return text[start:] if end == -1 else text[start:end] + + +def bullet_starting(prefix): + for line in working_style_section().splitlines(): + if line.startswith(prefix): + return line + raise AssertionError(f"no working-style rule starts with {prefix!r}") + + +class TestDeferredItemsStayVisible(unittest.TestCase): + PREFIX = '- An item I approved as "fix it properly later"' + + def test_rule_keeps_the_item_in_every_update_until_done(self): + rule = bullet_starting(self.PREFIX) + self.assertIn("every status update and every final summary", rule) + self.assertIn("marked open", rule) + self.assertIn("until it is done or I drop it", rule) + + +if __name__ == "__main__": + unittest.main()