Skip to content

Latest commit

 

History

History
107 lines (56 loc) · 22.6 KB

browser-guide.md

File metadata and controls

107 lines (56 loc) · 22.6 KB

Embedded Browser Guide

Implemented boundary

fcd serves an authenticated workspace with default read-only sessions and a separately published public project website from the same origin as its API. It displays project identity, paginated workers and basic jobs, explicit full job briefs and checkpoint details, worker inboxes and explicit conversation pages, plus the native review workspace for stored queue, PR/run history, findings and fix proof. Incoming messages update through the persistent message stream. Reads never mark messages seen or acknowledged, edit jobs or contact GitHub. The existing development dashboard remains separate until replacement and migration proof are complete.

Anonymous /public/{slug} routes load only approved content, without a private browser connection; projects are private by default. The browser design owns the broader target. The project map adds compact workstream/return-point lists, explicit current and historical editorial snapshots, and deliberately loaded recorded job references. Project presentation and live metadata add explicit project settings and a separate scoped feed for project settings and affected jobs, workers, notes, map/reference and current stored review views, with packaged proof at that owner. Explicit browser messaging and administrator appearance controls use the separate opt-in session authority; incoming-message events keep their independent worker scope. Latest checkpoint display and explicit archives passed the focused API tests and actual packaged browser checks described below. Empty presentation overrides preserve the default fire palette and dense responsive layout; configured themes use the validated semantic palette. A small repository attribution remains in the footer.

Connect and navigate

Run fcd, open its printed loopback address and enter a project ID and a credential with read access to that project. Obtain these through the existing project setup API; this slice does not add an onboarding wizard. Each connection verifies the service instance and selected project before loading project data.

The credential is used in memory to verify the instance and project and establish a browser session. By default, the session is read-only; the unchecked connection option keeps every credential read-only. The browser then discards the credential and clears the password field. The service supplies an encrypted HttpOnly cookie with a 24-hour absolute lifetime; the raw API credential is absent from that cookie, URLs, browser storage and query-cache keys. Explicitly enabling message and appearance changes grants only the selected browser actions, within the original credential and current grants.

Per-tab sessionStorage retains only the versioned instance/project binding, random session selector, expiry and selected worker ID. It contains no API credential, messages or job content. Reload revalidates the saved binding, preserves the current project detail route and restores the selected worker after reading the current worker list. Independent tab selectors prevent connections to different projects from replacing each other's cookies. An ordinary reload or component teardown closes requests without logging out. New connections keep up to eight sessions for this instance within its cookie-size budget, expiring the oldest retained sessions when necessary; an evicted tab asks to connect again. This bounds cookies left by closed tabs.

Disconnect, expired or revoked access, an instance mismatch, or leaving the connected project clears the saved binding and cached data and attempts to expire that session's cookie. A transient network failure preserves the binding for an explicit reconnect. The original credential and project grants are checked on reads and live-stream authorization; revocation therefore terminates access before the cookie's expiry. Reconnect with a credential after expiry or terminal authorization failure. The browser session API owns the transport and cookie contract.

Routes are /projects/{project_id}, /projects/{project_id}/jobs/{job_id}, /projects/{project_id}/workers, /projects/{project_id}/workers/{worker_id}, /projects/{project_id}/notes, /projects/{project_id}/notes/{note_id}, /projects/{project_id}/notes/{note_id}/history/{revision}, /projects/{project_id}/inbox and /projects/{project_id}/inbox/{conversation_id}, /projects/{project_id}/reviews, /projects/{project_id}/reviews/pulls/{number}, /projects/{project_id}/reviews/runs/{run_id}, /projects/{project_id}/map, /projects/{project_id}/map/entries/{entry_id} and /projects/{project_id}/map/entries/{entry_id}/history/{revision}. Review drill-down links retain an optional snapshot query for historical consistency. Choose a worker to follow its incoming inbox. Worker changes cancel the prior view's requests and subscription and clear its cache; they do not alter credentials, assignments or server state. Project-scoped read access permits conversation reads within that project, as documented by the API.

Job detail reads the latest checkpoint, including its captured revision, attribution, done/next/blocker and evidence. No-checkpoint state is explicit. The current brief and latest envelope are separate reads: a revision mismatch prompts refresh rather than implying an atomic combined snapshot. Checkpoint history loads only after opening it and remains cursor-paged; closing it stops that active view. Evidence is escaped plain text rather than an executable or automatically opened link.

