Skip to content

Add the instruction display orchestrator and public API#1016

Merged
lorisleiva merged 1 commit into
mainfrom
06-25-add_the_instruction_display_orchestrator_and_public_api
Jul 9, 2026
Merged

Add the instruction display orchestrator and public API#1016
lorisleiva merged 1 commit into
mainfrom
06-25-add_the_instruction_display_orchestrator_and_public_api

Conversation

@lorisleiva

Copy link
Copy Markdown
Member

This PR completes the clear-signing display-text feature (sRFC 39) by assembling the value and render-mode layers into a public API. getInstructionDisplay parses a concrete instruction and resolves it into a human-readable display — an intent label, an interpolated sentence, and a structured fallback list — returning null when the instruction cannot be parsed; getInstructionDisplayFromParsedInstruction does the same from an already-parsed instruction. buildDisplayContext bridges a parsed instruction and its root into the single context threaded through the layer, resolving defined-type links by path against a linkable dictionary (correct even for links nested in types from other programs) and computing which members were surfaced through the provide/inject graph so whenInjected fields hide correctly when their value is presented elsewhere. @codama/dynamic-parsers now exports ParsedInstruction. The whole display layer is exported from the package, and a changeset records the minor bumps.

@changeset-bot

changeset-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 15e0425

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@codama/dynamic-instructions Minor
@codama/dynamic-parsers Minor
@codama/dynamic-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

lorisleiva commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

@lorisleiva
lorisleiva marked this pull request as ready for review June 25, 2026 14:39
@lorisleiva
lorisleiva requested a review from mikhd June 25, 2026 14:40
Comment thread packages/dynamic-instructions/src/display/format-argument-value.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR finalizes the clear-signing “display text” layer for dynamic instructions by adding an orchestrator that turns a concrete instruction (raw or already-parsed) into a human-readable presentation (intent label, optional interpolated sentence, and a structured fallback list). It also expands the display context to support correct cross-program defined-type link resolution and correct whenInjected hiding via a consumed-member computation.

Changes:

  • Added a public display orchestration API: getInstructionDisplay and getInstructionDisplayFromParsedInstruction, plus buildDisplayContext.
  • Implemented consumedMemberNames computation to make whenInjected hiding depend on resolved provide/inject usage (online vs offline behavior).
  • Exported ParsedInstruction from @codama/dynamic-parsers and exported the full display layer from @codama/dynamic-instructions (with changeset + dependency updates).

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm-lock.yaml Adds workspace link for @codama/dynamic-parsers dependency usage.
packages/dynamic-parsers/src/parsers.ts Exports ParsedInstruction(+accounts) types for downstream API usage.
packages/dynamic-instructions/package.json Adds @codama/dynamic-parsers dependency required by the new API.
packages/dynamic-instructions/src/index.ts Re-exports the full display layer as part of the public package API.
packages/dynamic-instructions/src/display/index.ts Adds new exports for orchestrator/context and consumed-member resolution.
packages/dynamic-instructions/src/display/types.ts Introduces InstructionDisplay, options, consumedMemberNames, and path-based defined-type resolution.
packages/dynamic-instructions/src/display/get-instruction-display.ts New public API entrypoints for generating instruction display output.
packages/dynamic-instructions/src/display/build-display-context.ts New context builder bridging parsed instruction + root, including link resolution + consumed-member computation.
packages/dynamic-instructions/src/display/resolve-consumed-members.ts New logic to compute which members were surfaced through provide/inject (for whenInjected).
packages/dynamic-instructions/src/display/list-fallback.ts Switches from instruction to instructionPath and from provides.has to consumedMemberNames.has for hiding.
packages/dynamic-instructions/src/display/interpolate-intent.ts Switches from instruction to instructionPath and passes correct owner paths to formatting.
packages/dynamic-instructions/src/display/format-argument-value.ts Adds owner-path-aware link following so nested links resolve against the correct program.
packages/dynamic-instructions/src/display/format-value.ts Adjusts context typing to allow pre-consumed-member context usage.
packages/dynamic-instructions/src/display/resolve-injected-value.ts Adjusts context typing to allow pre-consumed-member context usage.
packages/dynamic-instructions/test/test-utils.ts Updates test helpers for instructionPath, consumed-member plumbing, and new resolver/fetch helpers.
packages/dynamic-instructions/test/display/resolve-consumed-members.test.ts New test coverage for consumed-member computation across online/offline cases.
packages/dynamic-instructions/test/display/get-instruction-display.test.ts New end-to-end tests for the orchestrator across presentation tiers + cross-program link resolution.
packages/dynamic-instructions/test/display/build-display-context.test.ts New tests for context assembly (data/accounts/provides/link resolution/options).
packages/dynamic-instructions/test/display/list-fallback.test.ts Updates tests to use path-based context + consumed-member hiding semantics.
packages/dynamic-instructions/test/display/interpolate-intent.test.ts Updates tests to use path-based context.
packages/dynamic-instructions/test/display/format-argument-value.test.ts Updates tests for new formatArgumentValue(type, ownerPath, value, ctx) signature and resolver helper.
.changeset/every-bikes-rhyme.md Records minor bumps + feature description for the new clear-signing display API.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/dynamic-instructions/src/display/build-display-context.ts
Comment thread packages/dynamic-instructions/test/test-utils.ts
Comment thread packages/dynamic-instructions/src/display/resolve-consumed-members.ts Outdated

