Skip to content

fix(knowledge): name test/conftest.py as home of the close-seam pins - #14329

Merged
iamwhatever merged 1 commit into
mainfrom
fix/knowledge-close-seam-names-test-conftest
Sep 27, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/knowledge-close-seam-names-test-conftest

Conversation

@pepmach

@pepmach pepmach commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The close-seam RuntimeError, the flag's comment, the two specs and the test/ docstrings name test/conftest.py as the home of the _ALLOW_CROSS_THREAD_CLOSE_FOR_TESTS flip 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_TESTS is on, and its RuntimeError tells the developer that "the rootdir test conftest" sets it. It does not. The flip lives in test/conftest.py, beside the opened register-and-close fixture and the autouse _no_boot_sandbox_sweep, and setup.cfg collects two testpaths: test and src/kiro_crew/apps/builtins. Only the first loads test/conftest.py. The same wrong pointer sits in the flag's own comment in src/kiro_crew/knowledge/store.py, in docs/system-specs/modules/knowledge.md, and in two bullets of docs/system-specs/common/testing-conventions.md, one of which says the sweep pin holds "for every test". Five docstrings and one assertion message under test/ attribute close_skills_loaders and _no_boot_sandbox_sweep to 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/builtins is sent to the repo-root conftest.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

  • Moving the three fixtures to the repo-root 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.
  • Giving the app test trees under src/kiro_crew/apps/builtins a flip of their own: the corrected wording states that they do not load test/conftest.py and get none, and correcting the words keeps today's coverage exactly.
  • The repo-root conftest.py docstring's transfer testpath mention, the issue's closing aside: it names a testpath, not a fixture home, and is outside this fix.

What changed (motivation → approach → change)

