Skip to content

feat(diagram): enforce the diagram family pipeline and stop advertising unsupported types - #379

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

graphite-app[bot] merged 1 commit into
mainfrom
feat/sequence-extension-path

Conversation

@anandpant

@anandpant anandpant commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

  • Family pipeline test (tools/diagram-families.test.ts, run in CI by pnpm run test:tools). For every family in DIAGRAM_TYPES, it runs one named test per stage:

    • core contract and fixture
    • deterministic renderer
    • Excalidraw conversion
    • generation prompt
    • generation output parsing (round-trips the fixture through candidateFromText)
    • Code Mode build
    • CLI document dispatch
    • maintained scenarios
    • Storybook story

    A family missing a stage fails as <family>: <stage>. With a scratch family registered, all nine of its stages fail by name, and core stops compiling.

  • One family registry per layer, derived from DIAGRAM_TYPES:

    • generation: the supported-kind list, prompt text, IR_INSTRUCTIONS, FAMILY_EXAMPLES, and the native-kind check
    • diagram-agent documents.ts: CANONICAL_DOCUMENT_SPECS, CanonicalDiagramDocument, buildCanonicalDocument, and canonicalDocumentFromDiagram
    • the CLI's document decoder and builder
    • the generate API, whose three local converters and build ternary are deleted

    satisfies Record<DiagramTypeValue, …> and exhaustive switches make a missing entry a compile error.

  • Generator: diagram-type registers the family in DIAGRAM_TYPES and GRAPH_DIAGRAM_TYPES. It scaffolds a compilable Effect Schema contract with validation and a parser, a core test, a renderer test via renderDiagram, and a story. It then prints the remaining stages and points at the checklist. Running it for real in the worktree produced files that compile; only the expected registry error remained.

  • Checklist: docs/diagram-families.md covers each stage, where it lives, and what guards it. It is linked from the diagram-core and generators READMEs and from the generator output, and the test requires every stage to be documented there.

  • Unsupported families are not advertised: sketchi generate --type now accepts only flowchart|mindmap|sequence, and its help and README no longer list ER, architecture, swimlane, or state-machine. Prompts for those kinds still fail with the typed unsupported_diagram_type instead of being coerced. A changeset is included.

Why

#280 asks that the next family can't skip a required stage without a test noticing, and that the extension path be documented. Before this, the structure test checked only three files, and the family lists were hand-maintained in several packages.

Verification

  • pnpm nx affected -t typecheck,test --base=origin/main (18 projects), pnpm run test:tools (211 tests), pnpm run check
  • CLI help snapshots refreshed from a rebuilt bundle. The CLI audit now pins decoding through the agent registry.
  • The generator spec compiles and runs the scaffold. The promise-site ratchet is unchanged.

Refs #280

Review follow-ups

  • Generate API: apps/playground/src/server/generation/request.ts (no server-only import) derives the request schema's type literals from CANONICAL_DOCUMENT_TYPES plus UnsupportedDiagramIntentKindSchema.literals. It gates with isCanonicalDocumentType and builds the error copy from the registry; the wording is unchanged.
  • CLI wizard: choices come from GENERATION_TYPE_CHOICES, which must cover every GenerationType (satisfies Record<…>), listed in registry order.
  • Prompt: both refusal sentences are built from UnsupportedDiagramIntentKindSchema, and the generated prompt text is identical. DiagramGenerationTypeSchema moved into intent.ts beside the unsupported kinds.
  • Pipeline test: two new stages, "generate API request" and "CLI generate type". "CLI document dispatch" now runs the real CLI DiagramBuilder. "Generation prompt" asserts the prompt never lists a supported family as unsupported. The checklist is updated to match.

@anandpant
anandpant marked this pull request as ready for review October 10, 2026 22:23
@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.

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.

@graphite-app

graphite-app Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Merge activity

