Skip to content

fix(docx-compare): preserve machine-readable stdout - #785

Merged
stevenobiajulu merged 1 commit into
mainfrom
783-preserve-compare-stdout-20260804
Aug 4, 2026
Merged

fix(docx-compare): preserve machine-readable stdout#785
stevenobiajulu merged 1 commit into
mainfrom
783-preserve-compare-stdout-20260804

Conversation

@stevenobiajulu

Copy link
Copy Markdown
Member

Summary

  • remove the unconditional [DEBUG] atomizeTree write to stdout
  • add a regression test that holds atomizeTree silent on stdout
  • preserve the existing consumer-compatibility warnings on stderr

Root cause

atomizeTree called console.log unconditionally, so the diagnostic was interleaved with the safe-docx compare JSON result and broke machine consumers such as jq.

Impact

Stdout once again belongs exclusively to the CLI's machine-readable comparison result. This is intentionally a narrow fix and does not introduce a logging framework or alter the result schema.

Validation

  • repository build and workspace lint
  • full workspace test suite; five environment-restricted subprocess/LibreOffice tests rerun successfully with required permissions
  • spec coverage and ECMA-376 conformance checks
  • safe-docx compare ... --certificate-format llm | jq -e .
  • safe-docx compare ... --certificate-format full | jq -e .
  • focused atomizer regression: 64/64 passing

Fixes #783

Remove the unconditional atomization diagnostic because comparison callers reserve stdout for their structured result. A focused regression test holds atomizeTree silent so future diagnostics cannot corrupt CLI JSON pipelines.

Fixes: #783
@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
site Ready Ready Preview Aug 4, 2026 2:14pm

Request Review

@github-actions github-actions Bot added the fix label Aug 4, 2026
@usejunior-llm-gate

Copy link
Copy Markdown

Aggregate and post review

Overall: PASS (5 pass, 0 warn, 0 error, 12 skipped, 17 total)

Check Verdict
read_file response metadata parity SKIPPED paths not touched by this PR
Live DOM namespace-safe OOXML writes SKIPPED paths not touched by this PR
Deleted field markup keeps w:fldChar outside w:del PASS The PR only removes a debug console.log statement in atomizer.ts and adds a corresponding test in atomizer.test.ts, and does not touch field atomization, validateFieldStructure, hasFldCharInsideDel, w:fldChar, w:instrText, w:delInstrText, or collapsed field comparison logic.
Field validation per story, not global SKIPPED paths not touched by this PR
Revision IDs seeded from all revision-bearing side parts SKIPPED paths not touched by this PR
Accept/reject sweep side parts and caches PASS The PR only removes debug console logging from the atomizer and does not touch accept/reject changes, REVISION_STORY_PART_PATHS, or side-part revision markup.
DocumentViewNode.heading stays canonical SKIPPED paths not touched by this PR
AI-author parity across entry points SKIPPED paths not touched by this PR
Property-change wrapper discipline SKIPPED paths not touched by this PR
SUPPORT.md Table A drift vs. implementation SKIPPED paths not touched by this PR
Table A / Table B boundary on side-part revisions SKIPPED paths not touched by this PR
Canonical-emission surface completeness SKIPPED paths not touched by this PR
Lean predicate drift against engine semantics (asymmetric) SKIPPED paths not touched by this PR
Unit-test quality (avoid tautological / change-detector tests) PASS The test added in packages/docx-compare/src/atomizer.test.ts:597-620 makes a concrete, independent semantic assertion that the system under test does not pollute standard output, mocking only the external console boundary.
Re-derived facts vs canonical sources PASS The PR only removes a debug logging statement and adds a test to verify its omission; it does not add any logic that re-computes facts derived elsewhere.
.openspec tag ↔ test-assertion drift PASS The PR does not add, move, or change any .openspec() tags in packages/docx-compare/src/atomizer.test.ts, so the precondition is not met.
Library stays general (no downstream-domain leakage) SKIPPED paths not touched by this PR

@stevenobiajulu
stevenobiajulu merged commit 8035dce into main Aug 4, 2026
26 checks passed
@stevenobiajulu
stevenobiajulu deleted the 783-preserve-compare-stdout-20260804 branch August 4, 2026 14:26

Copy link
Copy Markdown
Member Author

✅ Post-merge smoke passed

Merged: 8035dce1cab5d94421506752a1e8c826436d00a3
Built from: main @ 8035dce1cab5d94421506752a1e8c826436d00a3
Smoke: clean install, build, workspace lint, full workspace tests, and real CLI certificate comparisons

Steps

  • ✅ clean npm ci and build
  • ✅ workspace lint/typecheck (0 errors; 9 pre-existing unused-disable warnings)
  • ✅ full workspace tests (3,382 passed; expected/skipped environment-dependent cases reported normally)
  • ✅ real bundled common-paper-mutual-nda.docx through safe-docx compare
  • --certificate-format llm | jq -e . — certificate passed, stderr empty
  • --certificate-format full | jq -e . — certificate passed, stderr empty
  • [DEBUG] atomizeTree absent from stdout and stderr

Real-world fixture

  • tests/test_documents/open-agreements/common-paper-mutual-nda.docx
    • Compared through the shipped safe-docx CLI in both certificate formats.
    • Both machine-readable results parsed without preprocessing and produced passing verifier certificates.

Visual evidence: skipped — the change only affects process streams and is structurally invisible in a rendered document.

Prod: ✅ Vercel deployment for merge commit is successful (3UezxGz5jbsG74VK26gAR6zU75jY).

Log: /tmp/automerge-smoke-785-20260804T1422.log (local).

Cleanup

  • ✅ remote branch was already deleted by repository auto-delete
  • ✅ removed worktrees /private/tmp/safe-docx-783 and /private/tmp/safe-docx-783-smoke
  • ✅ deleted local branch 783-preserve-compare-stdout-20260804
  • ✅ fast-forwarded the dedicated local main worktree to the merge commit; preserved unrelated scripts/oracle/ content

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(docx-compare): ungated [DEBUG] atomizeTree line on stdout corrupts machine-readable CLI output

1 participant