Skip to content

feat(db): add header/footer config foundation - #222

Merged
thewrz merged 1 commit into
mainfrom
feat/issue-208
Jun 18, 2026
Merged

feat(db): add header/footer config foundation#222
thewrz merged 1 commit into
mainfrom
feat/issue-208

Conversation

@thewrz

@thewrz thewrz commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add open Zod schemas for header/footer composition payloads
  • add header_footer_configs with client/project/package/revision scoped overrides
  • add DB query surface for upsert/find/delete and effective resolution from client -> project -> package -> revision
  • update ADR-017 to keep DOCX Header/Footer rendering out of the manual assembly engine

Design decisions

  • Header/footer configs are JSONB with typed known keys and JSON-safe extension keys, matching the ADR-021 open-schema posture.
  • Client scope is limited to libraries.tier = 'client'; project context resolves the first client project source by priority.
  • Resolution performs deep object override by layer. Arrays and scalar values replace rather than merge.
  • No DOCX output is produced here. Rendering remains a later sprint, per feat(db): header/footer composition model — fields + per-scope overrides (no DOCX render) #208.

Verification

  • pnpm exec eslint src/ast/header-footer-schemas.ts src/db/queries/header-footer.ts src/db/queries/header-footer.integration.test.ts src/db/migrations/030_header_footer_configs.ts src/ast/index.ts src/db/index.ts
  • pnpm exec tsc --noEmit
  • pnpm exec prettier --check src/ast/header-footer-schemas.ts src/db/queries/header-footer.ts src/db/queries/header-footer.integration.test.ts src/db/migrations/030_header_footer_configs.ts src/ast/index.ts src/db/index.ts docs/adr/017-project-manual-publishing.md
  • NODE_ENV=test DATABASE_URL=postgres://specr:specr@localhost:5432/specr_issue208 pnpm migrate:down
  • NODE_ENV=test DATABASE_URL=postgres://specr:specr@localhost:5432/specr_issue208 pnpm migrate
  • NODE_ENV=test DATABASE_URL=postgres://specr:specr@localhost:5432/specr_issue208 pnpm exec vitest --project integration src/db/queries/header-footer.integration.test.ts

Note: full pnpm lint on the origin/main base is blocked by the existing src/ast/schemas.ts line-cap failure, tracked separately in #220.

Closes #208

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@thewrz, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 23 minutes and 41 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e5f32dfa-d320-4a0d-a000-da3b99887461

📥 Commits

Reviewing files that changed from the base of the PR and between 6018654 and 61acde7.

📒 Files selected for processing (7)
  • docs/adr/017-project-manual-publishing.md
  • src/ast/header-footer-schemas.ts
  • src/ast/index.ts
  • src/db/index.ts
  • src/db/migrations/030_header_footer_configs.ts
  • src/db/queries/header-footer.integration.test.ts
  • src/db/queries/header-footer.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-208

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

@thewrz

thewrz commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

CI triage note: the current failing Lint (ESLint + tsc + prettier) check is inherited from the base branch, not from this PR's diff. The failure is src/ast/schemas.ts exceeding the 400-line cap; this PR does not touch that file.

The base fix is already open and green in #220 (fix(ast): extract revision schemas to restore 400-line cap). After #220 merges, rerun/rebase this PR and the lint check should clear. CodeRabbit produced no review threads or actionable inline comments on this PR; its top-level comment was a rate-limit/usage notice.

@thewrz
thewrz merged commit a359617 into main Jun 18, 2026
5 checks passed
@thewrz
thewrz deleted the feat/issue-208 branch June 18, 2026 20:32
thewrz added a commit that referenced this pull request Jul 1, 2026
#325)

* docs(readme): sync capabilities to last month of merged PRs

Reflect shipped work in the README's "Included Today", "API Surface", and MCP
tool table, validated against the merged diffs and current main:

- PDF ingest (text-layer + OCR + font-encoding recovery) accepted by POST /parse
  (#287, #290, #311)
- coordination / E&O report + submittal register (#241, #269, #277, #282, #283,
  #284) and article-role tagging (#273)
- onboarding pipeline: library import, editability review/override, reclassify,
  finalize/reopen, open-comments (#243, #247, #248, #249, #272)
- spec/project soft-delete + restore (#257, #313), document concurrency (#197),
  revision/addendum manual rendering (#221), numbering profiles (#317, #322)
- add missing MCP tools get_numbering_profile, submittal_register,
  open_comments_report; document GET /docs (Scalar) (#213, #285)
- add Example Client pointer to examples/web_ui_demo (#225)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs(roadmap): move shipped work to done; re-date to 2026-07-01

Reconcile the roadmap with merged reality (was stamped 2026-06-17). Moved from
planned/in-progress to Included, each validated against the diff:

- PDF ingest (#287, #290, #311) — remove from "Later"
- deep paragraph nesting pr6/pr7 (#215)
- revision nomenclature (#216) + revision/addendum manual rendering (#221) —
  the two "Near Term" Phase 2e items are done
- coordination / E&O report, required-sections, article-role, submittal register
  (#239, #241, #269, #273, #277, #282, #283, #284) — new "Coordination and
  Semantics" section; removed "coordination report" from planned Phase 4
- onboarding APIs (#243, #247, #248, #249, #272) — API done; UI remains planned
- soft-delete/withdraw (#257, #313), section-number format (#266, #271),
  external-content associations (#242), structural numbering profiles (#317)

Kept as planned (foundation only): header/footer composition (#222, #314) and
keynote surfacing (#315) — DB/AST exist, no resolution/render/export yet.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs(architecture): reflect merged structural changes

Update the architecture spec for shipped work, validated against the diffs and
current schema/routes:

- Tech Stack + Data Flow: Parse — PDF text-layer (unpdf/pdfjs-dist) + OCR
  (tesseract.js/@napi-rs/canvas) path and numberingProfileId override (#287,
  #290, #311, #317; ADR-034, ADR-039)
- DB schema — specs.onboarding_status/withdrawn_at, projects.section_number_format
  /deleted_at/deleted_by, paragraphs.source_facts/classification/
  editability_override; "Additional tables" summary for editing_conventions,
  paragraph_associations, required_sections, keynotes, header_footer_configs,
  numbering_profiles, revision_nomenclature_profiles (foundation-only tables
  flagged) (ADR-021/022/023/028/031/032; #187, #242)
- new Coordination Report / E&O section (finding vocabulary) and Document
  Concurrency section (locks/optimistic/lifecycle) (#197, #241, #269, #277,
  #282, #283, #284; ADR-018, ADR-033/035/036/037)
- AST meta.articleRole (#273, ADR-033); API-surface note pointing at the
  CI-enforced openapi.yaml + GET /docs; refreshed MCP tool list

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

feat(db): header/footer composition model — fields + per-scope overrides (no DOCX render)

1 participant