feat(preview): starting state with clock, size and Hugo output; startedAt; Hugo before the startup sync #366

Merged
dominik.polakovics merged 1 commit from afk/362 into main 2026-11-01 02:27:40 +01:00

Closes #362

What changes

Preview pane, state starting (web/src/components/PreviewPane.tsx)

  • Shows the styleguide's centered state (.center, .center__box, .center__mark): an hourglass mark and the "Starting Hugo…" heading.
  • Shows the elapsed time since startedAt, ticking each second ("12 s", "2 min 05 s"). A start time in the future reads 0 s. With no startedAt (an older harness) there is no clock.
  • Shows the page count once the tree has loaded ("2,573 pages", "2.573 Seiten"), formatted by the new i18n formatNumber.
  • After 10 s it adds one sentence that the first build takes a while (en + de).
  • Below, the tail of Hugo's output, scrolled to the last line. It uses .preview-output, the one class the crash panel now shares (it was .crash-panel__output).
  • The page count comes from countPages in pagemanage.ts, next to countDescendants. It counts nodes whose path is not empty.

GET /api/status gains hugo.startedAt

  • The time the current Hugo process was launched, as RFC3339 in UTC with milliseconds, or "" before the first launch.
  • The supervisor sets it under mu at each launch, so a restart after a crash moves it forward, even within the same second.
  • It is a new per-field signal in the client store.

harness serve order

  • New order: media root, then sup.Start, then startupSync, then the forge client, then listen.
  • I checked Hugo 0.167.0 (the version the scaffold ships, not 0.161.1 as the issue says). commands/server.go (*serverCommand).Run calls newWatcher (l.503) before c.build() (l.514). An event that arrives during the build waits on the build lock, so a sync that moves the checkout causes a rebuild.

Docs: docs/api.md (GET /api/status), docs/harness.md "Serving", docs/architecture.md "Branch mode".

Proof

  • go vet ./... && go test ./...: green. All four tests below were also run against a real Hugo 0.167.0 extended:
    • TestIntegrationChangeDuringFirstBuildRebuilds: a home template holds the first build on a stalled resources.GetRemote, the content changes mid-build, and the test asserts "Change detected", state running with the new content, and no build error.
    • TestStartedAtPerLaunch
    • TestStartHugoThenSyncLaunchesHugoFirst: a fake hugo has launched by the time the sync logs its first line.
    • TestStatusStartedAt
  • cd web && npm test: 141 files, 3482 tests pass. Covers the clock, a reload continuing from startedAt, a future time reading 0 s, the page count, the hint before and after 10 s in en and de, and the output tail. tsc --noEmit and npm run build are clean.

Notes

  • Page count language: it counts the tree the module context holds, which is the current editor language. The issue asked for the default-language tree, but only one tree is loaded, and on first start these are normally the same.
  • Output block colours: .preview-output still uses the --gray-900 / --gray-200 primitives the crash panel used. tokens.css has no semantic token for a code surface yet, so I did not invent one.
  • Copied rules: .center* is copied into styles.css with the styleguide's numbers, like the other shared rules there, because styles.css does not import components.css yet.
  • Startup sync and .gitignore: Hugo now runs while the startup sync commits, so .hugo_build.lock and resources/ exist during the commit. The scaffold's .gitignore covers both, and POST /api/git/sync on a running editor already had this exposure.
  • Skills and AGENTS.md: neither needed a change. AGENTS.md "Startup, in order" doesn't mention the sync, and preview-site doesn't read the new field.

🤖 Generated with Claude Code

