Skip to content

feat(form): support spec.dependencies parsing and chain resolution - #29

Merged
colinjlacy merged 1 commit into
runtimeconditions:mainfrom
abhinavkdeval08-design:feat/chained-extensions-16
Dec 3, 2026
Merged

colinjlacy merged 1 commit into
runtimeconditions:mainfrom
abhinavkdeval08-design:feat/chained-extensions-16

Conversation

@abhinavkdeval08-design

Copy link
Copy Markdown
Member

Part 1 of #16 (chained extensions). This is the groundwork for letting an extension like env-configuration build on top of common-integrations.

What and why

  • Adds an ExtensionDependency type (a bare extension ID or { id, version? }).
  • parseExtensionDefinition now accepts extensions that declare spec.dependencies but leave out spec.kinds / spec.interfaceTypes, since additive extensions inherit those from their base. Standalone extensions still need both.
  • Adds resolveExtensionChain, which returns an extension and its transitive dependencies base-first, and throws a clear error on a missing dependency or a cycle.

Two things worth knowing:

  • version in a dependency is parsed but not used yet. Dependencies are matched by id only.
  • Nothing calls resolveExtensionChain yet. Merging schemas across the chain in extractConditionForms comes in the next PR, to keep this one small.

How it was tested

  • Added 3 tests: additive parsing, rejecting a standalone extension without kinds, and chain order / missing dependency / cycle detection.

  • tsc passes for both tsconfigs and Jest is 20/20.

  • npm test passes in the root and in backend/

  • The README is updated if behavior or the API changed

Part 1 of runtimeconditions#16 (chained extensions): adds ExtensionDependency types, allows additive extensions with spec.dependencies to omit spec.kinds and spec.interfaceTypes, and adds resolveExtensionChain for base-first topological ordering with missing-dependency and cycle detection.

Multi-extension schema merging in extractConditionForms will follow in a separate PR.

Signed-off-by: Abhinav Deval <abhinavkdeval08@gmail.com>
Comment thread src/form/catalog.ts Resolved

@colinjlacy colinjlacy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks right. Still somewhat incomplete, which I think we knew was going to be the case, so that's not a problem. The big thing that's missing in schema compilation, and you said that would come next, so all good there 👍

I see this function being extremely important to how Backstage and any other form host will handle extension management.

I just had on question. If you can respond to that - even if just to say that we'll address it in the next PR - I think we'll be good to merge.

@colinjlacy colinjlacy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😁👍

@colinjlacy
colinjlacy merged commit 03e7cba into runtimeconditions:main Dec 3, 2026
2 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.

2 participants