Native run details include an explicit Assess captured comparison panel for the current local review requirements. Opening it reads the captured-comparison assessment; closing cancels its request, and reopening reads again. Imported history has no assessment control. The panel shows the returned captured target and observation time separately from policy evaluation; it does not verify current GitHub source, CI or merge readiness. Closed panels and ordinary queue reads perform no assessment request.

Job details also show the current read-only ordered checklist, with explicit controls for narrative updates and checklist history. Archives load one page only when opened; closing cancels that view and removes it from refresh, and reopening reads current stored data. Brief/checklist revision differences prompt a refresh without hiding the standing brief. Progress text and evidence remain escaped plain text.

“Refresh visible data” rereads only active stored-data queries. There is no timer-based JSON polling, focus-triggered refresh or provider refresh. The project feed invalidates affected jobs, workers, notes, map/reference and current stored review views. It cancels pre-event reads before refetching active views, marks inactive views stale without opening them and coalesces overlapping changes within a page. Captured historical review snapshots and immutable individual revisions remain fixed. Incoming messages retain their separate worker-scoped feed; each indicator describes its own connection. An expired project replay cursor refreshes current visible project views from a new watermark before replay resumes.

Live delivery and failures

The browser takes an atomic inbox snapshot and its event cursor, then opens authenticated same-origin fetch SSE. Cursor advancement follows successful application to the view. Committed events invalidate relevant active inbox/conversation reads; transport keepalive comments do not trigger reads or appear as activity.

Ordinary API reads share a five-second budget per operation. Stream connection headers have a five-second budget; an established stream stays open with its own cancellation signal. The parser bounds frames to 1 MiB and validates UTF-8, scope, metadata shape and cursor identity. It rejects malformed events rather than exposing arbitrary response text.

After a transient disconnect, the view shows reconnecting and retries stream attachment at capped delays of one, two, four and ten seconds. The last processed cursor survives those attempts in memory. Expired replay requires a fresh snapshot before resubscribing. Access errors terminate delivery and clear the session. A stream with no traffic for 45 seconds is reattached; routine server keepalives keep a healthy idle connection open. Canceling or disconnecting never acknowledges messages.

Project, worker and connection nonce scope query keys. Old-context results cannot populate a new view. Returned text is escaped by React; the app accepts no raw HTML, external images, inline scripts or unrestricted styles. Embedded responses set a same-origin content security policy. Unknown API paths and unavailable assets remain JSON errors rather than receiving application HTML.

Build and packaging

The client uses React, TypeScript, React Router’s data router and TanStack Query. Vite builds a client-only application; there is no Node server at runtime. Exact dependency versions and the browser lockfile are committed in webapp/.

Install both lockfiles and run the repository checks:

npm ci --ignore-scripts --no-audit --no-fund
npm --prefix webapp ci --ignore-scripts --no-audit --no-fund
make check build

Use Node.js 22.22 or newer for development. make check type-checks the app and runs focused API/SSE tests alongside Go race/vet and documentation checks. make build regenerates internal/webui/assets and embeds them in fcd. CI rebuilds the assets and rejects tracked differences or new untracked output.

Renovate cannot run the build, so the Renovate browser assets workflow rebuilds assets when same-repository Renovate PRs change the webapp manifests. GitHub loads the pull_request workflow definition from the PR merge ref. The read-only build job checks out the event’s exact PR head SHA. The write job checks out the PR head branch, verifies its tip matches that SHA and commits only regular generated files or removals within internal/webui/assets/. It pushes with RENOVATE_ASSETS_TOKEN, a fine-grained token limited to this repository with contents write, so CI starts on the regenerated head. With the GITHUB_TOKEN fallback, a maintainer with write access must select Approve workflows to run on the PR for the regenerated head. Renovate ignores the asset commit when deciding whether it may rebase.

Commit the generated index, fingerprinted JavaScript/CSS and bundled third-party licenses with their source changes. Source maps and package manifests are not served. Bundled notices are available at /third-party-licenses.txt.

Committed assets allow direct go build ./cmd/fcd or go install without Node; these commands use the checked-in browser build rather than regenerating it. The development Vite proxy targets 127.0.0.1:8080; Vite results do not substitute for embedded-service browser proof.

Proof and limits

At the original packaged-browser checkpoint identified by the source and binary hashes below, make check build passed: TypeScript, nineteen browser tests, Go race tests/vet, nineteen documentation checker tests and asset generation. The nineteen-browser-test count belongs to that historical checkpoint, rather than the current expanded suite. Go handler tests cover canonical routes, MIME/cache headers, HEAD, unsupported methods, traversal, safe errors and restricted embedded files. Browser tests cover bounded scoped API responses, incremental SSE parsing, cancellation/replay/authorization failures, and event refresh while the first read is pending.