Where Now says
src/kiro_crew/knowledge/store.py (flag comment and the seam's RuntimeError) test/conftest.py flips the flag, for the test/ testpath only; the app test trees under src/kiro_crew/apps/builtins do not load that conftest and do not activate the flip themselves
docs/system-specs/modules/knowledge.md same, in the _close_all_for_tests() bullet
docs/system-specs/common/testing-conventions.md the _no_boot_sandbox_sweep pin is test/conftest.py's and covers every test under test/, with the app-tree gap stated; the close-seam bullet names test/conftest.py for the flip and for the opened fixture; the retention paragraph's opened attribution names test/conftest.py
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 the module fixture docstrings (close_skills_loaders) and the class docstring plus assertion message (_no_boot_sandbox_sweep) name test/conftest.py instead of the rootdir conftest
test/test_knowledge_add_source.py, test/test_knowledge_sync_outcome_serialization.py, test/test_perf_boot_path.py, test/test_decisions_memory_recall_reachable.py the docstrings that credited the opened fixture to the rootdir conftest name test/conftest.py

The 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 names test/conftest.py, does not say rootdir, and names src/kiro_crew/apps/builtins as the trees that do not activate the flip themselves. Red against main's store.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 base 7061a82246) 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.py docstring's transfer testpath 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 (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.
  • Opus (claude-opus-5): validation pass, no findings. Its discovery pass surfaced one true wording slip in prose this change added ("inherit the rootdir conftest.py alone" is false for the three app trees that ship their own tests/conftest.py); every site now says those trees do not load test/conftest.py. Its other candidates do not hold: all(...) over zip(strict=True) is red in every case the old == was red (a differing pair returns False; an equal prefix with a length mismatch raises ValueError); the path-only subset check loses nothing because the filtered and unfiltered streams share one yield; no other test pins the old error substring.
  • First Principles (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 sibling test/ 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 7061a82246 after #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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@pepmach
pepmach requested review from a team and buluoray September 27, 2026 01:02
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 27, 2026
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 07df02ba8efbbaef52efd99dfcb9c714b73b7243 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] 07df02b

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 07df02ba8efbbaef52efd99dfcb9c714b73b7243 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Nothing to check.

What this change ships

Inventory (7 items) — 7 justified

Intent: FIX — the close-seam error, comments, specs and docstrings send developers to a conftest that sets none of the pins; point them at test/conftest.py, where the flip and fixtures actually live (verified: test/conftest.py:1093-1109, 1113, 1141, 1173; setup.cfg:410 testpaths; issue #14026; test red on base).

  1. The seam's RuntimeError now names test/conftest.py and the app-tree gap, not "the rootdir test conftest" — justified
  2. The flag's comment in store.py says the same, noting the flag lingers within a worker — justified
  3. knowledge.md's _close_all_for_tests bullet names the real conftest — justified
  4. testing-conventions.md narrows the sweep pin from "every test" to "every test under test/", app-tree gap stated — justified
  5. testing-conventions.md's close-seam, opened and fd_leak attributions renamed to test/conftest.py — justified
  6. The existing refusal test now pins the corrected message (red on base) — justified
  7. Nine test/ docstrings and one assertion message re-attribute the three fixtures to test/conftest.py — justified (grepped rootdir near opened|close_skills_loaders|_no_boot_sandbox_sweep: 0 remain)

[FIRST-PRINCIPLES-REVIEWED] 07df02b

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 07df02ba8efbbaef52efd99dfcb9c714b73b7243 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 07df02b

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 07df02ba8efbbaef52efd99dfcb9c714b73b7243: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 27, 2026
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 07df02ba8efbbaef52efd99dfcb9c714b73b7243 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 07df02b

Verdict parsed from the review's SHA-scoped output markers for commit 07df02ba8efbbaef52efd99dfcb9c714b73b7243.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 07df02ba8efbbaef52efd99dfcb9c714b73b7243: <one-sentence reason>

@pepmach
pepmach force-pushed the fix/knowledge-close-seam-names-test-conftest branch from 438e173 to af24f23 Compare September 27, 2026 03:02
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 27, 2026
@pepmach

pepmach commented Sep 27, 2026

Copy link
Copy Markdown
Contributor Author
  • Item 6 — rides along: the streamed test/test_source_corpus.py body span=4c50ce443f63 — declared-and-kept

Declared, not a rider: the description names it ("Separately, test/test_source_corpus.py's no-filter equivalence check ..."), the Tests section carries its measurement (280.4 -> 17.8 MiB per xdist worker), and it is the second item of the issue this PR closes.
Kept here because this head's shape of that test is the remedy to the GPT block upheld on this PR's prior head (the filter ratchet compared paths only): the same test body compares each streamed candidate's text with its file (read_text(encoding="utf-8")) beside the path-subset check, so a filter that yields altered text reds. Moving the test change to another PR would move that remedy away from the block it answers and ship the close-seam pins without the reviewed ratchet beside them.
No new surface: iter_source_texts and iter_candidate_sources pre-exist in test/source_corpus.py; the change is one test body's shape and its measured memory.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Sep 27, 2026
@pepmach

pepmach commented Sep 27, 2026

Copy link
Copy Markdown
Contributor Author

Description gains the **Goal:** line and ## Not a goal section the PR template requires since #14181 -- a first write of the frozen sections from this PR's opening intent, not an edit of a frozen goal. Head unchanged.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Sep 27, 2026
@pepmach
pepmach force-pushed the fix/knowledge-close-seam-names-test-conftest branch from af24f23 to fb3ebc3 Compare September 27, 2026 11:02
@pepmach
pepmach requested a review from a team as a code owner September 27, 2026 11:02
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Sep 27, 2026
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
@pepmach
pepmach force-pushed the fix/knowledge-close-seam-names-test-conftest branch from fb3ebc3 to 07df02b Compare September 27, 2026 12:05
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Sep 27, 2026
@iamwhatever
iamwhatever enabled auto-merge (squash) September 27, 2026 17:31
auto-merge was automatically disabled September 27, 2026 17:33

Base branch was modified

@iamwhatever
iamwhatever enabled auto-merge (squash) September 27, 2026 17:34
@iamwhatever
iamwhatever merged commit 20ed6a1 into main Sep 27, 2026
97 checks passed
@iamwhatever
iamwhatever deleted the fix/knowledge-close-seam-names-test-conftest branch September 27, 2026 17:34
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: the knowledge close-seam RuntimeError names the rootdir conftest but the fixtures live in test/conftest.py

2 participants