Skip to content

Preserve original XML source formatting on save - #4

Merged
cankilic-gh merged 1 commit into
mainfrom
fix/xml-save-byte-preservation
Aug 27, 2026
Merged

cankilic-gh merged 1 commit into
mainfrom
fix/xml-save-byte-preservation

Conversation

@cankilic-gh

Copy link
Copy Markdown
Owner

What

Saving a form now round-trips through a source-format model, so:

  • a no-op save is byte-for-byte identical to the opened file
  • an edit changes only the lines it actually touches (e.g. Required Doc adds one <required-doc> line + bumps nextid)

Scope

Only the XML parser/serializer and its type surface plus tests. No AI, Test Lab, or UI changes are included in this PR.

  • src/lib/xmlParser.ts
  • src/types/form.ts
  • tests/corpus.roundtrip.test.ts, tests/fixtures.roundtrip.test.ts, tests/sourceFormat.test.ts, tests/xmlParser.gaps.test.ts
  • new: tests/entitySpelling.test.ts, tests/requiredDoc.corpus.regression.test.ts

Verification

  • Corpus gate (EBAR_STATES_DIR set, >500 real forms): round-trip zero semantic loss, rebuild idempotent, byte-exact no-op save — all pass
  • Required-doc regression against real GA + CO Character and Fitness questionnaires: diff is exactly nextid + one inserted <required-doc> line
  • Full suite with corpus: 112 passed / 4 skipped; without corpus: 106 passed / 10 skipped
  • npx tsc --noEmit clean, npm run build succeeds, git diff --check clean

Note: the pre-existing npm run lint script calls next lint, which was removed in Next 16 — it fails on main today and is untouched here.

🤖 Generated with Claude Code

Round-trip forms through a source-format model so a no-op save is
byte-for-byte identical to the opened file, and an edit changes only the
lines it touches. Adds corpus byte-exact and required-doc regression
gates plus entity-spelling coverage.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
formforge Building Building Preview Aug 27, 2026 7:45pm

@cankilic-gh
cankilic-gh merged commit 4c60704 into main Aug 27, 2026
2 of 3 checks passed
@cankilic-gh
cankilic-gh deleted the fix/xml-save-byte-preservation branch August 31, 2026 16:44

This branch was successfully deployed

1 active deployment
Preview — fb927569 Deployed Aug 27, 2026 by vercel[bot]
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