Repository navigation
fix(knowledge): name test/conftest.py as home of the close-seam pins - #14329
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 07df02b |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (7 items) — 7 justifiedIntent: FIX — the close-seam error, comments, specs and docstrings send developers to a conftest that sets none of the pins; point them at
[FIRST-PRINCIPLES-REVIEWED] 07df02b |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
438e173 to
af24f23
Compare
|
|
Description gains the |
af24f23 to
fb3ebc3
Compare
The three test pins behind KnowledgeStore._close_all_for_tests -- the _ALLOW_CROSS_THREAD_CLOSE_FOR_TESTS flip, the opened register-and-close fixture and the autouse _no_boot_sandbox_sweep -- live in test/conftest.py, which only the test/ testpath loads. Five sites (the module-flag comment and the seam's RuntimeError in store.py, the knowledge spec, and two bullets of testing-conventions.md) sent a developer to the rootdir conftest instead, which holds no such flip, and claimed the pins hold "for every test" when setup.cfg also collects src/kiro_crew/apps/builtins, whose test trees do not load test/conftest.py. The sites now name test/conftest.py and say the app test trees get none of the pins; nothing moves and no behaviour changes. The five sibling sites under test/ that attributed the same pins to the rootdir conftest -- the module fixture docstrings in test_context.py, test_context_marker_neutralization.py, test_context_ui_language.py and test_decisions_integration.py (close_skills_loaders) and the class docstring plus assertion message in test_session_cleanup.py (_no_boot_sandbox_sweep) -- name test/conftest.py too, so no pointer to a fixture home that does not hold the fixture remains. Four more test/ docstrings (test_knowledge_add_source.py, test_knowledge_sync_outcome_serialization.py, test_perf_boot_path.py, test_decisions_memory_recall_reachable.py) and one testing-conventions.md line credited the opened fixture to the rootdir conftest; they name test/conftest.py as well. The corrected wording says the app test trees do not activate the flip themselves: a test/ case run earlier in the same xdist worker leaves the session-scoped flag on, so "get no flip" overstated it. Fixes #14026
fb3ebc3 to
07df02b
Compare
Base branch was modified
Problem / Motivation
Goal: The close-seam
RuntimeError, the flag's comment, the two specs and thetest/docstrings nametest/conftest.pyas the home of the_ALLOW_CROSS_THREAD_CLOSE_FOR_TESTSflip and the fixture pins, instead of "the rootdir test conftest", which sets none of them.KnowledgeStore._close_all_for_tests()refuses to run unless the module flag_ALLOW_CROSS_THREAD_CLOSE_FOR_TESTSis on, and itsRuntimeErrortells the developer that "the rootdir test conftest" sets it. It does not. The flip lives intest/conftest.py, beside theopenedregister-and-close fixture and the autouse_no_boot_sandbox_sweep, andsetup.cfgcollects two testpaths:testandsrc/kiro_crew/apps/builtins. Only the first loadstest/conftest.py. The same wrong pointer sits in the flag's own comment insrc/kiro_crew/knowledge/store.py, indocs/system-specs/modules/knowledge.md, and in two bullets ofdocs/system-specs/common/testing-conventions.md, one of which says the sweep pin holds "for every test". Five docstrings and one assertion message undertest/attributeclose_skills_loadersand_no_boot_sandbox_sweepto the same rootdir conftest, which defines neither.Why it matters
A developer whose store teardown raises inside an app test tree under
src/kiro_crew/apps/builtinsis sent to the repo-rootconftest.py, which holds no such flip, and the flip they are told to find does not exist for their testpath at all. The docs repeat the claim, so reading them does not correct it. The corpus test's spike is per xdist worker in a widely sharded suite and undoes part of the retention win the module measures.Not a goal
conftest.py, the issue's other option: that would change what runs for every app test module and needs its own justification; no fixture, flag, testpath or public function moves, and no behaviour changes outside the message text.src/kiro_crew/apps/builtinsa flip of their own: the corrected wording states that they do not loadtest/conftest.pyand get none, and correcting the words keeps today's coverage exactly.conftest.pydocstring'stransfertestpath mention, the issue's closing aside: it names a testpath, not a fixture home, and is outside this fix.What changed (motivation → approach → change)
src/kiro_crew/knowledge/store.py(flag comment and the seam'sRuntimeError)test/conftest.pyflips the flag, for thetest/testpath only; the app test trees undersrc/kiro_crew/apps/builtinsdo not load that conftest and do not activate the flip themselvesdocs/system-specs/modules/knowledge.md_close_all_for_tests()bulletdocs/system-specs/common/testing-conventions.md_no_boot_sandbox_sweeppin istest/conftest.py's and covers every test undertest/, with the app-tree gap stated; the close-seam bullet namestest/conftest.pyfor the flip and for theopenedfixture; the retention paragraph'sopenedattribution namestest/conftest.pytest/test_context.py,test/test_context_marker_neutralization.py,test/test_context_ui_language.py,test/test_decisions_integration.py,test/test_session_cleanup.pyclose_skills_loaders) and the class docstring plus assertion message (_no_boot_sandbox_sweep) nametest/conftest.pyinstead of the rootdir conftesttest/test_knowledge_add_source.py,test/test_knowledge_sync_outcome_serialization.py,test/test_perf_boot_path.py,test/test_decisions_memory_recall_reachable.pyopenedfixture to the rootdir conftest nametest/conftest.pyThe issue offered two ways to close the pointer: move the three fixtures to the repo-root
conftest.py, or correct the wording. This takes the correcting option. Moving the fixtures would change what runs for every app test module and needs its own justification; correcting the words keeps today's coverage exactly and stops the raise path from pointing at a file that cannot help. No fixture moves, no behaviour changes outside the message text.Backwards compatibility
Compatible: one error string, comments, docstrings and one assertion message change wording; two docs change wording. No fixture, flag, testpath or public function moves.
Tests
test/test_knowledge.py::TestKnowledgeStore::test_production_keeps_the_thread_guard_and_the_seam_refuses_without_the_flag(extended): the existing refusal check reads the message and pins that it namestest/conftest.py, does not sayrootdir, and namessrc/kiro_crew/apps/builtinsas the trees that do not activate the flip themselves. Red againstmain'sstore.py(the message says "the rootdir test conftest does"), green on this head.The touched test files run green with
-n0: the round-0 six plus the corpus test (pytest test/test_context.py test/test_context_marker_neutralization.py test/test_context_ui_language.py test/test_decisions_integration.py test/test_session_cleanup.py test/test_knowledge.py test/test_source_corpus.py -n0-> 549 passed, on base7061a82246) and the round-2 files on this base (pytest test/test_knowledge.py test/test_knowledge_add_source.py test/test_knowledge_sync_outcome_serialization.py test/test_decisions_memory_recall_reachable.py test/test_perf_boot_path.py test/test_source_corpus.py -n0-> 391 passed); the sibling files change only docstring and message text.Manual verification
N/A — unit coverage sufficient: the change is message text, comments and docs, each pinned by the test above.
Screenshots / video
Why no screenshot: no frontend path is touched; the diff is backend text, docs and tests.
Related Issues
Fixes #14026
Pattern harvest
Rule candidate: lint
Pattern: a comment, docstring or error message that names a conftest by location ("rootdir conftest", "test conftest") for a fixture or flag that a grep shows lives in the other one; the two testpaths do not share fixtures, so the pointer is checkable mechanically.
The repo-root
conftest.pydocstring'stransfertestpath mention (the issue's closing aside) is not touched here: it names a testpath, not a fixture home, and is outside this fix.Local review round
Local pre-push round, one lane at a time on the CI-pinned models, read-only:
gpt-5.6-sol): no findings on the six-edit head; a focused verifier pass on this head confirmed the later amendments (the narrowed app-tree wording, the folded test, the five sibling sites) closed with no new findings -- see the final line of this section.claude-opus-5): validation pass, no findings. Its discovery pass surfaced one true wording slip in prose this change added ("inherit the rootdirconftest.pyalone" is false for the three app trees that ship their owntests/conftest.py); every site now says those trees do not loadtest/conftest.py. Its other candidates do not hold:all(...)overzip(strict=True)is red in every case the old==was red (a differing pair returnsFalse; an equal prefix with a length mismatch raisesValueError); the path-only subset check loses nothing because the filtered and unfiltered streams share oneyield; no other test pins the old error substring.claude-fable-5): PASS on this head. Two earlier reads asked for two subtractions, both taken: the separate wording test was deleted and its pins folded into the existing refusal test, and the five siblingtest/attributions were corrected instead of being listed as left as is. Inventory tags on the PASS: the test pin is declared in Tests above; the corpus test change is the issue's own second item.Verifier pass (GPT model) on the pushed content: the delta from the head GPT and Opus read is exactly the three amendments above; all three closed; no new findings.
Rebased onto main
7061a82246after #14421 merged; the corpus-ratchet rider is now main's own change and left this PR.Round 2: the five sibling attributions name test/conftest.py; the no-flip message says app tests do not activate the flip themselves (FP/GPT).
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)