Skip to content

feat(office): add bounded DOCX page layout contract - #141

Draft
seonghobae wants to merge 23 commits into
mainfrom
feat/docx-page-layout
Draft

feat(office): add bounded DOCX page layout contract#141
seonghobae wants to merge 23 commits into
mainfrom
feat/docx-page-layout

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Purpose

Implement issue #140 as the next-release DOCX page-layout slice while keeping the current 0.6.0 protected release candidate unchanged until issue #118 reaches registry operational acceptance.

Test-first lineage

Exact protected base at branch creation: 02251db320b2b5ed7c284635c4f3103ec2f67eb6.

Exact RED head: 634d1ed1a7f7a29cd6681872a42ac49d330717d6.

The RED commit changed only office/tests/test_page_layout.py. CI checked out that exact head and reached the intended production boundary after normal setup: the Office matrix failed because the public render_office_document() path rejected page_layout as an unexpected DOCX field. Setup/import/infrastructure failure was not used as RED evidence.

Implemented boundary

Current exact head: c90a7b43c9214cba22be2980e0e0e5d2405c4c51.

The branch adds a bounded machine-readable DOCX page-layout contract:

  • paper size: exact a4 or letter;
  • orientation: exact portrait or landscape;
  • required top/right/bottom/left integer margins from 0 through 100 mm;
  • one-section-only application through python-docx;
  • deterministic OOXML canonicalization after layout application;
  • fail-closed rejection of missing/unknown/type/range-invalid layout values;
  • no partial file publication when layout validation fails;
  • real DOCX round-trip coverage for all four supported A4/Letter × portrait/landscape combinations;
  • explicit regression evidence that the post-render page-layout pass preserves relationship-backed external hyperlinks, rich-run formatting, inline PNG geometry and alternative-description metadata, and explicit DOCX page breaks;
  • an explicit regression proving page_layout remains DOCX-only and fails closed for XLSX/PPTX; and
  • active-PR buyer guidance plus ADR/doctoring documentation that does not claim protected-main maturity.

The implementation preserves the existing internal renderer contract by keeping layout adaptation in the public safety facade; the underlying deterministic DOCX content renderer receives the same prior payload shape. It does not add multiple sections, arbitrary page dimensions, headers/footers, print/PDF service authority, network access, persistence, credentials, tenancy, or host authorization authority.

Exact-head evidence

For exact head c90a7b43c9214cba22be2980e0e0e5d2405c4c51:

  • CI run 31410737442 completed successfully;
  • Security Scan run 31410737474 completed successfully;
  • SAST Semgrep run 31410737473 completed successfully;
  • CodeRabbit status on the exact head is successful; and
  • fresh review inspection shows no submitted formal reviews or unresolved inline review threads. Automated status is not represented as independent formal approval.

Live base and dependency boundary

Protected main remains 50ac98cfa0ad9e8dd75f93ca437a5679fed4d804. This Draft has not reacquired live-main ancestry and must remain unmerged while issue #118 owns 0.6.0 registry operational acceptance. Moving protected main before that release boundary resolves would invalidate the exact stable-candidate identity required by the protected release workflow.

Remaining integration work

docs/docx-page-layout.md, ADR 0027, and the page-layout doctoring record are explicitly implemented_on_active_pr / Proposed authority until protected integration. Canonical docs/TRACEABILITY.md and next-release CHANGELOG/version reconciliation remain required before this feature can be promoted as protected behavior.

After #118 closes, refetch the then-current protected main, non-destructively reacquire live-main ancestry if safe, reconcile canonical traceability and next-release release metadata, reacquire exact-head checks and any qualifying live-policy review evidence, and only then evaluate Ready/merge status.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7427e51b-2c9f-4bff-acf5-3d097e41f6a5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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