Skip to content

Latest commit

 

History

History
192 lines (129 loc) · 30.4 KB

development.md

File metadata and controls

192 lines (129 loc) · 30.4 KB

Development

Implemented boundary

fc version and fc context are local commands: they contact no service or provider and write no configuration. context validates a selected profile and returns its configured identity, excluding the credential reference. It does not verify server identity, authenticate, or establish a connection. The coordination slice also implements the loopback fcd service, scoped projects/workers and access grants, basic jobs with revision history, and durable messages with explicit seen/acknowledgment. These operations are available through the local API. The profile-bound CLI implements the read commands and explicit-key mutations documented below. The embedded browser consumes the same API and persistent message stream, with session-authorized messaging and administrator appearance controls. Job checkpoints implement guarded progress records, latest reads and explicit archives. The optional native CLI/hosted review pipelines, private operator catalog and bound agent tools are described in review execution, including their executed proof and live-provider limits. Local operator backup bundles and inactive restore and managed scheduling, retention and read-only operator status are implemented with full checks and packaged proof. Narrative updates and checklist state are available through the same API and agent clients. Optional primary-job focus is available through bound API/client/CLI/MCP operations. Worker pause and deferred notes have API/client/CLI/MCP implementations; each owner records executed proof and remaining boundaries. Job resume context combines current state and selected pending coordination through an explicit read; its owner records validation status. The quiet message wait provides one bounded CLI/MCP subscription per call; across-turn host delivery remains unproved.

Build and checks

Use Go 1.27, Node.js 22.22 or newer, Make and a C compiler such as gcc on Linux/WSL. The race-enabled make check requires cgo enabled; CGO-free make build needs no C compiler:

npm ci --ignore-scripts --no-audit --no-fund
npm --prefix webapp ci --ignore-scripts --no-audit --no-fund
make check build
make smoke
./bin/fc version
./bin/fcd --data-dir /private/firecontroller --listen 127.0.0.1:8080

make check validates the workflow with pinned actionlint and the CI selector, type-checks the browser, runs its focused API/SSE tests, verifies Go formatting, runs all Go tests with the race detector using at most two concurrent packages and the existing twenty-minute per-package timeout, runs go vet, and checks documentation. make build regenerates the embedded browser assets and produces CGO-free fc, fcd and fcmcp binaries. make smoke runs the built daemon, CLI and MCP binaries together in a private synthetic fixture, checking bootstrap, exact mutation replay, bounded stream cancellation, same-session reuse and restart. It never rebuilds the binaries; the packaged smoke guide owns its budgets and proof limits. The MCP guide describes its local stdio tool interface. CI also cross-compiles Windows amd64 and macOS arm64 and runs the packaged workload on native Windows/macOS runners. CI runs source/browser checks, complementary Go race slices, packaged qualification and native smoke independently. The CI selector assigns every discovered package and top-level test, example and fuzz seed to its slice without dropping race coverage; subtests stay with their parent. The required validate result uses always() and requires every family, including both native runners, to succeed. Failed, cancelled and skipped families cannot pass. GO_TEST_PACKAGES and GO_TEST_RUN permit explicit local slices; their defaults preserve complete make test coverage. Build, packaged/browser/offsite smoke commands, runner permissions, cache settings and existing runtime deadlines remain unchanged. The packaged smoke guide records actual native outcomes and remaining limits; cross-compilation alone is not runtime proof. Go's GO and GOFMT Make variables can select a locally installed toolchain. The browser guide documents committed asset verification and direct Go builds without Node.

CI supersedes older runs for the same PR or push branch and uses twenty shared job slots. The CI scheduling contract owns the workflow policy, queue limits and rollout verification.

On Linux, install the Chromium revision for the pinned Playwright dependency and run make browser-smoke for the separate actual embedded-browser lifecycle check. The packaged smoke guide owns setup, budgets and limitations. CI runs both executable smoke targets after the build.

Explicit browser coordination views read worker pause/focus and note current/history data without mutation or automatic archive expansion.

Private profile file

