Skip to content

M1 PR-7 (demo side): governed Generate view#5

Merged
ryandmonk merged 1 commit into
claude/inspiring-bartik-07ada9from
feat/demo-generate-view
Jul 2, 2026
Merged

M1 PR-7 (demo side): governed Generate view#5
ryandmonk merged 1 commit into
claude/inspiring-bartik-07ada9from
feat/demo-generate-view

Conversation

@ryandmonk

Copy link
Copy Markdown
Contributor

What this is

The demo half of PR-7 of Milestone 1 — stacked on #4 (retarget to main after #4 merges). The pipeline half (dspack-gen serve, NDJSON events, Playwright gate) lives in the dspack-gen repo.

A Generate (governed) view in the existing catalog-ingesting demo app, driven by dspack-gen serve over localhost NDJSON:

  1. Input bar — prompt ("a screen to delete my account"), intent (destructive-action), model reference (ollama:<tag> | anthropic:<id>; IDs are configuration, per the amended ADR-9), and a fake pipeline toggle running the server's deterministic scripted adapter (golden violating fixture → worked example) — the same backend the Playwright gate drives.
  2. Attempt panels — gate strip S1/S2/S3; findings with rule id, location, message, and the contract's rationale verbatim; on a clean attempt the S3 card explicitly lists every applicable rule as satisfied ("verified by the governance linter, not assumed from prompt steering" — the review directive's exact requirement).
  3. Repair panel — the exact repair message sent (rendered from the same findings object; ADR-7).
  4. Emitter gates — A1/A2/A3 chips per A2UI version.
  5. Outcome — the emitted surface rendered off the generated catalog through @a2ui/react v0.9.1 with dspack tokens driving the theme; audit report v1 download. Failures render honestly with no surface.

Also includes the base-branch fix (pushed to #4): the emitted surface root now carries id root — the A2UI render entry point. Found by the render step: gates A1–A3 don't check ids, so only rendering caught it.

Verify

# terminal 1 (dspack-gen checkout)
npx tsx src/cli.ts serve            # or with a live model behind it
# terminal 2 (this repo)
npm --prefix demo install && npm --prefix demo run dev
# open the app → Generate (governed) → fake pipeline → Generate

Machine gate: npm run demo:e2e in dspack-gen (Playwright, fake adapter) — lands with the dspack-gen side of PR-7.

ADRs: 2, 4, 5, 7, 8, 9.

🤖 Generated with Claude Code

demo Generate view driven by `dspack-gen serve` (localhost NDJSON):
- input bar: prompt / intent / model (ollama:<tag> | anthropic:<id>) /
  fake-pipeline toggle (the deterministic scripted adapter the Playwright
  gate drives)
- per-attempt panels: gate strip S1 surface-schema / S2 contract-vocabulary /
  S3 governance; findings with rule id, location, message, and the
  contract's rationale VERBATIM; on a clean attempt the S3 card lists every
  applicable rule as satisfied — verified by the linter, not assumed from
  prompt steering
- the exact repair message sent (rendered from the same findings object)
- emitter gate strip A1/A2/A3 per A2UI version
- outcome panel: the emitted surface rendered off the generated catalog via
  @a2ui/react v0.9.1 (dspack tokens driving the theme), audit report v1
  download; failures render honestly with no surface

Verified in-browser: fake pipeline shows violation → repair → all gates
green → AlertDialog renders and opens with cancel-before-confirm.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 2, 2026 16:56

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

Adds a new “Generate (governed)” view to the demo app that connects to dspack-gen serve over localhost NDJSON, replays the governed pipeline steps (S1–S3 + repair + A1–A3), renders the emitted A2UI surface, and allows downloading the audit report.

Changes:

  • Introduces GenerateView UI that streams and renders pipeline events from dspack-gen serve.
  • Adds a view switcher in the demo app to toggle between existing surface previews and the governed Generate view.

Reviewed changes

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

File Description
demo/src/GenerateView.tsx New governed Generate view: NDJSON streaming client, attempt/gate/finding panels, A2UI rendering, audit report download.
demo/src/App.tsx Adds navigation to the Generate view and conditionally renders it alongside the existing surfaces view.

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

Comment thread demo/src/GenerateView.tsx
Comment on lines +94 to +104
for (;;) {
const { done: eof, value } = await reader.read();
if (value) buffer += decoder.decode(value, { stream: true });
const lines = buffer.split("\n");
buffer = lines.pop() ?? "";
for (const line of lines) {
if (line.trim()) setEvents((prev) => [...prev, JSON.parse(line) as PipelineEvent]);
}
if (eof) break;
}
} catch (e) {
Comment thread demo/src/GenerateView.tsx
Comment on lines +72 to +76
const rendered = useMemo(() => {
if (!done?.surfaceMessages) return null;
const processor = new MessageProcessor<ReactComponentImplementation>([ingested.catalog], async () => {});
processor.processMessages(structuredClone(done.surfaceMessages.messages) as any);
const model = Array.from(processor.model.surfacesMap.values())[0];
Comment thread demo/src/GenerateView.tsx
Comment on lines +268 to +271
a.href = URL.createObjectURL(blob);
a.download = "audit-report.json";
a.click();
URL.revokeObjectURL(a.href);
Comment thread demo/src/App.tsx
Comment on lines +72 to 75
const [view, setView] = useState<"surfaces" | "generate">("surfaces");
const [surfaceKey, setSurfaceKey] = useState<string>("access");
const [surface, setSurface] = useState<AnySurface | null>(null);
const [actions, setActions] = useState<A2uiClientAction[]>([]);
@ryandmonk ryandmonk merged commit 22872ce into claude/inspiring-bartik-07ada9 Jul 2, 2026
2 checks passed
ryandmonk added a commit that referenced this pull request Jul 2, 2026
…07ada9

Land the Generate view on main (#5 merged into its stacked base)
@ryandmonk ryandmonk deleted the feat/demo-generate-view branch July 5, 2026 02:35
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