Skip to content

feat(manage-refs): add check_xref.py --vN-docx-md5 + --vN-md flags for v_(N+1) docx body-XML grep#29

Merged
Yoojin-nam merged 1 commit into
mainfrom
feat/tier1-PR4-manage-refs-vN-docx-flag
May 23, 2026
Merged

feat(manage-refs): add check_xref.py --vN-docx-md5 + --vN-md flags for v_(N+1) docx body-XML grep#29
Yoojin-nam merged 1 commit into
mainfrom
feat/tier1-PR4-manage-refs-vN-docx-flag

Conversation

@Yoojin-nam
Copy link
Copy Markdown
Contributor

@Yoojin-nam Yoojin-nam commented May 23, 2026

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 grep

Summary

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 the
    markdown-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-4
catches at build time via the /manage-refs xref QC chain — failing
earlier 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.py would
skip 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-md argparse flags
    • JSON output gains vN_docx_check block (version bumped to 1.2)
    • Either MD5 identity or any missing diff line forces non-zero exit
      even without --strict
  • skills/manage-refs/SKILL.md:
    • Decision table row for build-time regeneration check
    • New Workflow D' section with command + behavior summary
  • skills/manage-refs/tests/test_vN_docx_check.sh:
    • synthetic docx builder via stdlib zipfile (no pandoc / Word
      dependency)
    • 4 cases (regenerated, identical, stale-different, missing-arg)

Test plan

  • bash skills/manage-refs/tests/test_vN_docx_check.sh — 4/4 PASS
  • bash scripts/validate_skills.sh
  • Integration check against scripts/verify_package_integrity.py
    (PR T1-3) so the two gates do not conflict.

Related

  • PR T1-3 (scripts/verify_package_integrity.py --assert-vN-docx-changed)
  • /sync-submission Phase 7

🤖 Generated with Claude Code


Pairs with: T1-3 (#28) for defense-in-depth v_(N+1) docx regeneration (build-time + submission-time).

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>
@Yoojin-nam Yoojin-nam merged commit bd300e2 into main May 23, 2026
1 check passed
@Yoojin-nam Yoojin-nam deleted the feat/tier1-PR4-manage-refs-vN-docx-flag branch May 23, 2026 06:48
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.

1 participant