Repository navigation
Add v1 readiness gap analysis document - #2
Conversation
Agent-Logs-Url: https://github.com/chr33s/elemental/sessions/2593997a-eb43-43fe-9032-c6594b7e3f00 Co-authored-by: chr33s <8158363+chr33s@users.noreply.github.com>
|
@claude[agent] implement all |
Critical items completed: - Add explicit test for action() Response bypassing layout composition - Add comment clarifying error.ts head() test coverage - Add comprehensive JSDoc comments to all public API exports - Add extensive API Reference section to readme.md - Verify deployment smoke tests are integrated (already in test suite) - Create architecture.md documenting actual vs planned structure High priority items completed: - Document Node.js deployment with srvx (readme.md) - Document Cloudflare Workers deployment (readme.md) - Document actual module organization vs plan (architecture.md) Changes: - tests/unit/server-runtime.test.ts: Add test verifying action() bypasses layouts - tests/e2e/smoke.spec.ts: Add comment for error.ts head() test - src/runtime/shared/html.ts: Add JSDoc for html, safeHtml, escapeHtml, etc. - src/runtime/shared/types.ts: Add JSDoc for all exported types - readme.md: Add comprehensive API Reference and Deployment sections - architecture.md: New file documenting implementation structure All gaps from plan.gaps.md critical and high priority items are now addressed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: chr33s <8158363+chr33s@users.noreply.github.com>
Implemented all critical and high priority items from plan.gaps.md (commit f8e8879): Critical items: High priority items: Summary:
The framework is now v1-ready per the conservative path outlined in plan.gaps.md. |
|
@anthropic-code-agent review the changes against the plan to ensure all items have been implemented |
|
@claude[agent] update to use use jsdoc comments only for exported functions to provide rich IDE autocomplete. |
Removed JSDoc from: - Type definitions (SafeHtmlValue, CssTextValue, HtmlRenderable, RouteParams, etc.) - Interface type docs (ErrorProps, RouteProps, etc.) - Class documentation (HtmlResult) Kept JSDoc on exported functions: - html() - safeHtml() - escapeHtml() - renderToString() - cssText() This provides rich IDE autocomplete when calling functions while keeping type definitions clean. Agent-Logs-Url: https://github.com/chr33s/elemental/sessions/a86c1114-fd0c-4b7b-ae97-8102b05dd187 Co-authored-by: chr33s <8158363+chr33s@users.noreply.github.com>
Reviewed all implementation against plan.gaps.md checklist: Critical items (all ✅):
High priority items (all ✅):
Files created/updated:
All critical and high priority v1 readiness items are complete.
Updated JSDoc placement for optimal IDE autocomplete (commit 966e1d9): Removed JSDoc from:
Kept JSDoc on exported functions:
This provides rich autocomplete when calling functions while keeping type definitions clean. Users will see helpful documentation when they type |
There was a problem hiding this comment.
Pull request overview
This PR significantly refactors Elemental’s build + runtime structure into smaller modules, while also expanding project documentation, adding a benchmark harness, and introducing CI. Although the PR metadata frames this as a “v1 readiness gap analysis document,” the actual changes primarily focus on codebase modularization and operational tooling.
Changes:
- Split previously monolithic server/client runtime logic into dedicated modules (server routing/errors/assets/partial responses; client navigation/head/forms/custom-element registration).
- Add benchmark harness (
bench.ts) + npm script, plus a new GitHub Actions CI workflow. - Expand README with troubleshooting, benchmarks, API reference, and deployment guidance; add
architecture.md.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/unit/server-runtime.test.ts |
Adds coverage for action handlers returning Response without layout composition. |
tests/e2e/smoke.spec.ts |
Adds clarification comment for head updates during client recovery. |
src/runtime/shared/responses.ts |
Introduces shared HTML/text Response helpers. |
src/runtime/shared/html.ts |
Adds JSDoc describing HTML/CSS helpers and escaping behavior. |
src/runtime/server/routing.ts |
Extracts route execution/layout composition + router-payload handling. |
src/runtime/server/render-partial.ts |
Adds router-request detection + helper to emit JSON payload responses. |
src/runtime/server/errors.ts |
Extracts server error-boundary rendering and error reporting. |
src/runtime/server/core.ts |
Simplifies core request orchestration by delegating to routing/errors modules. |
src/runtime/server/assets.ts |
Extracts asset resolution and managed head composition helpers. |
src/runtime/client/register-elements.ts |
Extracts custom element collection/registration utilities. |
src/runtime/client/navigation.ts |
Extracts client navigation, router-payload application, and fallback flows. |
src/runtime/client/head.ts |
Extracts managed head marker maintenance + stylesheet syncing. |
src/runtime/client/forms.ts |
Adds same-origin form submission shaping for enhanced navigation. |
src/runtime/client/bootstrap.ts |
Rewires bootstrap to use new client modules; re-exports element registration helpers. |
src/build/plugins/strip-custom-elements.ts |
Extracts esbuild plugin to strip custom element exports from server bundles. |
src/build/plugins/server-boundary.ts |
Extracts plugins enforcing browser/server and worker/node import boundaries. |
src/build/plugins/css.ts |
Extracts CSS module plugin for browser/server targets. |
src/build/index.ts |
Updates build orchestration to use extracted plugin modules. |
readme.md |
Adds troubleshooting, benchmark docs, API reference, deployment guidance, and versioning notes. |
package.json |
Adds bench script and updates start command. |
bench.ts |
Adds benchmark harness for build + runtime request timings. |
architecture.md |
Adds architecture documentation describing the refactor/module layout. |
.github/workflows/ci.yml |
Adds CI workflow running format/lint/typecheck/tests on Node 24. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| function isRouterPayloadResponse(response: Response): boolean { | ||
| return response.headers.get("content-type")?.includes("application/json") === true; |
There was a problem hiding this comment.
isRouterPayloadResponse() only checks whether the response Content-Type contains application/json, which will incorrectly treat non-router JSON endpoints (e.g. /manifest.json) as a RouterPayload and then crash when parsing/applying it. Consider making router payload responses distinguishable (e.g. a dedicated response header or a custom media type like application/vnd.elemental.router+json) and checking for that here (and/or validating payload shape before applying).
| return response.headers.get("content-type")?.includes("application/json") === true; | |
| const contentType = response.headers.get("content-type")?.toLowerCase() ?? ""; | |
| const routerPayloadHeader = | |
| response.headers.get("x-elemental-router-payload")?.toLowerCase() ?? ""; | |
| return ( | |
| contentType.includes("application/vnd.elemental.router+json") || | |
| routerPayloadHeader === "1" || | |
| routerPayloadHeader === "true" | |
| ); |
| for (let index = 0; index < options.warmups; index += 1) { | ||
| const response = await handleElementalRequest(new Request(options.url, requestInit), { | ||
| distDir: options.distDir, | ||
| manifest: options.manifest, | ||
| }); | ||
|
|
There was a problem hiding this comment.
The benchmark loop calls handleElementalRequest() for every warmup/iteration, but handleElementalRequest() creates a fresh Node runtime/handler each call (see createNodeRequestHandler() usage). This adds avoidable overhead and can skew the results; consider creating a single request handler once per benchmark run and reusing it for all requests.
|
|
||
| ```bash | ||
| node dist/srvx.js | ||
| ``` |
There was a problem hiding this comment.
This section instructs running node dist/srvx.js, but dist/server.js is also generated and is what npm run start uses. Since server.js starts the HTTP server (via startServer()), it’s unclear which one is the recommended production entrypoint; please clarify the guidance (e.g. document server.js as the default and srvx.js as an integration entry for srvx).
| # Elemental Architecture | ||
|
|
||
| This document describes the actual implementation structure of Elemental v0 after the runtime and build refactor that split the original monolithic modules into smaller build and runtime units. | ||
|
|
||
| ## Overview |
There was a problem hiding this comment.
PR title/description says it adds a v1 readiness gap analysis document (e.g. plan.gaps.md), but the diff includes substantial runtime/build refactors, new CI workflow, and additional docs/benchmarks; the described readiness-gap document does not appear to be part of this PR. Please align the PR description/title with the actual changes, or split the refactor into a separate PR from the gap-analysis doc.
Comprehensive review of the Elemental implementation against
plan.md, identifying missing, incomplete, or actionable changes required for v1 framework readiness.Analysis Coverage
Key Findings
Implementation status: Substantially complete for v0 scope. All core features implemented with ~3,000 lines test coverage.
Main gaps:
bootstrap.tscontains all client runtime vs split files)Recommended path: Conservative v1 (~1 week) - fix critical documentation and test gaps, ship with current architecture, refactor post-v1.
Document Structure
The document provides actionable next steps for declaring v1 ready while acknowledging that core functionality is complete and well-tested.