Repository navigation
Declare the ideation cross-reference projection's Status once, in one shared place - #985
Conversation
…agree with it The ideation cross-reference `.md` must carry `Status: projection` (docs/document-lifecycle.md; declare-generated-projection-status, 2026-08-28). Two paths produce that file and each declared the value independently: the standalone renderer typed the literal, while doc_health's persist() does not render at all — it delegates to whichever copy of that renderer OPENXFACTORY_ROOT or the ancestor walk resolves, so a consuming repository pinned before fc78882 still emitted `Status: record`. The value now lives once, in scripts/projection_header.py beside output_boundary.py: the renderer appends STATUS_LINE, and the delegating path stamps STATUS_LINE onto whatever the resolved renderer returned. Neither can emit another value, whichever snapshot is reachable. refs #793 Lane: openxfactory-2 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Reviewer's GuideThe PR introduces a package-independent shared projection-header module and uses it to canonicalize the cross-reference status in both the direct renderer and delegated doc-health write path, preventing stale pinned renderers from emitting File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
🟡 Changes recommended
Address the header-scan body-corruption risk and add regression coverage for the normalization helper.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Centralizes the ideation cross-reference projection status and normalizes output across rendering paths.
Changes:
- Adds shared projection status constants and normalization.
- Updates standalone and delegated renderers to use the canonical status.
- Preserves already-correct output byte-for-byte.
File summaries
| File | Summary |
|---|---|
scripts/render-ideation-cross-reference.py |
Uses the shared projection status. |
scripts/projection_header.py |
Defines and applies status normalization. Moderate: limit header scanning to avoid rewriting body lines. Nit (3 votes): add regression coverage for normalization cases. |
scripts/doc_health/ideation_readiness.py |
Stamps delegated renderer output with the canonical status. |
Review details
Suppressed comments (1)
scripts/projection_header.py:53
_HEADER_SCAN_LINESextends past the five-line header, so if a resolved renderer omitsStatus:and its body contains a legitimateStatus: ...line within the first 12 lines, the loop rewrites that body line instead of using the insertion path. That breaks the documented guarantee that the body is untouched; limit the scan to the actual header block or stop at the first body section.
_HEADER_SCAN_LINES = 12
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Both paths render the real index in ONE process and must come out byte-identical, so drift goes red here rather than months later in a repository whose pin happens to be stale. A deliberately stale renderer — PR #785's condition, reconstructed — is held to the declared status through _render_markdown and through persist() on disk, and proven to change nothing else about the projection. refs #793 Lane: openxfactory-2 Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Resolve the renderer import risk and fix the failing overly broad test assertion.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
scripts/render-ideation-cross-reference.py:34
- Because this module is also loaded by path from
OPENXFACTORY_ROOTinideation_readiness._render_markdown, a barefrom projection_header import STATUS_LINEcan resolve an unrelated/staleprojection_headeralready on the caller'ssys.path; the sibling fallback is only used when the import raises. In that mixed-checkout case the standalone renderer can still emit the wrong status, defeating the single-source guarantee. Loadprojection_header.pyfromPath(__file__).resolve().parentunconditionally (or verify the imported module's__file__) before readingSTATUS_LINE.
try:
from projection_header import STATUS_LINE
except ImportError: # pragma: no cover - this file loaded BY PATH (doc_health's
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
…urce text A substring scan for `Status:` over a whole file is answered by prose, and by prose that is true and should stay: a renderer explaining which status it emits will name it. The forbidden thing is a second EXECUTABLE copy of the value, so the check now reads string constants out of the tree with docstrings excluded — the same parsed-not-grepped instrument test_import_direction.py uses, and for the same reason. The declaration itself is held to composing its line from PROJECTION_STATUS. refs #793 Lane: openxfactory-2 Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical import-resolution and moderate header-window findings remain.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
scripts/projection_header.py:53
- The normalizer introduces a second header-window constant (
12), but the repository's canonical status readers usedoc_health.corpus.STATUS_SCAN_LINES = 15(scripts/doc_health/corpus.py:111-221). If a resolved renderer places a validStatus:header on real line 13–15, this loop treats it as missing, inserts a secondStatus: projection, and leaves the old value in the output. Please use a header/body boundary or otherwise align this neutral helper with the established 15-line contract so the stale-status correction cannot fail for a valid header layout.
#: How far into the document a `Status:` line is still a HEADER line. The
#: projection's header block is five lines; anything further down belongs to the
#: rendered body (cluster sections, member tables) and is not ours to rewrite.
_HEADER_SCAN_LINES = 12
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
doc_health is vendored, so the bare import of the declaration is the ordinary route but not a guaranteed one. _projection_stamp() falls back to reading the sibling file beside THIS module's own tree — never the renderer's, which is resolved from OPENXFACTORY_ROOT and may be any vintage, that being the defect itself. The suite's conftest puts this checkout's scripts/ on the path, which is what would mask the case, so the new test closes that route with a None entry in sys.modules and holds the stamp over a deliberately stale renderer regardless. refs #793 Lane: openxfactory-2 Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Address the vendored-helper fallback and header normalization issues, including early body status and CRLF preservation.
Review details
Suppressed comments (3)
scripts/doc_health/ideation_readiness.py:1326
- This fallback still assumes that the newly added
projection_header.pyis copied beside every vendoredideation_readiness.py. A consumer can have the updated vendored module without that sibling; thenexec_module()raisesFileNotFoundErrorbefore_render_markdowncan preserve its documented fail-openNoneresult, turning an unreachable renderer into a lane crash. Make the helper an explicit part of the vendored surface, or handle its absence without breaking the existing skip behavior.
path = Path(__file__).resolve().parents[1] / "projection_header.py"
scripts/projection_header.py:75
- The first
Status:line in the first 12 lines is not necessarily a header line. If a resolved renderer omits the header but emits an early body line such asStatus: record, this code rewrites body content and never inserts a header; an already-canonical body line is treated as sufficient too. That contradicts the helper's documented body-preservation guarantee, so replacement should be anchored to the projection's actual header position/boundary and covered with an early-body-status case.
for i, line in enumerate(lines[:_HEADER_SCAN_LINES]):
if line.startswith(_STATUS_PREFIX):
if line == STATUS_LINE:
return markdown
lines[i] = STATUS_LINE
return "\n".join(lines)
scripts/projection_header.py:75
split("\n")leaves the\ron CRLF lines, so an already-canonicalStatus: projection\r\nis not equal toSTATUS_LINE; this branch rewrites it and drops the\r, violating the documented byte-identical pass-through. Make the scan line-ending-aware by preserving each line terminator, and add a CRLF regression case.
lines = markdown.split("\n")
for i, line in enumerate(lines[:_HEADER_SCAN_LINES]):
if line.startswith(_STATUS_PREFIX):
if line == STATUS_LINE:
return markdown
lines[i] = STATUS_LINE
return "\n".join(lines)
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
There was a problem hiding this comment.
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 2 days and 17 hours by commenting @sourcery-ai review. Upgrade to get a review now.
|
Lane: openxfactory-2 (openXfactory-2) |



