feat(manage-refs): add check_xref.py --vN-docx-md5 + --vN-md flags for v_(N+1) docx body-XML grep#29
Merged
Conversation
Adds build-time defense-in-depth flags to check_xref.py: - --vN-docx-md5: assert v_(N+1) docx MD5 != v_N docx MD5 - --vN-md: extract markdown-only diff vs v_N and grep each >= 40-char diff line in the new docx body XML Motivation: companion to PR T1-3 (submission-time gate). Both catch the silent "cp v_N over v_(N+1)" failure mode where markdown body edits would revert at peer review. T1-4 catches at the manage-refs QC stage; T1-3 catches at sync-submission freeze stage. JSON output gains vN_docx_check block (xref_audit version 1.2). Synthetic-docx fixture tests via stdlib zipfile — 4/4 pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
PR T1-4: manage-refs check_xref.py --vN-docx-md5 flag
Title:
feat(manage-refs): add check_xref.py --vN-docx-md5 + --vN-md flags for v_(N+1) docx body-XML grepSummary
Adds build-time defense-in-depth flags to
skills/manage-refs/scripts/check_xref.py:--vN-docx-md5 <path>: assert v_(N+1) docx MD5 ≠ v_N docx MD5.--vN-md <path>: in addition to the MD5 check, extract themarkdown-only diff between v_N and v_(N+1) and verify each ≥40-char
diff line appears verbatim (whitespace-normalized, case-insensitive)
in the new docx body XML.
Motivation
Same precedent as PR T1-3 (silent v_N → v_(N+1) docx copy leaving
markdown body changes un-rendered). T1-3 catches at submission time via
scripts/verify_package_integrity.py --assert-vN-docx-changed; T1-4catches at build time via the
/manage-refsxref QC chain — failingearlier in the pipeline so the bad artifact never reaches
/sync-submission.Defense in depth is warranted because both gates can mis-fire under
unusual user workflows: a build that bypasses
check_xref.pywouldskip T1-4 but still hit T1-3 at the freeze stage, and vice versa.
Changes
skills/manage-refs/scripts/check_xref.py:_md5_of(),_docx_body_text(),_markdown_diff_lines(),run_vN_docx_check()helpers--vN-docx-md5/--vN-mdargparse flagsvN_docx_checkblock (version bumped to 1.2)even without
--strictskills/manage-refs/SKILL.md:skills/manage-refs/tests/test_vN_docx_check.sh:zipfile(no pandoc / Worddependency)
Test plan
bash skills/manage-refs/tests/test_vN_docx_check.sh— 4/4 PASSbash scripts/validate_skills.shscripts/verify_package_integrity.py(PR T1-3) so the two gates do not conflict.
Related
scripts/verify_package_integrity.py --assert-vN-docx-changed)/sync-submissionPhase 7🤖 Generated with Claude Code
Pairs with: T1-3 (#28) for defense-in-depth v_(N+1) docx regeneration (build-time + submission-time).