feat(showcase): Monaco-based Artifact Workbench#96
Conversation
…ench - Add showcase/app/src/lib/sampleArtifacts.ts with deterministic v1-alpha.1 shaped data - Add showcase/app/src/components/ArtifactCodePanel.tsx (Monaco read-only viewer) - Add showcase/app/src/components/ArtifactWorkbench.tsx (left rail + center editor + right summary)
…Workbench section - Add @monaco-editor/react and monaco-editor to showcase/app/package.json - Add Artifact Workbench nav item and section to main.tsx - Section uses ArtifactWorkbench component, no existing sections disturbed
- tests/test_artifact_workbench_showcase.py - Validates sampleArtifacts.ts structure (no rawPrompt, required fields present) - Validates ArtifactCodePanel.tsx is read-only by default - Validates ArtifactWorkbench.tsx contains artifact list, summary, schema/hash fields - Uses existing pytest approach; no new test framework added
✅ Deploy Preview for comptext-v7 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request introduces an 'Artifact Workbench' to the showcase application, enabling users to inspect compressed replay artifacts through a three-panel interface. Key additions include a Monaco-based code panel, a workbench component for navigation and summaries, and static sample data. The reviewer feedback highlights several opportunities for improvement: optimizing performance using useMemo, hardening the JSON serialization logic against null values, replacing hardcoded CSS heights with more flexible Flexbox layouts, and addressing the brittleness of the Python-based static validation tests by suggesting a move toward AST-based or component-level testing.
| function prettyJson(value: unknown): string { | ||
| return JSON.stringify(value, Object.keys(value as Record<string, unknown>).sort(), 2); | ||
| } |
There was a problem hiding this comment.
The prettyJson function is currently fragile. It will throw a TypeError if value is null or undefined because Object.keys requires an object. Additionally, the current sorting logic only applies to top-level keys. For a more robust deterministic output, consider adding a type guard and ensuring it always returns a string.
function prettyJson(value: unknown): string {
if (value === null || value === undefined || typeof value !== 'object') {
return JSON.stringify(value, null, 2) ?? '';
}
const keys = Object.keys(value as Record<string, unknown>).sort();
return JSON.stringify(value, keys, 2);
}
| """Static validation tests for the Artifact Workbench showcase components. | ||
|
|
||
| These tests parse the TypeScript/TSX source files as text to assert structural | ||
| properties that must hold without running a browser or Node environment. | ||
| No new test framework is introduced; existing pytest approach is used. | ||
| """ |
There was a problem hiding this comment.
The current testing strategy of parsing TypeScript source files as raw text to assert structural properties is extremely brittle. Minor changes in code formatting, such as switching between single and double quotes or adjusting indentation, will cause these tests to fail despite the logic being correct. Consider using a proper AST-based linter or component-level unit tests (e.g., using Vitest/React Testing Library) for better long-term maintainability.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary
Adds a polished Monaco-based Artifact Workbench to the Comptextv7 showcase. Reviewers can inspect compact replay artifacts in a read-only JSON editor with a structured summary panel — without storing giant raw prompts, without a database, and without any external API calls.
Changed Files
showcase/app/package.json@monaco-editor/react ^4.7.0andmonaco-editor ^0.52.2showcase/app/src/main.tsxWorkbenchnav item +#workbenchsection usingArtifactWorkbenchshowcase/app/src/components/ArtifactCodePanel.tsxshowcase/app/src/components/ArtifactWorkbench.tsxshowcase/app/src/lib/sampleArtifacts.tsv1-alpha.1; noDate.now, noMath.random, norawPrompttests/test_artifact_workbench_showcase.pyWhat Was Added
ArtifactCodePanel.tsx@monaco-editor/react<Editor>readOnly = trueby defaultlanguageprop:json | markdown | typescript | plaintextheightproptheme="vs-dark", minimap disabled, wordWrap onreadOnly={false}is explicitly passedArtifactWorkbench.tsxsampleArtifacts, selection viauseStateArtifactCodePanelrenders pretty-printed deterministic JSON of selected artifactartifactId,schemaVersion,artifactHash(truncated with full value on hover),executionId, fingerprint count,validationStatusbadge,latestMode,triggeredWindows,unmappedStepIds, fulltimelineSummary#0d1117,#0a0e17), muted blue accent (#3b82f6), thin#1e2533borders, no neon, no glowsampleArtifacts.tsartifact-c7-001(pass),artifact-c7-002(warn),artifact-c7-003(fail)artifactId,schemaVersion,executionId,createdAt,manifest,timelineSummary,compressionSignals,referenceIndex,eventFingerprints,artifactHashDate.now, noMath.random, norawPrompttest_artifact_workbench_showcase.pyTestSampleArtifacts: required fields present, noDate.now, noMath.random, norawPromptTestArtifactCodePanel: uses Monaco, read-only default, no external fetch, minimap disabledTestArtifactWorkbench: three panels viadata-testid, all summary fields,useStateselection,JSON.stringifyfor pretty-print, norawPromptTestMainIntegration:#workbenchsection present, existing sections intactpytestapproach usedValidation
Commands to verify:
npm run layout npm run typecheck npm run build npm test npm run checkKnown pre-run requirement:
npm installmust be run inshowcase/appto fetch@monaco-editor/reactandmonaco-editorbeforetypecheckandbuildwill pass.Risks
monaco-editoradds ~2–4 MB to the Vite build bundle. This is expected and acceptable for a showcase; no tree-shaking optimization was applied.@monaco-editor/react ^4.7.0requires React 16.8+; the repo uses React 19 ✓prettyJsonhelper usesObject.keyssort for deterministic output; deeply nested object key ordering is stable for the currentsampleArtifactsshape.package-lock.jsonis not updated in this PR — it must be regenerated locally vianpm installinshowcase/app.Next
npm install && npm run buildinshowcase/applocally to regeneratepackage-lock.jsonand confirm bundle sizevite-plugin-monaco-editoror@monaco-editor/loaderCDN config if bundle size is a concernArtifactWorkbenchto real committed artifact JSON files fromartifacts/replay/once the schema stabilizes