Skip to content

feat(spec)!: enforce strict allOf form for derivation and redesign tr…#76

Closed
aviator5 wants to merge 1 commit into
GlobalTypeSystem:mainfrom
aviator5:derivation-and-traits
Closed

feat(spec)!: enforce strict allOf form for derivation and redesign tr…#76
aviator5 wants to merge 1 commit into
GlobalTypeSystem:mainfrom
aviator5:derivation-and-traits

Conversation

@aviator5
Copy link
Copy Markdown
Collaborator

…aits as URN-referenced types

  • Add §3.2.1 (Top-level composition rules): derived GTS Type Schemas MUST use the canonical single-item allOf with a $ref to the immediate parent; overlay constraints live at the top level. Top-level anyOf/oneOf/not are forbidden on all GTS Type Schemas (nested usage is unaffected). Rationale captured in ADR-0002.
  • Rewrite §9.7 traits model: x-gts-traits-schema becomes a single GTS Type URN string referencing a registered trait-type; inline schema, $ref, and composition forms are removed. Trait-types are first-class GTS Type Schemas with their own parallel-derivation chain. Shallow merge with immutable-once-set semantics preserved.
  • Make the trait-completeness rule explicit: a non-abstract host with unresolved required trait fields is invalid by definition; registry MUST reject it at registration and OP#6 MUST reject instances of it as defense in depth.
  • Extend OP#12 to enforce the structural rules from §3.2.1 in addition to the existing constraint-compatibility checks.
  • Migrate all examples in events/types/, mcp/types/, and typespec/vms/types/ to strict Form A and the new trait-type model. Add gts.x.core.traits.event_meta.v1~ as the canonical trait-type referenced by the base event schema.
  • Update the register_derived test helper to emit strict Form A (single-item allOf + overlay spread at top level). Add register_trait_type and register_host_with_trait_ref helpers.
  • Add 15 structural test classes to test_op12_* covering canonical form, rejections (Form B, 3+ items, no-$ref, multi-$ref, skip-level, wrong parent, hybrid, top-level union/negation, base-with-allOf), and accepted nested-union shapes.
  • Rewrite test_op13_* (38 classes) around URN-referenced trait-types: value validation cases, trait-type derivation (narrowing, loosening rejection, field extension, default inheritance), parallel-derivation rules, abstract vs concrete completeness, MAJOR-version pinning, cycle detection, and instance-validation defense-in-depth.
  • Migrate the three trait-aware tests in test_refimpl_x_gts_final_abstract.py to the URN model.
  • Add ADR-0002 (MADR) with worked Option-1..4 comparison, running example, and explicit payload behavior under each option.
  • Log change as version 0.12 (BREAKING).

@aviator5 aviator5 force-pushed the derivation-and-traits branch from 05003b8 to beed95c Compare May 21, 2026 15:04
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 39a1ff7a-bd05-452e-8352-8e178f165546

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

…aits as URN-referenced types

- Add §3.2.1 (Top-level composition rules): derived GTS Type Schemas
  MUST use the canonical single-item allOf with a \$ref to the
  immediate parent; overlay constraints live at the top level.
  Top-level anyOf/oneOf/not are forbidden on all GTS Type Schemas
  (nested usage is unaffected). Rationale captured in ADR-0002.
- Rewrite §9.7 traits model: x-gts-traits-schema becomes a single
  GTS Type URN string referencing a registered trait-type; inline
  schema, \$ref, and composition forms are removed. Trait-types are
  first-class GTS Type Schemas with their own parallel-derivation
  chain. Shallow merge with immutable-once-set semantics preserved.
- Make the trait-completeness rule explicit: a non-abstract host
  with unresolved required trait fields is invalid by definition;
  registry MUST reject it at registration and OP#6 MUST reject
  instances of it as defense in depth.
- Extend OP#12 to enforce the structural rules from §3.2.1 in
  addition to the existing constraint-compatibility checks.
- Migrate all examples in events/types/, mcp/types/, and
  typespec/vms/types/ to strict Form A and the new trait-type
  model. Add gts.x.core.traits.event_meta.v1~ as the canonical
  trait-type referenced by the base event schema.
- Update the register_derived test helper to emit strict Form A
  (single-item allOf + overlay spread at top level). Add
  register_trait_type and register_host_with_trait_ref helpers.
- Add 15 structural test classes to test_op12_* covering canonical
  form, rejections (Form B, 3+ items, no-\$ref, multi-\$ref,
  skip-level, wrong parent, hybrid, top-level union/negation,
  base-with-allOf), and accepted nested-union shapes.
- Rewrite test_op13_* (38 classes) around URN-referenced
  trait-types: value validation cases, trait-type derivation
  (narrowing, loosening rejection, field extension, default
  inheritance), parallel-derivation rules, abstract vs concrete
  completeness, MAJOR-version pinning, cycle detection, and
  instance-validation defense-in-depth.
- Migrate the three trait-aware tests in
  test_refimpl_x_gts_final_abstract.py to the URN model.
- Add ADR-0002 (MADR) with worked Option-1..4 comparison, running
  example, and explicit payload behavior under each option.
- Log change as version 0.12 (BREAKING).

Signed-off-by: Aviator 5 <ai.agent.tor@gmail.com>
@aviator5 aviator5 requested a review from Artifizer May 21, 2026 20:42
@aviator5 aviator5 force-pushed the derivation-and-traits branch from beed95c to 4d5d49e Compare May 26, 2026 07:11
@aviator5
Copy link
Copy Markdown
Collaborator Author

superseded with #77

@aviator5 aviator5 closed this May 27, 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.

1 participant