@graphite-app
graphite-app Bot force-pushed the feat/sequence-evals branch from c8a6b97 to d32a18f Compare October 11, 2026 01:50
graphite-app Bot pushed a commit that referenced this pull request Oct 11, 2026
…ng unsupported types (#379)

## What changed

- **Family pipeline test** (`tools/diagram-families.test.ts`, run in CI by `pnpm run test:tools`). For every family in `DIAGRAM_TYPES`, it runs one named test per stage:
  - core contract and fixture
  - deterministic renderer
  - Excalidraw conversion
  - generation prompt
  - generation output parsing (round-trips the fixture through `candidateFromText`)
  - Code Mode build
  - CLI document dispatch
  - maintained scenarios
  - Storybook story

  A family missing a stage fails as `<family>: <stage>`. With a scratch family registered, all nine of its stages fail by name, and core stops compiling.
- **One family registry per layer, derived from `DIAGRAM_TYPES`:**
  - generation: the supported-kind list, prompt text, `IR_INSTRUCTIONS`, `FAMILY_EXAMPLES`, and the native-kind check
  - diagram-agent `documents.ts`: `CANONICAL_DOCUMENT_SPECS`, `CanonicalDiagramDocument`, `buildCanonicalDocument`, and `canonicalDocumentFromDiagram`
  - the CLI's document decoder and builder
  - the generate API, whose three local converters and build ternary are deleted

  `satisfies Record<DiagramTypeValue, …>` and exhaustive switches make a missing entry a compile error.
- **Generator**: `diagram-type` registers the family in `DIAGRAM_TYPES` and `GRAPH_DIAGRAM_TYPES`. It scaffolds a compilable Effect Schema contract with validation and a parser, a core test, a renderer test via `renderDiagram`, and a story. It then prints the remaining stages and points at the checklist. Running it for real in the worktree produced files that compile; only the expected registry error remained.
- **Checklist**: `docs/diagram-families.md` covers each stage, where it lives, and what guards it. It is linked from the diagram-core and generators READMEs and from the generator output, and the test requires every stage to be documented there.
- **Unsupported families are not advertised**: `sketchi generate --type` now accepts only `flowchart|mindmap|sequence`, and its help and README no longer list ER, architecture, swimlane, or state-machine. Prompts for those kinds still fail with the typed `unsupported_diagram_type` instead of being coerced. A changeset is included.

## Why

#280 asks that the next family can't skip a required stage without a test noticing, and that the extension path be documented. Before this, the structure test checked only three files, and the family lists were hand-maintained in several packages.

## Verification

- `pnpm nx affected -t typecheck,test --base=origin/main` (18 projects), `pnpm run test:tools` (211 tests), `pnpm run check`
- CLI help snapshots refreshed from a rebuilt bundle. The CLI audit now pins decoding through the agent registry.
- The generator spec compiles and runs the scaffold. The promise-site ratchet is unchanged.

Refs #280

## Review follow-ups

- **Generate API:** `apps/playground/src/server/generation/request.ts` (no server-only import) derives the request schema's `type` literals from `CANONICAL_DOCUMENT_TYPES` plus `UnsupportedDiagramIntentKindSchema.literals`. It gates with `isCanonicalDocumentType` and builds the error copy from the registry; the wording is unchanged.
- **CLI wizard:** choices come from `GENERATION_TYPE_CHOICES`, which must cover every `GenerationType` (`satisfies Record<…>`), listed in registry order.
- **Prompt:** both refusal sentences are built from `UnsupportedDiagramIntentKindSchema`, and the generated prompt text is identical. `DiagramGenerationTypeSchema` moved into `intent.ts` beside the unsupported kinds.
- **Pipeline test:** two new stages, "generate API request" and "CLI generate type". "CLI document dispatch" now runs the real CLI `DiagramBuilder`. "Generation prompt" asserts the prompt never lists a supported family as unsupported. The checklist is updated to match.
@graphite-app
graphite-app Bot force-pushed the feat/sequence-extension-path branch from d1df28c to 69561ff Compare October 11, 2026 01:50
…ng unsupported types (#379)

## What changed

- **Family pipeline test** (`tools/diagram-families.test.ts`, run in CI by `pnpm run test:tools`). For every family in `DIAGRAM_TYPES`, it runs one named test per stage:
  - core contract and fixture
  - deterministic renderer
  - Excalidraw conversion
  - generation prompt
  - generation output parsing (round-trips the fixture through `candidateFromText`)
  - Code Mode build
  - CLI document dispatch
  - maintained scenarios
  - Storybook story

  A family missing a stage fails as `<family>: <stage>`. With a scratch family registered, all nine of its stages fail by name, and core stops compiling.
- **One family registry per layer, derived from `DIAGRAM_TYPES`:**
  - generation: the supported-kind list, prompt text, `IR_INSTRUCTIONS`, `FAMILY_EXAMPLES`, and the native-kind check
  - diagram-agent `documents.ts`: `CANONICAL_DOCUMENT_SPECS`, `CanonicalDiagramDocument`, `buildCanonicalDocument`, and `canonicalDocumentFromDiagram`
  - the CLI's document decoder and builder
  - the generate API, whose three local converters and build ternary are deleted

  `satisfies Record<DiagramTypeValue, …>` and exhaustive switches make a missing entry a compile error.
- **Generator**: `diagram-type` registers the family in `DIAGRAM_TYPES` and `GRAPH_DIAGRAM_TYPES`. It scaffolds a compilable Effect Schema contract with validation and a parser, a core test, a renderer test via `renderDiagram`, and a story. It then prints the remaining stages and points at the checklist. Running it for real in the worktree produced files that compile; only the expected registry error remained.
- **Checklist**: `docs/diagram-families.md` covers each stage, where it lives, and what guards it. It is linked from the diagram-core and generators READMEs and from the generator output, and the test requires every stage to be documented there.
- **Unsupported families are not advertised**: `sketchi generate --type` now accepts only `flowchart|mindmap|sequence`, and its help and README no longer list ER, architecture, swimlane, or state-machine. Prompts for those kinds still fail with the typed `unsupported_diagram_type` instead of being coerced. A changeset is included.

## Why

#280 asks that the next family can't skip a required stage without a test noticing, and that the extension path be documented. Before this, the structure test checked only three files, and the family lists were hand-maintained in several packages.

## Verification

- `pnpm nx affected -t typecheck,test --base=origin/main` (18 projects), `pnpm run test:tools` (211 tests), `pnpm run check`
- CLI help snapshots refreshed from a rebuilt bundle. The CLI audit now pins decoding through the agent registry.
- The generator spec compiles and runs the scaffold. The promise-site ratchet is unchanged.

Refs #280

## Review follow-ups

- **Generate API:** `apps/playground/src/server/generation/request.ts` (no server-only import) derives the request schema's `type` literals from `CANONICAL_DOCUMENT_TYPES` plus `UnsupportedDiagramIntentKindSchema.literals`. It gates with `isCanonicalDocumentType` and builds the error copy from the registry; the wording is unchanged.
- **CLI wizard:** choices come from `GENERATION_TYPE_CHOICES`, which must cover every `GenerationType` (`satisfies Record<…>`), listed in registry order.
- **Prompt:** both refusal sentences are built from `UnsupportedDiagramIntentKindSchema`, and the generated prompt text is identical. `DiagramGenerationTypeSchema` moved into `intent.ts` beside the unsupported kinds.
- **Pipeline test:** two new stages, "generate API request" and "CLI generate type". "CLI document dispatch" now runs the real CLI `DiagramBuilder`. "Generation prompt" asserts the prompt never lists a supported family as unsupported. The checklist is updated to match.
@graphite-app
graphite-app Bot force-pushed the feat/sequence-evals branch from d32a18f to 81b0d52 Compare October 11, 2026 01:56
@graphite-app
graphite-app Bot force-pushed the feat/sequence-extension-path branch from 69561ff to 6cc6b39 Compare October 11, 2026 01:56
Base automatically changed from feat/sequence-evals to main October 11, 2026 01:58
@graphite-app
graphite-app Bot merged commit 6cc6b39 into main Oct 11, 2026
4 checks passed
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:59 Active
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:59 Active
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:59 Active
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:59 Active
@graphite-app
graphite-app Bot deployed to production October 11, 2026 01:59 Active
@graphite-app
graphite-app Bot deleted the feat/sequence-extension-path branch October 11, 2026 01:59
@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 Web Preview

Status: deleted

@github-actions

Copy link
Copy Markdown
Contributor

Sketchi Eval Harness Preview

Status: deleted

@github-actions github-actions Bot mentioned this pull request Oct 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Sketchi Playground / Studio Preview

Status: deleted

This branch was successfully deployed

2 active deployments
staging — 6cc6b391 Deployed Oct 11, 2026 by graphite-app[bot] via cleanup-preview (playground) #448
production — 6cc6b391 Deployed Oct 11, 2026 by graphite-app[bot] via deploy (icons) #125
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