Seven actual packaged-service Chromium groups passed on Linux/WSL. They exercised connection/authentication, explicit job/conversation reads, live incoming messages, worker/project switches with held old responses, a committed reply arriving during the first conversation read, real service stop/restart and resumed delivery, and 390-pixel phone/deep-link layouts. The delayed first response could not swallow or overwrite the reply; a fresh read displayed it without another event. Desktop and phone screenshots were visually inspected after correcting headline spacing and attribution layout.

The run observed 46 browser requests, 40 API requests and six stream attachments across intentional selections and restart. There were zero browser mutations, JavaScript/CSP errors or horizontal overflow. A settled connection made zero JSON requests during a 16.2-second idle window and kept one active stream. Credentials stayed out of browser storage and URLs; synthetic HTML-like bodies remained literal text. Browser reads used read-only grants, with durable message/seen/ack state checked around intentional fixture mutations. Setup alone used public GitHub repository verification; no direct provider-call counter was measured, so the no-provider-work boundary also relies on the inspected local read handlers.

The complete 79-file Go/module/browser/config/lock/generated-asset manifest was unchanged before/after this run: SHA-256 ca9360ee46f1f23be8df1072b7c91f5c2282be9b2aba9f18c35df6e6c2af0075. The binary hash was e93015a74d894d5b836331c3e2aaa85513ade64bddca448f45a92ec79c108b05. This identifies tested source bytes rather than implying proof for later edits. The run used Playwright 1.64.1 with an available Chromium 153.0.8010.12 headless shell; that cached browser differs from the driver's preferred revision. Disposable state and owned processes were removed.

The original browser checks above do not establish remote TLS deployment, session persistence, a public projection, native platform browser coverage, accessibility conformance or fleet throughput. Subsequent remote deployment proof is recorded in hosting. Independent tab bindings do not synchronize worker selection across tabs. Credentials remain private connection material; the browser session does not install credentials in the operating system.

Checkpoint browser proof

The checkpoint addition passed the full repository checks/build, including twenty-five browser tests, and reproduced its embedded assets. Four actual browser groups then passed against the packaged service with isolated state: explicit no-checkpoint state; an older captured revision beside the unchanged current brief; exact content/evidence/attribution and escaped HTML-like evidence; lazy archive loading with actual 20+1 cursor pages; a separate fixture append followed by manual refresh; and 390px latest/archive layouts. Six screenshots were inspected. Seventeen browser GETs produced zero browser mutations, external requests, page/CSP errors, credential persistence or horizontal overflow. Archive requests remained absent until opened and stopped while closed. Independent database counts matched the single intended fixture append, with current jobs/history/messages unchanged.

The 90-file Go/browser/config/embedded-asset digest was 0816a5eca380d82f9e77d25a4716464cb2d2536829d0dd20a9b1ca97556bd407; the 71-file Go/module digest was 68910c9b52247f7aa590ee8bd1ec87b35762dfd95e8ce13bfe51c161d52b886a. These and the actual service executable hash remained unchanged throughout; disposable service/browser/state were cleaned. The held-latest cross-read revision race was not run in this pass, so it does not establish an atomic combined job/checkpoint snapshot. Existing platform, model-host and fleet limitations still apply.

Review browser proof

The native review addition passed the integrated build with thirty-two browser tests and three actual browser groups, including explicit empty state, retained merged queue history, lazy PR/run/finding detail, source limits, unknown attempt duration, historical snapshot links, safe literal HTML and 390px layouts. The review workspace records exact tested manifests, request counts and limits. This historical review-browser checkpoint predates the project-metadata feed. That historical checkpoint used explicit stored-review refresh; the current project feed updates affected active views as described above.

The subsequent channel-history correction replaces the mixed last-three summary with compact Hosted/CLI rows and all retained rounds in chronological order; manual/subagent evidence stays separate. It reads native summaries only for nonempty histories. Packaged API/browser checks passed again; the workspace proof records the source/binary digests and limits.

Browser coordination views

Worker and note views provide explicit pause/focus reads and histories, project-scoped pending notes with filters, selected full bodies and immutable revisions. Worker and job pages link to scoped notes. These remain read-only and update through scoped project changes or the visible-data refresh; opening a note does not change its status. The owning contract records their separate validation and remaining limits.

Browser session validation