Use the local profile setup commands to create a private configuration and optional POSIX bound launcher. Setup returns the configured identity with verified: false; doctor performs the separate authenticated check. Creation requires explicit profile selectors, preserves existing files, and never provisions or reads credentials.

The default file is firecontroller/profiles.json under the OS user configuration directory. Linux honors an absolute XDG_CONFIG_HOME, otherwise $HOME/.config. Windows uses APPDATA; macOS uses $HOME/Library/Application Support. An unavailable or relative default directory fails rather than selecting a file from the working directory. An explicit --profiles-file PATH overrides the file location. CLI and MCP use one shared resolver. Windows prefers the exact APPDATA spelling and selects a stable case variant only when it is absent; neither interface depends on map iteration order. The shared resolver table passed on Linux and in a native Windows Go test executable; this is focused path-selection proof, not a new claim about Windows filesystem isolation.

Store this file outside the tracked checkout with permissions suitable for private configuration:

{
  "version": 1,
  "profiles": {
    "project-builder": {
      "server_url": "http://127.0.0.1:8080",
      "instance_id": "instance-local",
      "project_id": "project-example",
      "worker_id": "builder",
      "credential_file": "credentials/builder.token"
    }
  }
}

The configuration must be a regular file containing valid UTF-8 and strict JSON with known, exactly cased fields and unique keys, at most 1 MiB. The CLI checks file kind before opening and again before reading; FIFO, device, and directory inputs fail with profiles_not_regular. Malformed UTF-8 bytes and unpaired Unicode surrogate escapes fail with profiles_invalid_encoding before JSON decoding can repair identity text. Valid surrogate pairs, Unicode literals (including U+FFFD), and escaped-backslash literal text remain valid. All configured profiles currently require valid nonempty identity fields and a credential-file reference. Remote URLs require HTTPS; HTTP is restricted to literal loopback addresses or localhost. URLs cannot contain embedded credentials, queries, or fragments. The local context command validates the credential reference as required text and never resolves or opens it. Service commands resolve a relative reference against the profile file directory and load a bounded owner-private regular credential file; they never evaluate shell or environment expressions.

fc --profiles-file /private/profiles.json --profile project-builder context

An explicit profile overrides the per-process FC_PROFILE default. There is no persisted active profile. The response contains only profile, server_url, instance_id, project_id, and worker_id; these are local configuration, not verified server facts. Success uses compact JSON on stdout. Failures use a stable code, message, and next action as JSON on stderr with clean stdout. Exit codes are 0 for success, 2 for arguments or invalid operation options, 3 for local configuration/credential/output failures, 4 for instance mismatch or conflicts, 5 for connection/service failure or the service deadline, and 6 for explicit caller/signal cancellation. Mutation recovery uses the caller's explicit idempotency key.

Proof and limits

Focused tests cover interleaved project identities with the same worker name on both shared and distinct service instances, explicit flag precedence, unchanged configuration/environment, absent credential files, strict malformed/ambiguous configuration, malformed raw UTF-8 identity bytes, unpaired surrogate escapes in identities and profile names, preservation of valid Unicode and escape text, unsafe URLs, relative default directories, non-regular configuration paths, and concise errors without private values. Linux tests exercise default-path behavior and FIFO rejection through a deadline-bounded child process, so a missing file-kind guard cannot hang the suite. The file-kind checks address accidental unsupported inputs; they do not protect against hostile same-user filesystem replacement races or establish a deadline for arbitrary filesystem I/O. Native Windows explicit/default APPDATA profile lookup, valid Unicode and quiet configuration errors passed; broader platform/filesystem guarantees remain outside this proof. The agent contract owns the broader target, including instance verification and authenticated mutations.

Coordination service proof

Public HTTP tests exercise bootstrap/restart identity, private credentials, project grants and revocation, stable verified repository binding, strict request parsing, project/principal/filter cursor isolation, retained idempotency receipts, revision races, and atomic domain/history/event writes. Basic job and message operations perform no provider work. A repository resolver is injected for those tests; live GitHub behavior is not claimed by the offline suite. Packaged Linux startup and shutdown checks cover readiness, authenticated instance inspection and domain route registration.

