Skip to content

[V2:12] Add Static Preview Runtime - #26

Open
ritorhymes wants to merge 9 commits into
eips-wg:masterfrom
ritovision:v2/12-static-preview-runtime
Open

[V2:12] Add Static Preview Runtime#26
ritorhymes wants to merge 9 commits into
eips-wg:masterfrom
ritovision:v2/12-static-preview-runtime

Conversation

@ritorhymes

@ritorhymes ritorhymes commented May 5, 2026

Copy link
Copy Markdown
Contributor

Part of V2: Multi-repo local build system.

Summary

This PR adds build-eips preview as a static server for already-built output, distinct from the source-preparing serve runtime. Preview reuses the resolved build path and server binding from the execution policy, accepts --host/--port, and serves <resolved build path>/output directly with safe request path resolution, directory-index fallback, method handling, content types, and clear missing-output errors. It does not prepare sources, run eipw, preprocess markdown, invoke Zola, or start dirty/theme sync, and it rejects --base-url, --clean, and targeted preview forms, so review should focus on preview's static-only contract, build-path selection, static-file safety, and CLI rejection rules.

  • Add build-eips preview for serving already-built output without rebuilding.
  • Reuse server binding resolution and support preview --host/--port.
  • Serve <resolved build path>/output directly from the selected build path.
  • Report a clear error when the preview output directory is missing.
  • Add a tiny_http static file server with GET/HEAD handling, method errors, bad-request handling, not-found responses, and content-type headers.
  • Add safe request path resolution with directory index fallback and parent traversal rejection.
  • Add preview CLI, execution-policy, and static path tests.

Review Notes

This PR adds a separate static preview runtime. Unlike serve, preview does not prepare sources, run eipw, preprocess markdown, invoke Zola, or start dirty/theme sync. It only serves the existing output directory for the resolved execution policy.

Preview uses the same resolved build path and server binding model introduced by V2:08 and extended by V2:11. CLI --host/--port values override workspace [server] config and defaults in the same way as serve.

--build-root can change the build path preview reads from, but preview does not prepare or render output.

Preview intentionally does not accept --base-url or --clean. It is a local static file server for already-built output, not another build mode.

The command checks that <resolved build path>/output exists before binding the server. If output is missing, users are told to run build-eips build for the selected build path first.

The static server rejects path traversal, maps /foo/ to /foo/index.html, prefers /foo/index.html for extensionless /foo, and falls back to /foo when no index file exists.

This PR remains independent from targeted rendering. Targeted build/serve behavior lands later in V2:15-V2:16.

Verification

  • Review src/cli.rs for the preview command, preview --host/--port, rejected --clean, and rejected --base-url.
  • Review src/main.rs for preview dispatch before build-root creation, locking, source preparation, or dirty sync.
  • Review src/execution.rs for preview being treated as a non-site runtime command that does not require workspace-local source or theme setup.
  • Review src/preview.rs for missing output checks, server binding, request method handling, safe path resolution, file selection, content types, and response handling.
  • Review Cargo.toml and Cargo.lock for the tiny_http dependency.
  • Review preview tests for slash paths, extensionless paths, file fallback, missing paths, and parent traversal rejection.

@ritorhymes
ritorhymes force-pushed the v2/12-static-preview-runtime branch 4 times, most recently from 1a4cfac to 95dae8e Compare May 9, 2026 20:10
@ritorhymes
ritorhymes force-pushed the v2/12-static-preview-runtime branch from 95dae8e to e96e6e7 Compare May 26, 2026 01:02
@ritorhymes
ritorhymes force-pushed the v2/12-static-preview-runtime branch from e96e6e7 to 89f3e81 Compare June 21, 2026 22:41
Add workspace-local `.build-eips.toml` loading and starter configuration. Introduce `config::ActiveRepo` to load the selected checkout’s `Build.toml`, validate explicit `-C` roots, and expose active repository context to later commands. Keep source materialization, initialization, and diagnostics in their owning later branches.
Add clean and dirty source materialization for the active repository and sibling content. Use `config::RepositoryUse` throughout the runtime path, preserve tracked working-tree materialization and `index_path`, and reject dirty active manifests in clean modes. Build, check, and serve prepare sources without fetching the active upstream; `changed` retains upstream fetching for comparison.
Add workspace initialization from the selected active `Build.toml`. Clone missing sibling repositories from declared locations and initialize a missing theme checkout from the manifest repository and pin. Preserve existing usable checkouts and fail without deleting unusable paths. Write `.build-eips.toml` only when absent and generate `WORKSPACE.md` for the initialized workspace.
Add `build-eips doctor` for validating workspace configuration, active `Build.toml`, managed sibling repositories, the local theme checkout, and required tools. Report ok/warn/fail diagnostics; invalid active manifests and unusable theme configuration fail, while expected sibling and theme-pin conditions can warn. Keep diagnostics read-only and leave execution and runtime behavior to later branches.
Resolve build, check, and serve source policy around local active sources, clean mode, remote siblings, build roots, and base URL precedence. Keep `--clean` and `--remote-siblings` as source controls and limit `--only` to supported local dirty modes. Route runtime commands through one resolved execution policy.
Run Zola with the editable `workspace/theme` checkout. Materialize tracked local theme files into prepared `themes/eips-theme`, load Zola and eipw configuration from that local checkout, and keep runtime commands independent of manifest network access.
Add prepared runtime build pipeline. Materialize active and sibling sources according to resolved execution policy, preprocess merged proposal content, prepare the local theme mount, and invoke runtime checks and rendering from `pipeline.rs`. Keep serve watch and sync behavior in the serve runtime branch.
Add server binding resolution and serve-only host/port flags for local Zola serve commands.

Run Zola serve with the resolved server binding, optional base URL override, fast/force serve flags, and generated output directory.

Add dirty serve watching for dirty active-repo paths and local theme changes. Clean mode disables active-repo sync but keeps theme sync.
Add build-eips preview for serving the existing resolved output directory without rebuilding or starting dirty sync.

Reuse server binding resolution and preview-only host/port flags, and report missing output before binding the local server.

Add a tiny_http static file server with safe path resolution, index-file fallback, basic content types, and preview path tests.
@ritorhymes
ritorhymes force-pushed the v2/12-static-preview-runtime branch from 89f3e81 to 3107a1f Compare July 18, 2026 06:44
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.

1 participant