Skip to content

API/TypeSchema: migrate package defect handling into CanonicalManager (#128)#173

Draft
ryukzak wants to merge 1 commit into
mainfrom
feat/defect-handling-migration-128
Draft

API/TypeSchema: migrate package defect handling into CanonicalManager (#128)#173
ryukzak wants to merge 1 commit into
mainfrom
feat/defect-handling-migration-128

Conversation

@ryukzak

@ryukzak ryukzak commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Draft PR tracking #128 — moving package/StructureDefinition defect-handling transformations out of codegen and into CanonicalManager (CM). This first commit adds the design + phased execution plan (docs/design/defect-handling-migration.md); future codegen-side changes for this effort will land here.

What this is

  • A composable patches API in CM (one mechanism; preprocessPackage becomes a deprecated alias for a single patch).
  • A packageIndex mode (use/recover/regenerate) replacing the ignorePackageIndex boolean.
  • Index-level exclusion (excludeCanonical) replacing the internal skip-hack.ts.
  • A diagnostics report (manager.report()) surfaced in codegen's prettyReport so we can answer "why is type X missing/changed".

Phasing

  • Phase 0 (CM repo) — one release: packageIndex mode, patch/report/entry types, the live patch + exclusion runtime, and CM docs.
  • Phase 1 (codegen) — transform helpers + scoping combinators as codegen factory functions on CM's patches runtime, one helper per commit, migrating each example.
  • Phase 2 (codegen) — migrate skip-hack to CM-level exclusion (the risky step); optional helper-factory relocation into CM.
  • Phase 3 — remove the deprecated API.

Scope note

Only raw-FHIR/package-level defect handling moves to CM. TypeSchema-level mechanisms (binding/enum drops, missing_valuesets, treeShake/promoteLogical/resolveCollisions) stay in codegen. CM owns exclusion enforcement; codegen keeps the exclude list as data (to gate the field-level drop and to allow disable/override).

@ryukzak ryukzak force-pushed the feat/defect-handling-migration-128 branch 3 times, most recently from 59927b5 to 294c216 Compare June 4, 2026 15:08
#128)

Design + phased execution plan for #128: move package/SD defect-handling
transformations (preprocessPackage patches, skip-hack exclusion, ignorePackageIndex)
out of codegen into CanonicalManager via a composable patch API, with a packageIndex
mode, index-level exclusion, and a diagnostics report.

Future codegen-side changes for this effort will land in this PR.
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