SQLite uses WAL, FULL synchronization and foreign keys on local storage. Write admission is bounded to two seconds, busy timeout is zero, and contention returns overloaded without an automatic retry. Explicit project creation verifies GitHub identity outside transactions with a five-second provider deadline; exact retained retries avoid that call. These bounds and focused tests do not establish fleet throughput or a production latency budget. Basic native Windows bootstrap, health/readiness, authenticated instance inspection and reopening the same durable instance passed after correcting drive-path file URIs. These checks do not establish Windows domain operations or filesystem access-control guarantees. The packaged smoke guide records newer Windows/macOS runner coverage. Power-loss durability, off-host backup durability, operational disaster cutover and hostile same-user filesystem isolation remain unproven. Executed local backup/restore checks and their limits are recorded in backup proof.

Domain startup migrations have a separate operator-configurable per-domain budget, defaulting to 30 seconds and bounded at 24 hours. The daemon applies it through an immutable store-open option without changing the two-second live write budget. Focused fake-time tests exercise default expiry after partial work, rollback of schema and version metadata, identical work completing on an explicit longer-budget retry, per-domain budget renewal, cancellation and repeat-startup no-ops. A synthetic retained-history test includes 131 finalized capture-bearing native operations across the 128-operation backfill page boundary, compares complete source rows and canonical proofs, and refuses a corrupt last capture after deriving the preceding full page. Daemon tests reject invalid durations before state creation and refuse a failed schema before listening. These are controlled local contract checks, not fleet throughput, live upgrade or deployment proof.

Read-only agent commands

Supply FC_PROFILE through the agent host's process environment or select --profile explicitly. Profiles remain private, per-process bindings; selecting one never changes another agent's identity. Relative credential paths resolve against the profile file, independent of the command working directory.

Command Returned scope
fc doctor Verified instance/project/worker binding, without credentials or a PR scan.
fc workers list One compact active-worker page in the bound project; --include-retired also includes retired workers.
fc jobs context JOB_ID [--limit N] Complete current brief/checkpoint/checklist plus bound-worker focus/pause and pending previews, explicit omissions, continuation cursors and incoming-event watermark.
fc notes read NOTE_ID One full current note.
fc notes list One compact pending page for the bound worker and its currently assigned jobs; explicit scope/filter flags narrow or broaden selection.
fc notes history NOTE_ID One compact immutable-revision page.
fc notes revision NOTE_ID REVISION One full selected revision.
fc workers pause-state Bound worker’s explicit pause, reason and independent revision.
fc workers pause-history One explicit bounded pause-history page.
fc jobs list One compact job page; optional worker/status filters.
fc jobs primary Bound worker’s compact primary-job selection and independent revision.
fc jobs primary-history One explicit bounded page of primary-job changes.
fc jobs assigned One compact page filtered to the bound worker; optional status filter.
fc jobs read ID Explicit full job detail and brief.
fc jobs history ID Explicit bounded revision-history page.
fc jobs checkpoint-latest ID Explicit latest checkpoint with current job revision, or an explicit null checkpoint.
fc jobs checkpoints ID Explicit newest-first checkpoint archive page.
fc jobs updates ID Explicit newest-first narrative-update page.
fc jobs checklist ID Current ordered checklist, its revision and the current job revision.
fc jobs checklist-history ID Explicit newest-first full checklist revision page.
fc reviews execution Stored project execution configuration and revision; no provider check.
fc reviews operations One compact newest-first page of retained operations, default five pending; --all includes terminal and held history.
fc reviews operation ID Compact retained status, stage and next action; --diagnostics returns the full retained operation.
fc reviews queue Stored review queue; defaults to five compact PR entries.
fc reviews pull NUMBER Explicit PR summary and attempt history; optional --snapshot.
fc reviews runs NUMBER Stored run summaries, default five; optional --snapshot.
fc reviews run ID Explicit full findings, decisions and fix evidence; optional --snapshot.
fc inbox list Bound worker's compact message previews; optional unread/unacknowledged filters.
fc inbox thread ID Explicit bounded conversation page with full bodies.