Lane: openxfactory-2 (openXfactory-2)
What
ideation/cross-reference.mdmust carryStatus: projection— it is rewritten in place from the YAML on every run, so it has no captured state to be immutable against (docs/document-lifecycle.md;declare-generated-projection-status, 2026-08-28, commitfc788825, which changed that very line fromStatus: record).Two code paths produce that file's content and each declared the value independently:
scripts/render-ideation-cross-reference.py::render_markdowntyped the literal"Status: projection";scripts/doc_health/ideation_readiness.py::_render_markdown— the write path every nightly/packet run actually takes, reused bydoc_health/derive_possibles.py::persist— does not render at all. It delegates to whichever copy of the standalone renderer theOPENXFACTORY_ROOTenv var (CI's.openxfactory-pin/) or the ancestor walk happens to resolve. A consuming repository pinned beforefc788825therefore still emittedStatus: record.That is the disagreement openxFactory #785 hit; it worked around it by re-rendering the landed
.mdwith the standalone renderer by hand.How
One source of truth,
scripts/projection_header.py— placed besidescripts/output_boundary.py, in neither package, for the same reason that one is (doc_healthmust not import fromideation_dashboard;persist()already reaches this directory for its boundary, so nothing new travels with the vendored module):PROJECTION_STATUS = "projection"/STATUS_LINE = f"Status: {PROJECTION_STATUS}"— declared once;apply_status_line(markdown)— stamps that line onto a projection whose vintage the caller cannot vouch for.Both paths now emit the header from it: the renderer appends
STATUS_LINE, and the delegating path stampsSTATUS_LINEonto whatever the resolved renderer returned. Neither can emit another value, whichever snapshot is reachable. Already-correct output is returned byte-identical.How verified
tests/doc-health/test_cross_reference_projection_status.py(new): the realideation/cross-reference.yamlrendered through both paths in one process is byte-identical; the header line is pinned toStatus: projection; a simulated pre-fc788825pin emittingStatus: recordis corrected by_render_markdownand bypersist()on disk, with the rest of the body untouched; correct output is passed through unchanged.python3 -m pytest -q tests/doc-health -k 'cross_reference or ideation or derive_possibles or readiness'python3 scripts/doc-health.py --single-repo . --family ideation-routing— no new findings.OPENSPEC_TELEMETRY=0 openspec validate --all --strict— failure set equal toorigin/main's.ideation/cross-reference.mdis not regenerated here: a fresh render of the committed YAML through the changed renderer is byte-identical to the committed file, so the projection needs no update.refs #793
🤖 Generated with Claude Code
Summary by Sourcery
Centralize and enforce the ideation cross-reference projection status across all rendering and persistence paths.
Bug Fixes:
Status: projectionheader, including when a stale pinned renderer is used.Enhancements:
Tests: