Skip to content

Cross-module drift detection for qualified default types (closes #47)#48

Merged
yavorpanayotov merged 1 commit into
mainfrom
feat/xmod-default-drift
Jun 16, 2026
Merged

Cross-module drift detection for qualified default types (closes #47)#48
yavorpanayotov merged 1 commit into
mainfrom
feat/xmod-default-drift

Conversation

@yavorpanayotov

Copy link
Copy Markdown
Collaborator

Closes #47 — the cross-module follow-up to the Gap B drift work in #46.

What it does

Extends default field-schema validation to qualified default alias/Type = { ... } literals in the multi-file CLI:

  • collect_entity_field_schemas(module) (new, exported) exposes each module's entity/value type → declared field names.
  • The CLI builds a per-file imported_entity_fields map (alias → type → fields) on CrossModuleContext, mirroring imported_triggers, and threads it through analyze_with_cross_module into Ctx.
  • check_default_field_schemas flags a qualified-default field not declared on the imported type → allium.default.unknownField (e.g. default gp/Policy d = { naem: ... }).

Scope & conventions (consistent with qualified triggers)

  • Aliases or types whose target module is outside the check set are left unvalidated, never flagged.
  • Multi-file-CLI-only. The single-file TypeScript analyzer can't see other modules, so it keeps validating only local default types — the same documented asymmetry as qualified-trigger resolution.
  • The cross-module path carries field names only, so rule 14c and nested-object recursion stay local-type-only.

Tests / verification

  • cargo test --workspace green (391 parser + 31 in the cross-module CLI binary, incl. 2 new: drift-flagged-across-modules, not-flagged-when-target-outside-check-set).
  • Verified end-to-end: multi-file allium check flags naem against gp/Policy; single-file (parent not in check set) does not.
  • Zero new diagnostics sweeping all repo specs together in multi-file mode.
  • Parity doc updated.

🤖 Generated with Claude Code

Closes #47.

Extends default field-schema validation to qualified `default alias/Type = { ... }`
literals in the multi-file CLI. `collect_entity_field_schemas` exposes each
module's entity/value type → field names; the CLI builds a per-file
`imported_entity_fields` map (alias → type → fields) on `CrossModuleContext`,
mirroring `imported_triggers`, and threads it through `analyze_with_cross_module`
into `Ctx`. `check_default_field_schemas` then flags a qualified-default field
not declared on the imported type (`allium.default.unknownField`).

Aliases or types whose target module is outside the check set are left
unvalidated rather than flagged — the same convention as qualified triggers.
This is multi-file-CLI-only: the single-file TypeScript analyzer cannot see
other modules, so it continues to validate only local default types (an
asymmetry already documented for qualified-trigger resolution). The cross-module
path carries field names only, so rule 14c and nested-object recursion remain
local-type-only.

Adds two CLI integration tests (drift flagged across modules; not flagged when
the target is outside the check set) and updates the parity doc.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@yavorpanayotov yavorpanayotov merged commit 34c9d48 into main Jun 16, 2026
2 checks passed
@yavorpanayotov yavorpanayotov deleted the feat/xmod-default-drift branch June 16, 2026 14:24
This was referenced Jun 16, 2026
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.

Cross-module drift detection for qualified default types (default alias/Type)

1 participant