Project management also supports prepared review import through fc reviews import-preview --file ABSOLUTE_PATH and fc reviews import-apply --file ABSOLUTE_PATH --preview SHA256 --key KEY. Preview is provider-free and read-only; apply uses the existing guarded observation receipt. Select a profile with the owning contract's project-management or instance-administration authority; ordinary project read/write permission is insufficient.

Review queue/run lists accept --limit and --cursor; omitted limits select five entries. Review selectors validate before credentials or HTTP, and reads perform no provider refresh or review execution. Source timestamps and completeness remain observations, not readiness.

List/history/thread reads accept --limit and --cursor; jobs accept --status, and jobs list also accepts --worker. Assigned jobs are a compact assignment list, without primary-job, checkpoint or full resume-context claims. Reads never change seen/ack state, job status or configuration. Unknown flags, repeated options and unsupported commands fail before credential loading or network work.

Service calls use bounded identity recovery before dispatch, with up to ten seconds for bootstrap and five seconds for ordinary reads under the caller's deadline. Each scoped request carries the expected instance and bound worker; the server rejects a replacement instance before exposing data. The reusable typed client rejects redirects, invalid Unicode/duplicate or incomplete JSON, contradictory pagination and oversized responses. Explicit detail/history limits are larger than compact lists; errors have a separate small budget and preserve safe codes, current revision and request identity without dumping raw responses.

At the initial CLI checkpoint, the integrated Linux/WSL binaries passed 17 hands-on checks using a real loopback service and read-only GitHub repository verification for two projects. The checks cover profile interleaving, private relative credentials, compact and explicit reads, scoped pagination, unchanged read state, restart, malformed expected-instance rejection, redirect/privacy failures, Ctrl-C cancellation and the then-current total five-second command deadline. That historical deadline check does not establish the current bootstrap-plus-operation budget. Public unit/race tests and vet provide complementary failure-path evidence; successful cross-compilation is not native execution.

Profile/credential errors and local command results remain separate from service authentication errors. Linux ordinary private-file controls do not establish hostile same-user filesystem isolation. Native Windows CLI/profile and MCP stdio smoke passed. Fifteen additional native Windows service-backed groups passed for doctor, scoped job/message reads and mutations, original-key replay, recipient seen/ack, MCP reads and job-create/replay, and service restart retaining instance identity and receipts. Platform access-control strength and real host asynchronous delivery remain unproven; the packaged smoke guide records newer native macOS workload proof.

Native execution reads and explicit-key requests are described in review execution. Native CLI/hosted evidence reads and guarded decision/fix/finalization commands are described in review evidence controls. They operate on native evidence IDs, independently of imported browser run IDs.

Explicit agent mutations

Primary-job replacement uses jobs primary-set JOB_ID or jobs primary-clear, with the independent focus --expect-revision and explicit --key. The target worker comes from the profile. It never changes job status or selects a primary automatically.

Quick local mutations use the same private profile and a five-second operation budget after bounded identity verification. They send one request and return a compact completed resource/revision result; they do not reread full history. Such a result is not a pending-operation receipt. Variable-duration review execution, source refresh and explicit public review checkpoints wait briefly for a useful result, with an operation receipt as fallback and an explicit wait override. Each invocation requires an explicit --key of at most 128 printable ASCII bytes without surrounding whitespace. Use a distinct key for each intended action and preserve it with the exact normalized request and binding for recovery. No command silently generates a replacement key or automatically retries a mutation after a transport failure.

