Skip to content

feat: add extends= attribute for interface inheritance (ADR-011) - #10

Merged
sergio-sisternes-epam merged 1 commit into
mainfrom
sergio-sisternes-epam/aml-extends-attribute
May 25, 2026
Merged

feat: add extends= attribute for interface inheritance (ADR-011)#10
sergio-sisternes-epam merged 1 commit into
mainfrom
sergio-sisternes-epam/aml-extends-attribute

Conversation

@sergio-sisternes-epam

Copy link
Copy Markdown
Owner

Summary

Implements the extends= attribute on AML interface nodes, resolving the DDE v0.5 request to correctly model multi-level interface hierarchies.

Problem

AML had no way to express interface-to-interface specialisation. The only option was implements= on define="interface" nodes, which is semantically wrong (it implies the interface is directly invocable) and was confusing genesis reviewers in the DDE project.

Changes

Core (aml-core)

  • AST: NodeKind::InterfaceDefinition gains extends: Option<String> and legacy_implements: Option<String>
  • Parser: reads extends= and captures legacy implements= on interface nodes
  • Validator:
    • Error: extends="" (empty value)
    • Error: both extends and implements with different values on same interface
    • Warning: implements= on interface definition (deprecated; use extends=)
  • Registry: InterfaceEntry gains extends; validate() checks for unknown parents and cycles (ExtendsUnknownInterface, ExtendsInterfaceCycle)
  • 9 new tests covering all validation paths

Python bindings (aml-python)

  • register_interface(name, extends=None, description=None)

Docs

  • docs/spec/attributes.md — new attribute row + semantics section
  • docs/spec/grammar.ebnfExtendsAttr added
  • docs/spec/resolution.md — metadata-only note
  • docs/adrs/adr-011-extends-attribute.md — new ADR
  • CHANGELOG and API reference docs updated

Usage (DDE migration)

<- Not assume GitHub API availability Before (deprecated warning) -->
<skill define="interface" name="dde-simple"
       implements="diagram-driven-execution">

<- Not assume GitHub API availability After (correct) -->
<skill define="interface" name="dde-simple"
       extends="diagram-driven-execution">

Notes

  • extends is metadata + validation only — resolution behaviour is unchanged. Transitive resolution is explicitly deferred until contract-compatibility rules are defined (see ADR-011).
  • All 137 aml-core tests pass.

Introduces the `extends=` attribute on `<skill define="interface">` nodes
to express interface specialisation (UML-style interface inheritance).

### Changes

**AST**
- `NodeKind::InterfaceDefinition` gains `extends: Option<String>` and
  `legacy_implements: Option<String>`.

**Parser**
- Reads `extends=` and captures a legacy `implements=` on interface nodes
  into the new AST fields.

**Validator**
- Error when `extends=""` (empty value).
- Error when both `extends` and `implements` are present with different values.
- Warning (deprecation) when `implements=` is used on an interface definition.

**Registry**
- `InterfaceEntry` gains `extends: Option<String>`.
- `register_interface` gains an `extends` parameter.
- `validate()` checks for unknown parents (`ExtendsUnknownInterface`) and
  cycles (`ExtendsInterfaceCycle`).

**Python bindings**
- `register_interface(name, extends=None, description=None)`.

**Docs**
- `docs/spec/attributes.md` — new `extends=` row, updated mutual-exclusivity
  table, and a dedicated semantics section.
- `docs/spec/grammar.ebnf` — `ExtendsAttr` added to `InterfaceDefAttrs`.
- `docs/spec/resolution.md` — clarifies that `extends` is metadata-only;
  transitive resolution is explicitly out of scope for this release.
- `docs/adrs/adr-011-extends-attribute.md` — new ADR.
- CHANGELOG, API reference docs updated.

Resolves the DDE v0.5 request to correctly model `dde-simple` and
`dde-advanced` as sub-interfaces rather than implementations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sergio-sisternes-epam
sergio-sisternes-epam merged commit b893e00 into main May 25, 2026
1 of 3 checks passed
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