Skip to content

fix(adf): preserve section boundaries and generate canonical core scaffolds - #407

Merged
stackbilt-admin merged 4 commits into
mainfrom
fix/issue-389-safe-adf-format
Nov 2, 2026
Merged

stackbilt-admin merged 4 commits into
mainfrom
fix/issue-389-safe-adf-format

Conversation

@stackbilt-admin

@stackbilt-admin stackbilt-admin commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

adf fmt --write previously treated multi-word uppercase headers and decorations containing repeated U+FE0F selectors as body text. It could report success while moving an entire section inside the previous section, hiding constraints from later processing.

Extend the tolerant parser's header recognition to retain these sections. The formatter keeps its existing canonical ordering and decoration normalization, and indented entries/prose remain body content. No API is removed, CLI result shape changes, or LOC ceilings increase.

Fresh adf init also suggested a formatting check that failed on its own core scaffold. Move the unchanged CONSTRAINTS block before GUIDE in CORE_SCAFFOLD so new output is canonical. Existing complete old-order files are not reformatted under plain init or --force, and populate still recognizes their unchanged per-section fingerprints.

Closes #389.

Validation (Windows Node 24.19.0 / pnpm 9.15.9):

  • Before the fix, the new parser regressions reproduced five lost-section failures.
  • pnpm install --frozen-lockfile: passed in the isolated issue worktree.
  • pnpm run build: passed.
  • pnpm run typecheck: passed.
  • Primary section-loss fix at b7c0253: pnpm exec vitest run packages/adf/src/__tests__ packages/cli/src/__tests__/adf-fmt-headers.test.ts passed 317/317 across 17 files, including the first 13 new cases.
  • Final scaffold-order fix at 3e9f928: init/fmt/populate/bootstrap merge/no-overwrite/reset suites passed 253/253 across six files. Three additional tests execute the JSON next action successfully, preserve complete old-order core bytes under plain init and --force (including CRLF and no final newline), and check populate fingerprints still recognize template sections while rejecting custom context.
  • Regression coverage includes parser/formatter idempotence, constraint evidence, multi-word keys with weights/inline values, repeated selectors, indented-body negatives, CLI JSON --check/--write, byte-preserving check mode, and default stdout mode.
  • git diff --check and smart-commit pre-commit TypeScript/ADF evidence gates: passed. Existing parser LF line endings preserved; new tests use LF.
  • Historical full pnpm run test at b7c0253: 1,938 passed / four failed (1,942 total, 89 files), exactly the four existing Windows baseline cases listed below. Log: issue-389-full-tests.log in the issue worktree. Final 3e9f928 full-suite rerun: 1,941 passed and four known Windows baseline failures (1,945 total), 168.79 seconds. Log: .release-389-scaffold-full-final.log in the worktree. All three additional scaffold tests pass.

Main CI already fails pnpm run supply-chain:check before build/tests; its dependency remediation is coordinated separately under #397/#310. Four existing Windows full-suite failures concern a POSIX-path premise, context-refresh/serve-context path separators, and Ctrl-D fake-TTY behavior. No audit gate is changed or bypassed.

The scaffold change only reorders two unchanged core sections; it does not re-render existing user files or rewrite the other templates. Source LF endings and LOC ceilings are preserved. No merge, publishing, deployment, production write, or remote branch deletion performed.

@stackbilt-admin stackbilt-admin changed the title fix(adf): retain multi-word headers and repeated variation selectors fix(adf): preserve section boundaries and generate canonical core scaffolds Nov 2, 2026
@stackbilt-admin
stackbilt-admin marked this pull request as ready for review November 2, 2026 21:22
@stackbilt-admin
stackbilt-admin merged commit b97ccc0 into main Nov 2, 2026
7 checks passed
@stackbilt-admin
stackbilt-admin deleted the fix/issue-389-safe-adf-format branch November 27, 2026 23:55
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.

adf fmt --write folds sections with unrecognised headers (multi-word key, doubled U+FE0F) into the previous section

2 participants