Command Required and optional request fields
fc notes add --body TEXT --key KEY Reminder for the bound worker by default; explicit job/phase/worker and body-file selection follow the note contract.
fc notes update NOTE_ID --expect-revision N --key KEY Patch only supplied scope, kind, body or status fields; consuming a note requires no unchanged body echo.
fc workers pause --reason TEXT --key KEY --expect-revision N Guarded bound-worker coordination pause; reason is explicit, including an empty string.
fc workers resume --key KEY --expect-revision N Explicitly clear the pause and reason without changing jobs or focus.
fc jobs create --key KEY --title TITLE Optional --brief TEXT, --worker ID, --status STATUS; defaults to active.
fc jobs edit ID --key KEY --expect-revision N At least one of --title, --brief, --worker, --status; empty brief or worker explicitly clears that field.
fc jobs checkpoint ID --key KEY --expect-revision N --done TEXT --next TEXT Optional --blocker TEXT, repeatable --evidence REF; append immutable progress without editing the job.
fc jobs update ID --key KEY --expect-revision N --body TEXT Optional repeatable --evidence REF; append a narrative update without editing the job or checkpoint.
fc jobs checklist-set ID --key KEY --expect-revision N --expect-checklist-revision C Exactly one of --items JSON or --items-file PATH; guarded ordered replacement, with unchanged content reported explicitly.
fc inbox send --key KEY --to WORKER_ID --body TEXT Optional --reply-to MESSAGE_ID; the bound worker is the sender.
fc inbox seen MESSAGE_ID --key KEY Only the bound actual recipient can change seen state.
fc inbox ack MESSAGE_ID --key KEY [--worker WORKER_ID] Acknowledgment also establishes seen state; selecting another recipient requires project management.

The parser rejects incomplete, repeated, oversized and malformed arguments before opening profiles or credentials or contacting the service. Brief and body text remain exact UTF-8; selected title/assignment normalization follows the API. Omitted edit fields stay unchanged. Guarded edits return the current revision on conflict. A retained key replays the original receipt after current authorization; it never overwrites a newer revision.

A disconnected, timed-out or canceled write can already have committed. Such diagnostics include outcome_unknown: true and instruct the caller to recover with the same key, request and instance/worker binding. Invalid receipts and failures writing a successful receipt to stdout also preserve that uncertainty. Pre-dispatch cancellation and validated request refusals do not claim an uncertain commit. Never turn an unknown outcome into a new action by creating another key. The server remains the authority for receipt replay and access.

This slice does not persist a client retry journal. Callers retain the key, request and originating binding; changing a profile or rebinding to a restored instance is not recovery of that pending action.

The project-map agent commands add explicit compact map reads, full guarded editorial replacements and independent job/workstream references. Ordinary job/context reads do not expand map content.

Incoming message replay

fc inbox snapshot and fc inbox events expose the scoped message-event API. Snapshot includes a compact inbox page and its same-transaction event cursor. Events replays one page or waits up to four seconds for a relevant change, within the normal five-second operation budget after identity verification. Full message bodies and explicit seen/ack actions remain separate calls. The explicit quiet wait, fc inbox wait --cursor CURSOR, consumes the persistent stream and returns the first new incoming-message event page or a bounded timeout; its default wait is 25 seconds, with no intermediate heartbeat output.

Combined client, transport and browser proof

The combined implementation checkpoint passed make check build and reproducible embedded-asset checks, followed by seven actual browser groups and seven actual MCP groups against the same packaged service. Both suites preserved source and binary hashes and cleaned their owned processes/state. The browser run also inspected seven desktop/phone screenshots, observed zero browser writes and zero JSON polling during a 16.2-second idle window, and exercised the first-read/live-reply race and real service restart.

The combined 64-file Go/module digest was a894280351e85316561b1850d18c4a776411be59c99454f288960bc7f76f5bf2; the 83-file manifest including browser source/config/locks/embedded assets was f33e653c8bac544fa6dff0052cfd06af825003e5e185d8bab17881c6b64a6a2f. These identify the tested bytes rather than imply proof for subsequent edits. The earlier detailed MCP and browser scenarios and platform/host limitations still apply. Browser testing used the available Chromium 153 headless shell with Playwright 1.64.1; local stdio concurrency does not establish installed-host wakeup behavior.

Small agent-call calibration