The session addition passes TypeScript and seventy-five focused browser tests, including cookie-only finite/SSE requests, strict connection/logout response validation, bounded failures, fresh resume after cancellation, corrupt/expired/mismatched storage rejection, transient reconnect retention and removal of stale worker metadata after a failed save. Real SQLite/handler race tests cover read-only sessions derived from read/write/admin credentials, project and tab isolation, expiry, tampering, ambiguous authentication, same-origin checks, public-proxy cookie flags, restart continuity and original credential revocation. Short-heartbeat message-stream tests verify that expiry and revoked grants end delivery and release subscriber capacity. Connect and logout do not change domain records or invoke providers.

These focused checks do not by themselves establish packaged React lifecycle behavior or deployment correctness. Hands-on reload, route/worker restoration, disconnect and remote HTTPS checks must use the packaged service; report their tested source and results with the release rather than treating the earlier browser runs as proof of later session changes.

Captured-comparison browser proof

Clean checkpoint 041de12166cac06d55092a09eacd2194f117780d passed actual packaged-service Chromium checks at 1440px and 390px in 7.307 seconds. Native run details made no assessment request until explicitly opened; manual refresh updated only open assessments, closing suppressed further reads, and reopening fetched current policy. A completed but unfinalized hosted capture showed held; explicit fixture decisions, finalization and fix proofs produced sufficient coverage. Pausing execution preserved that credit, while additionally requiring CLI showed held with the missing channel. Imported history exposed no native assessment control. The panel retained the captured comparison boundary without claiming current source, CI or merge readiness.

Closing an assessment with its actual HTTP response held produced net::ERR_ABORTED; the late response could not restore the result. All browser read groups preserved logical SQLite contents and provider-call counts. The run observed 110 browser requests, including 12 explicit assessment GETs; browser writes were limited to two session creations and two disconnections. Finding controls and policy changes ran separately through fixture clients. Ten screenshots were inspected with no JavaScript/CSP or HTTP errors, horizontal overflow, interpreted source markup or credential persistence. Original captures, current PR metadata and imported merged history remained intact.

All 283 source/assets/documentation manifest entries and the packaged client/service executable hashes remained unchanged; the tested fcd SHA-256 was ca4b67b9f9c8625e7c8ebd546aff3675d73388850d2b1fed4b554b51b0f83dc7. Disposable processes and state were removed. Controlled TLS provider responses and local Git objects supplied setup evidence, with no live external provider calls. This establishes the embedded panel's local desktop and phone-width behavior, not physical-phone coverage, live account/quota behavior, remote deployment, fleet throughput or operational cutover. The short interaction windows do not independently establish long-duration polling behavior.

Explicit changes and uncertain results

At connection, leave Enable message and appearance changes unchecked for a read-only view. Enable it deliberately with a write credential to send/reply and use recipient Mark seen and Acknowledge controls. Reading alone changes neither state. Administrator-enabled sessions also show Settings for the full project presentation. Settings edits use the observed revision and preserve another editor's changes through visible conflicts; they never publish private appearance to the approved public website.

Action controls keep the original key, body and selected worker after an uncertain response. Use the offered exact retry rather than submitting another action. Recovery details stay in this tab's memory; message drafts and keys are not stored in browser storage. Route and worker changes inside the project retain unresolved intents. Leaving the project or disconnecting asks before discarding unresolved work, and reload/close uses the browser's unsaved-work warning. Confirming that discard or closing the process loses the local recovery context; it does not cancel or reverse a committed server action. Completed actions do not require this warning. Permission/recipient refusal leaves readable views available.

Clean combined checkpoint 8ad178f384769204af73dcdaba0fc3cd55443410 passed full make check build: 261 browser tests, all Go race tests, vet, documentation checks, generated assets and three binaries. Actual packaged CLI/MCP/upgrade/publication checks then passed in 0.604 seconds and packaged private/public Chromium checks in 4.557 seconds. These cover explicit messaging and appearance edits, reload, a committed response lost after submission, navigation/remount recovery and an original-key retry returning the same single message. The public workload also uses a real gzip proxy. The clean packaged daemon SHA-256 was 10d6fff7313443c01fe24de4aa1cf5a34e15ab7a2b817e532112ff5bde1cddbf; sources/assets stayed unchanged. The initial combined run exposed a test request sent to a different host from its session cookie; correcting that fixture preserved the strict forbidden-operation assertion. Installed deployment, physical-phone coverage, fleet qualification and cutover remain separate. The owning browser contract describes the selected boundary.