Repository navigation
feat(diagram): enforce the diagram family pipeline and stop advertising unsupported types - #379
Merged
Merged
Conversation
anandpant
marked this pull request as ready for review
October 10, 2026 22:23
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
This was referenced Oct 10, 2026
Collaborator
Author
anandpant
force-pushed
the
feat/sequence-evals
branch
from
October 11, 2026 00:37
e6e209c to
cade1fa
Compare
anandpant
force-pushed
the
feat/sequence-extension-path
branch
from
October 11, 2026 00:37
efba349 to
bfa41d0
Compare
anandpant
force-pushed
the
feat/sequence-evals
branch
from
October 11, 2026 01:39
cade1fa to
c8a6b97
Compare
anandpant
force-pushed
the
feat/sequence-extension-path
branch
from
October 11, 2026 01:39
6373afd to
d1df28c
Compare
Merge activity
|
graphite-app
Bot
force-pushed
the
feat/sequence-evals
branch
from
October 11, 2026 01:50
c8a6b97 to
d32a18f
Compare
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
Bot
force-pushed
the
feat/sequence-extension-path
branch
from
October 11, 2026 01:50
d1df28c to
69561ff
Compare
…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
Bot
force-pushed
the
feat/sequence-evals
branch
from
October 11, 2026 01:56
d32a18f to
81b0d52
Compare
graphite-app
Bot
force-pushed
the
feat/sequence-extension-path
branch
from
October 11, 2026 01:56
69561ff to
6cc6b39
Compare
Contributor
Sketchi Icons PreviewStatus:
|
Contributor
Sketchi Excalidraw Workspace PreviewStatus:
|
Contributor
Sketchi Web PreviewStatus:
|
Contributor
Sketchi Eval Harness PreviewStatus:
|
Merged
Contributor
Sketchi Playground / Studio PreviewStatus:
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What changed
Family pipeline test (
tools/diagram-families.test.ts, run in CI bypnpm run test:tools). For every family inDIAGRAM_TYPES, it runs one named test per stage:candidateFromText)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:IR_INSTRUCTIONS,FAMILY_EXAMPLES, and the native-kind checkdocuments.ts:CANONICAL_DOCUMENT_SPECS,CanonicalDiagramDocument,buildCanonicalDocument, andcanonicalDocumentFromDiagramsatisfies Record<DiagramTypeValue, …>and exhaustive switches make a missing entry a compile error.Generator:
diagram-typeregisters the family inDIAGRAM_TYPESandGRAPH_DIAGRAM_TYPES. It scaffolds a compilable Effect Schema contract with validation and a parser, a core test, a renderer test viarenderDiagram, 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.mdcovers 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 --typenow accepts onlyflowchart|mindmap|sequence, and its help and README no longer list ER, architecture, swimlane, or state-machine. Prompts for those kinds still fail with the typedunsupported_diagram_typeinstead 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 checkRefs #280
Review follow-ups
apps/playground/src/server/generation/request.ts(no server-only import) derives the request schema'stypeliterals fromCANONICAL_DOCUMENT_TYPESplusUnsupportedDiagramIntentKindSchema.literals. It gates withisCanonicalDocumentTypeand builds the error copy from the registry; the wording is unchanged.GENERATION_TYPE_CHOICES, which must cover everyGenerationType(satisfies Record<…>), listed in registry order.UnsupportedDiagramIntentKindSchema, and the generated prompt text is identical.DiagramGenerationTypeSchemamoved intointent.tsbeside the unsupported kinds.DiagramBuilder. "Generation prompt" asserts the prompt never lists a supported family as unsupported. The checklist is updated to match.