Closes #362 ## What changes **Preview pane, state `starting`** (`web/src/components/PreviewPane.tsx`) - Shows the styleguide's centered state (`.center`, `.center__box`, `.center__mark`): an hourglass mark and the "Starting Hugo…" heading. - Shows the elapsed time since `startedAt`, ticking each second ("12 s", "2 min 05 s"). A start time in the future reads 0 s. With no `startedAt` (an older harness) there is no clock. - Shows the page count once the tree has loaded ("2,573 pages", "2.573 Seiten"), formatted by the new i18n `formatNumber`. - After 10 s it adds one sentence that the first build takes a while (en + de). - Below, the tail of Hugo's `output`, scrolled to the last line. It uses `.preview-output`, the one class the crash panel now shares (it was `.crash-panel__output`). - The page count comes from `countPages` in `pagemanage.ts`, next to `countDescendants`. It counts nodes whose `path` is not empty. **`GET /api/status` gains `hugo.startedAt`** - The time the current Hugo process was launched, as RFC3339 in UTC with milliseconds, or `""` before the first launch. - The supervisor sets it under `mu` at each launch, so a restart after a crash moves it forward, even within the same second. - It is a new per-field signal in the client store. **`harness serve` order** - New order: media root, then `sup.Start`, then `startupSync`, then the forge client, then listen. - I checked Hugo 0.167.0 (the version the scaffold ships, not 0.161.1 as the issue says). `commands/server.go` `(*serverCommand).Run` calls `newWatcher` (l.503) before `c.build()` (l.514). An event that arrives during the build waits on the build lock, so a sync that moves the checkout causes a rebuild. **Docs**: `docs/api.md` (GET /api/status), `docs/harness.md` "Serving", `docs/architecture.md` "Branch mode". ## Proof - `go vet ./... && go test ./...`: green. All four tests below were also run against a real Hugo 0.167.0 extended: - `TestIntegrationChangeDuringFirstBuildRebuilds`: a home template holds the first build on a stalled `resources.GetRemote`, the content changes mid-build, and the test asserts "Change detected", state `running` with the new content, and no build error. - `TestStartedAtPerLaunch` - `TestStartHugoThenSyncLaunchesHugoFirst`: a fake hugo has launched by the time the sync logs its first line. - `TestStatusStartedAt` - `cd web && npm test`: 141 files, 3482 tests pass. Covers the clock, a reload continuing from `startedAt`, a future time reading 0 s, the page count, the hint before and after 10 s in en and de, and the output tail. `tsc --noEmit` and `npm run build` are clean. ## Notes - **Page count language:** it counts the tree the module context holds, which is the current editor language. The issue asked for the default-language tree, but only one tree is loaded, and on first start these are normally the same. - **Output block colours:** `.preview-output` still uses the `--gray-900` / `--gray-200` primitives the crash panel used. `tokens.css` has no semantic token for a code surface yet, so I did not invent one. - **Copied rules:** `.center*` is copied into `styles.css` with the styleguide's numbers, like the other shared rules there, because `styles.css` does not import `components.css` yet. - **Startup sync and `.gitignore`:** Hugo now runs while the startup sync commits, so `.hugo_build.lock` and `resources/` exist during the commit. The scaffold's `.gitignore` covers both, and `POST /api/git/sync` on a running editor already had this exposure. - **Skills and AGENTS.md:** neither needed a change. AGENTS.md "Startup, in order" doesn't mention the sync, and preview-site doesn't read the new field. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(preview): a starting state with clock, size and Hugo's output; startedAt on the status; Hugo before the startup sync
All checks were successful
ci / build-and-test (pull_request) Successful in 5m19s
ci / release (pull_request) Has been skipped
bb5cb1293f
While Hugo builds, the preview pane shows the styleguide's centered state:
the heading, the elapsed time since the current run started (from the new
GET /api/status hugo.startedAt, so it survives a reload; clamped to 0), the
tree's page count once loaded, a "first build takes a while" sentence past
10 s, and the tail of Hugo's output in the block the crash panel shares.

The supervisor records each launch's time; the status reports it as
RFC3339 UTC to the millisecond, "" before the first launch.

serve starts Hugo before the branch-mode startup sync and still listens
after it. Hugo 0.167.0 arms its watcher before the first build
(commands/server.go Run), so a checkout the sync moves is rebuilt; an
integration test proves a change during the first build is followed by
"Change detected" and the new content.

Closes #362

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Author
Owner

[autoland] verdict: pass

[autoland] verdict: pass
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/deckle!366
No description provided.