Skip to content

refactor(diagram): one sequence contract across generation and Code Mode - #375

Merged
graphite-app[bot] merged 1 commit into
mainfrom
feat/sequence-one-contract
Oct 11, 2026
Merged

graphite-app[bot] merged 1 commit into
mainfrom
feat/sequence-one-contract

Conversation

@anandpant

@anandpant anandpant commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

  • diagram-generation decodes a model's sequence output with diagram-core's SequenceDiagram and its validation, the same way flowcharts are handled. GeneratedSequenceParticipant, GeneratedSequenceMessage, GeneratedSequenceDiagram, and parseGeneratedSequence are deleted. Invalid output now reports typed sequence.<code>: … Hint: … diagnostics, which the repair loop feeds back to the model, and the Sketchi palette is applied like it is for the other families.
  • The candidate's diagram field is diagram-core's CanonicalDiagramSchema.
  • Code Mode's buildSequenceDiagram gets its invariants from getSequenceValidationIssues and maps them onto its published issue codes (duplicate_node_id, missing_edge_source, self_loop, …). Paths and hints are unchanged, so the MCP contract is unchanged. Message type/style enums come from core.
  • The playground generate API converts the core diagram into the canonical sequence document.

Why

Before this, the participant/message invariants existed in three copies: generation, Code Mode, and the renderer (removed in the parent PR). Now diagram-core owns the sequence contract and its validation, and the other surfaces use it.

Verification

  • pnpm nx affected -t typecheck,test --base=origin/main (18 projects), including the existing Code Mode sequence tests that pin issue codes, paths, and hints
  • New generation tests: core diagnostics for a self message and an unknown target, and style normalization
  • oxlint, oxfmt --check

Refs #280

Review follow-up

Code Mode keeps its published reference hints (Use the id of a participant declared in spec.participants.): the Code Mode mapping overrides diagram-core's request-agnostic wording, and a runtime test pins the code, path, message, and hint.

anandpant commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge - adds this PR to the back of the merge queue
  • fast - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@graphite-app

graphite-app Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Merge activity

…ode (#375)

## What changed

- `diagram-generation` decodes a model's sequence output with diagram-core's `SequenceDiagram` and its validation, the same way flowcharts are handled. `GeneratedSequenceParticipant`, `GeneratedSequenceMessage`, `GeneratedSequenceDiagram`, and `parseGeneratedSequence` are deleted. Invalid output now reports typed `sequence.<code>: … Hint: …` diagnostics, which the repair loop feeds back to the model, and the Sketchi palette is applied like it is for the other families.
- The candidate's `diagram` field is diagram-core's `CanonicalDiagramSchema`.
- Code Mode's `buildSequenceDiagram` gets its invariants from `getSequenceValidationIssues` and maps them onto its published issue codes (`duplicate_node_id`, `missing_edge_source`, `self_loop`, …). Paths and hints are unchanged, so the MCP contract is unchanged. Message `type`/`style` enums come from core.
- The playground generate API converts the core diagram into the canonical sequence document.

## Why

Before this, the participant/message invariants existed in three copies: generation, Code Mode, and the renderer (removed in the parent PR). Now diagram-core owns the sequence contract and its validation, and the other surfaces use it.

## Verification

- `pnpm nx affected -t typecheck,test --base=origin/main` (18 projects), including the existing Code Mode sequence tests that pin issue codes, paths, and hints
- New generation tests: core diagnostics for a self message and an unknown target, and style normalization
- `oxlint`, `oxfmt --check`

Refs #280

## Review follow-up

Code Mode keeps its published reference hints (`Use the id of a participant declared in spec.participants.`): the Code Mode mapping overrides diagram-core's request-agnostic wording, and a runtime test pins the code, path, message, and hint.
@graphite-app
graphite-app Bot force-pushed the feat/sequence-canonical branch from 115e4ae to bfd9c2b Compare October 11, 2026 01:48
@graphite-app
graphite-app Bot force-pushed the feat/sequence-one-contract branch from 97f5817 to 4d3079f Compare October 11, 2026 01:48
Base automatically changed from feat/sequence-canonical to main October 11, 2026 01:52
@graphite-app
graphite-app Bot merged commit 4d3079f into main Oct 11, 2026
4 checks passed
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:53 Active
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:53 Active
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:53 Active
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:53 Active
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:53 Active
@graphite-app
graphite-app Bot deleted the feat/sequence-one-contract branch October 11, 2026 01:53
@github-actions

Copy link
Copy Markdown
Contributor

Sketchi Web Preview

Status: deleted

@github-actions

Copy link
Copy Markdown
Contributor

Sketchi Eval Harness Preview

Status: deleted

@github-actions

Copy link
Copy Markdown
Contributor

Sketchi Icons Preview

Status: deleted

@github-actions

Copy link
Copy Markdown
Contributor

Sketchi Excalidraw Workspace Preview

Status: deleted

@github-actions

Copy link
Copy Markdown
Contributor

Sketchi Playground / Studio Preview

Status: deleted

This branch was successfully deployed

2 active deployments
staging — 4d3079fb Deployed Oct 11, 2026 by graphite-app[bot] via cleanup-preview (playground) #442
production — 4d3079fb Deployed Oct 11, 2026 by graphite-app[bot] via deploy (excalidraw) #121
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