SentryQA: Visual QA and Authoring Architecture for Frontend
TypeScript monorepo with 5 packages. Dev-only Vite plugin injecting runtime in Shadow DOM, capturing metadata with Zod, persisting Markdown in filesystem, exposing MCP stdio for agents.
Technical Architecture
This document was automatically translated from Spanish by AI and may contain errors. The original Spanish version is the authoritative source.
SentryQA is a TypeScript monorepo organized in 5 packages with clear roles and well-defined dependencies. The main flow is: CLI init → Vite plugin → Runtime in Shadow DOM → Core models → Markdown persisted.
Monorepo Structure
Package Manager
volta for runtime version lockingPackage Dependencies
`@sentryqa/core`
Responsibility: Deterministic schemas, Markdown codec, rectangle geometry, anchors (DOM locators), context formatting for AI.
Key exports:
models.ts — All Zod schemas (Issue, Selection, Viewport, Target, etc.)codec.ts — serializeIssueMarkdown() / parseIssueMarkdown()geometry.ts — rectSchema, containment/overlap calculationsanchors.ts — Robust selector generation (id, class, structural)formatter.ts — formatAiContext() for clipboardHardcoded limits in models.ts:
`@sentryqa/runtime`
Responsibility: Framework-agnostic runtime in Shadow DOM, UI (toolbar, panel, markers), DOM capture, Layout/Wireframe mode.
Key exports:
boot.ts (195KB) — Runtime bootstrapping, Shadow DOM mountingcapture.ts — Element/region capture with privacy sanitizationstore.ts — Local state, issue filtering, revision managementlayout-runtime.ts — Layout/Wireframe runtime with abstract blocksoverlay.ts / overlay-visual.ts — Overlay rendering in Shadow DOMmarkers.ts — Visual markers (#1, #2...) re-anchoring on reloadFramework adapter pattern:
`@sentryqa/react`
Responsibility: Optional React adapter using React Fiber to enrich metadata:
Main export:
The adapter is version-gated: only activates when it detects compatible React. If it fails, it degrades to mode: 'lexical'.
`@sentryqa/vite`
Responsibility: Dev-only Vite plugin that:
data-sentryqa-componentKey exports:
plugin.ts — Main Vite plugin with sentryQa()transform.ts — JSX transform injecting metadatastorage.ts — Filesystem bridge (read/write issues)middleware.ts — Bridge request validation and boundsgit.ts — Reading branch, commit, dirty statuswatcher.ts — Watching .sentryqa/ with coalescingPlugin API:
Transform JSX (simplified):
`sentryqa` (CLI)
Responsibility:
npx sentryqa init — Automatic stack detection, plugin injectionsentryqa mcp — MCP stdio exposure for Layout Mode to agentsInit command:
MCP stdio for Layout Mode:
End-to-End Data Flow
Init → Development
Issue Capture
Layout Mode → MCP
Architecture Decisions
Shadow DOM for Isolation
The runtime is mounted in a Shadow DOM host to:
Zod for Deterministic Validation
All data crossing bridges (filesystem → runtime, MCP → layout-store) passes through strict Zod schemas:
Benefits:
Issue type derived from schemamax(), min(), regex() prevent DoSMarkdown as Source of Truth
The persisted issue is Markdown YAML frontmatter:
Why Markdown:
parse() ↔ serialize() idempotentPrivacy-First Design
Multiple layers of protection:
data-sentryqa-redact / data-sentryqa-ignoreOptional React Fiber Adapter
The React adapter is decoupled from runtime:
This allows:
Testing Strategy
Unit Tests (Vitest)
Integration Tests
E2E Tests (Playwright)
Acceptance Suite
Executes:
Monorepo Scripts
Limits and Bounds
Limits are in @sentryqa/core/models.ts and apply to all bridges:
| Concept | Limit |
|---|---|
| Blocks in Layout | 32 |
| Prompt length | 4_000 chars |
| Artifact bytes | 256 KiB |
| Wireframe depth | 8 levels |
| Wireframe children per block | 16 |
| Selector max length | 512 chars |
| DOM path depth | 32 elements |
| Styles whitelisted | 32 properties |
| DOM snippet truncated | 400 chars |
| Layout session assets | 32 items |
This prevents:
Technical Roadmap
MVP (Current)
Future (post-MVP)
Conclusion
SentryQA is a well-structured TypeScript monorepo with 5 packages with clear roles, minimal dependencies, explicit bounds, and solid testing coverage. The architecture prioritizes:
For recruiters: this project demonstrates experience with TypeScript monorepos, Vite plugin development, Shadow DOM, React Fiber internals, testing automation, and design of bounded privacy-first APIs.