@mikhd mikhd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we want to add new display methods to README.md?

@lorisleiva
lorisleiva force-pushed the 06-25-add_interpolated-intent_and_fallback-list_render_modes branch from 10776b0 to 8480e88 Compare July 7, 2026 09:49
@lorisleiva
lorisleiva force-pushed the 06-25-add_the_instruction_display_orchestrator_and_public_api branch from dda515d to 603593d Compare July 7, 2026 09:49
@lorisleiva
lorisleiva force-pushed the 06-25-add_interpolated-intent_and_fallback-list_render_modes branch from 8480e88 to 68a6c47 Compare July 8, 2026 08:25
@lorisleiva
lorisleiva force-pushed the 06-25-add_the_instruction_display_orchestrator_and_public_api branch 2 times, most recently from 17ce2b4 to 1b51857 Compare July 9, 2026 09:39
@lorisleiva
lorisleiva force-pushed the 06-25-add_interpolated-intent_and_fallback-list_render_modes branch from 68a6c47 to 12be393 Compare July 9, 2026 09:39
@lorisleiva
lorisleiva force-pushed the 06-25-add_the_instruction_display_orchestrator_and_public_api branch from 1b51857 to 15e0425 Compare July 9, 2026 12:26
@lorisleiva
lorisleiva force-pushed the 06-25-add_interpolated-intent_and_fallback-list_render_modes branch from 12be393 to 3400879 Compare July 9, 2026 12:26

lorisleiva commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

Merge activity

  • Jul 9, 2:00 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 9, 2:07 PM UTC: Graphite rebased this pull request as part of a merge.
  • Jul 9, 2:07 PM UTC: @lorisleiva merged this pull request with Graphite.

@lorisleiva
lorisleiva changed the base branch from 06-25-add_interpolated-intent_and_fallback-list_render_modes to graphite-base/1016 July 9, 2026 14:04
@lorisleiva
lorisleiva changed the base branch from graphite-base/1016 to main July 9, 2026 14:05
This PR completes the clear-signing display-text feature (sRFC 39) by assembling the value and render-mode layers into a public API. getInstructionDisplay parses a concrete instruction and resolves it into a human-readable display — an intent label, an interpolated sentence, and a structured fallback list — returning null when the instruction cannot be parsed; getInstructionDisplayFromParsedInstruction does the same from an already-parsed instruction. buildDisplayContext bridges a parsed instruction and its root into the single context threaded through the layer, resolving defined-type links by path against a linkable dictionary (correct even for links nested in types from other programs) and computing which members were surfaced through the provide/inject graph so whenInjected fields hide correctly when their value is presented elsewhere. @codama/dynamic-parsers now exports ParsedInstruction. The whole display layer is exported from the package, and a changeset records the minor bumps.
@lorisleiva
lorisleiva force-pushed the 06-25-add_the_instruction_display_orchestrator_and_public_api branch from 15e0425 to 3d77f56 Compare July 9, 2026 14:06
@lorisleiva
lorisleiva merged commit 9db43b5 into main Jul 9, 2026
2 of 3 checks passed
@lorisleiva
lorisleiva deleted the 06-25-add_the_instruction_display_orchestrator_and_public_api branch July 9, 2026 14:07
@github-actions github-actions Bot mentioned this pull request Jul 9, 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.

3 participants