On the checkpoint source identified in checkpoint proof, thirty actual CLI latest-checkpoint reads had a 4.51 ms median, 7.73 ms observed p95 and 8.13 ms maximum. Thirty sequential reads through one actual MCP stdio connection had a 1.83 ms median, 2.57 ms observed p95 and 2.83 ms maximum. All sixty succeeded; six additional outstanding MCP reads completed in 4.87 ms total. The fixture's SQLite row counts stayed unchanged.

Each compact checkpoint contained 560 bytes of structured JSON; CLI stdout added one newline, while MCP's structured result plus compatibility text and JSON-RPC framing totaled 1,267–1,268 bytes. Transport size is not measured model-token cost. The reference was WSL2 x86-64 on an i7-12700KF, ten exposed logical CPUs, about 9.7 GiB memory, Go 1.27.2 and the packaged development binaries. Source and binary hashes stayed unchanged throughout; disposable state/processes were cleaned.

These small samples use one small checkpoint on one developer machine. They establish neither fleet throughput, a release latency budget, remote-network behavior, provider isolation measurements nor installed-model scheduling. The broader performance plan remains unmeasured.

Public website administration

The profile-bound fc publication read, preview, apply and unpublish commands configure opt-in anonymous project content under an administrator profile. The public website contract owns the input format, preview hash, exact retry and private/public field boundary. Routine worker commands do not load publication manifests or expose private records to the public site.

Optional offsite backup qualification

After building bin/fcd, run make offsite-smoke RCLONE=/absolute/path/to/rclone to exercise operator push/status/fetch against disposable loopback S3, encrypted recovery, independent retention and failure paths. CI installs a pinned, checksum-verified transport and runs this check. Ordinary tests need no external binary or cloud account. See offsite backups for isolation and proof limits.

Explicit native round controls

Use fc reviews rounds read --pr NUMBER --channel cli for one compact native control. grant accepts --min and --max (or --exact), taper accepts --taper from 1 through 1,000, and close accepts no allocation fields. Mutations require --expect-revision (--expected-revision remains a compatible alias) and the caller's original --key; they perform no provider action. Both channels default to two clean rounds for taper. See Per-PR review rounds for cumulative accounting, current authority, native completion and the deferred-consumer boundary.

Retained operation reads

Use reviews operations to discover one page of retained operations and reviews operation OPERATION_ID for compact state and original Hosted observer freshness. --all includes terminal history, while --diagnostics on a selected operation returns full retained detail. The operation contract owns filters, bounded waits, privacy and recovery semantics.

Explicit channel-front selection

Use fc reviews start --channel cli --key KEY for one durable selection and at most one native child, or --channel hosted for the independent Hosted channel. Optional --expect-pr NUMBER and --expected-configuration-revision REVISION assert the selected target and accepted configuration. fc reviews run-read --selection-id ID --wait-seconds SECONDS observes the same selection and original child; it never starts another request. start defaults to a two-second wait and run-read to no wait; use --wait-seconds 0 for an immediate receipt. Keep the original key when stdout is lost. A terminal hold requires a fresh authorized request after its cause is resolved. The selection contract owns bounds, recovery and the deferred automatic-scheduling boundary.

Native administration

Use reviews policy, reviews policy-configure --file /absolute/private.json --key KEY, reviews execution-configure --file /absolute/private.json --key KEY, workers create --name NAME --key KEY, and credentials grant|update|revoke. Operation --help is local and runs before profiles or private files are read. Credential grant accepts either --token-sha256 or an owner-private --credential-file; only the digest is transmitted. Permission replacement uses a private JSON file with complete expected and desired permission sets. Retain the original key and arguments after uncertain output; mutations are never automatically reposted.

Use workers retirement WORKER_ID before workers retire WORKER_ID --key KEY. workers list --include-retired explicitly includes historical identities. inbox list --worker WORKER_ID selects a recipient without changing the acting worker; inbox ack MESSAGE_ID --worker WORKER_ID --key KEY requires current project management when acknowledging for another recipient. See retirement for blockers and race semantics.