Skip to content

figmog first pass - #1

Merged
hhff merged 10 commits into
mainfrom
first-pass-2
Aug 17, 2026
Merged

hhff merged 10 commits into
mainfrom
first-pass-2

Conversation

@hhff

@hhff hhff commented Aug 17, 2026 •

Copy link
Copy Markdown
Member

Branch-naming note: the org has a block-force-push ruleset (org: sanctuarycomputer) active on this repo that forbids force-push and branch deletion on any branch. An initial push of a true orphan commit landed on first-pass before main was seeded with a shared ancestor for the PR API to accept; that push couldn't be force-replaced or deleted afterward, so the real head branch for this PR is first-pass-2 (content-identical tree, parented on the seed commit so GitHub will diff/merge it against main). first-pass remains as a harmless dangling branch. Later migration tasks should keep pushing fast-forward commits onto first-pass-2.

Summary

Task 1 of the figmog standalone migration (spec: docs/history/2026-08-16-figmog-standalone-repo.md, plan: docs/history/2026-08-16-figmog-migration.md): imports figmog from sanctuarycomputer/clog branch worktree-figmog (PR #1, commit bf9fc05) as a standalone crate at repo root.

  • src/, tests/, README.md moved wholesale from examples/figmog/ — verified byte-identical via tree diff against the source branch.
  • Cargo.toml rewritten standalone: figmog 0.0.1, edition 2024, license MIT; fold switched from a path dependency to a pinned git dependency: fold = { git = "https://github.com/flowercomputers/bogkit", rev = "20f2ca50d5d06f51edfe8b8570c0fb48caf9eb81" } (pre-verified source-identical to our in-repo fold). All other deps/dev-deps carried over unchanged (serde, serde_json, ureq, clap, thiserror; dev: tempfile, assert_cmd, postcard).
  • LICENSE (MIT, sanctuary computer), .gitignore (target/, .figmog/, .superpowers/) added.
  • docs/history/ holds the old figmog build-design spec, the standalone-repo spec, and all figmog plan docs, verbatim, for reference. No other clog docs migrated.
  • [profile.dev] opt-level = 3 carried over from the old workspace profile (needed for e2e test perf).

Gates run at the new crate root: cargo test (162/162 passing, first run against the git dep — proves the pin is faithful), cargo clippy --no-deps -- -D warnings (clean), cargo fmt --check (clean).

main was seeded separately with an init commit (LICENSE + stub README) before this branch was pushed, per the migration plan's PR-flow mechanics.

Upcoming (this PR will absorb further commits from the migration plan)

  • Task 2: remove bench/REPL/watch and human-output CLI mode (JSON-only)
  • Task 3: pay down deferred review debt (spec §4 list)
  • Task 4: cli.rs module split, docs/SPEC.md consolidation, standalone README rewrite, new-repo CLAUDE.md
  • Task 5: CI + release workflows, tag v0.0.1 as a published pre-release

Test plan

  • cargo test — 162 passed, 0 failed
  • cargo clippy --no-deps -- -D warnings — clean
  • cargo fmt --check — clean
  • Tree diff of src/ and tests/ against worktree-figmog:examples/figmog/{src,tests} — empty (pure move)

🤖 Generated with Claude Code

hhff and others added 10 commits August 16, 2026 23:31
) as standalone crate

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Cuts per spec §4: deletes src/bench.rs + src/repl.rs (corpus generator,
load-test demo, and interactive REPL go with them) and Cmd::Watch/
cmd_watch (serve owns sync via its own poll loop; the shared Watcher/
Tick/pull_failure_wait/BACKOFF_* machinery sessions.rs and serve.rs use
stays). Removes the global --json flag: every read command now prints
its query::* Value via serde_json::to_string_pretty unconditionally,
and errors are always {"error": ...} JSON on stderr. Post-cut dead-code
sweep removes the two pub(crate) helpers that lost their only caller
(UreqApi::file_nodes, cli::read_watermark). README gets a surgical pass
to strip now-false bench/REPL/watch/--json mentions (full rewrite is a
later task).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Spec §4's hardening ledger: honest variable_edges dedup comment (no
adjacent-only dedup_by), merge_registry drops upstream tools matching any
actual local tool name (not just the figmog_ prefix), cache::store
surfaces serialize errors as Result (propagates as tool isError),
wrong-type tool args report "expected <type> for `key`, got <type>"
instead of "missing required field", --interval clamps to a one-day max
so Instant + huge Duration can't overflow-panic, serve's stdout frame
write tolerates a vanished client (clean exit 0, no broken-pipe panic),
pub mod serve -> pub(crate) mod serve fixes the visibility mismatch and
clears the 4 private-intra-doc-link warnings from Task 2, flatten.rs's
obj_map borrows instead of cloning every envelope Value, and the README
gains an interim Tier-3 multi-file poll-budget note. serve.rs's
is_local_tool-above-rtx ordering was already correct pre-migration — no
change needed there (see task-3-report.md).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…imal pub surface

Pillar-2 review fixes:
- open_store_checked suppresses the default panic hook around
  catch_unwind so stderr is JSON on every path, including a panic: a
  Locked panic still returns the existing friendly error, any other
  panic emits {"error": "internal panic: ..."} and exits 101 directly
  (controller ruling, supersedes restore-before-resume). Strengthened
  the e2e regression test to parse the full stderr buffer as JSON
  instead of a substring check.
- New write_json() helper (writeln! + flush, broken pipe -> silent exit
  0 via a STDOUT_CLOSED sentinel) replaces five panic-on-broken-pipe
  println! call sites; new e2e test proves a reader that closes
  mid-write gets a clean exit 0, not a panic.
- Shrunk the public module surface (api/ident/mcp/query/upstream/watch
  -> pub(crate)) and let --all-targets clippy surface real dead code:
  FakeUpstream is now #[cfg(test)]-only (its "other test binaries can
  drive it" doc claim was false) and Tick::Changed's unread
  last_touched_at field is dropped.
- canonical_args propagates serialize errors instead of collapsing to
  "" (distinct calls must never share a cache key); merge_registry now
  also drops a second upstream tool that duplicates an already-accepted
  upstream name; lib.rs's stale doc link points at docs/history/.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Splits src/cli.rs (1.4k lines) into src/cli/{mod,pull,read,call}.rs as
pure moves (clap types/dispatch/run/write_json/open_store_checked in
mod.rs; pull/do_pull/PullError/current-file helpers in pull.rs; the 16
read-only query commands in read.rs; tools/call/import-variables in
call.rs), tightening pub(crate) to pub(super) wherever a helper is only
needed inside the cli subtree. Adds docs/SPEC.md, a consolidated
current-state spec verified against src/ (architecture, data model,
pipeline/sinks, sync/sweep, serve multi-file/watch/MCP, the cached
proxy, variables, CLI surface, determinism contracts) superseding
docs/history/*'s version archaeology. Rewrites README.md per the
standalone-repo spec: install from GitHub Releases (tarball, chmod,
macOS quarantine note, unsigned-binary limitation) plus build-from-
source, the fold-license sentence, corrected `-p figmog`-free command
examples, and limitations reorganized around variables/desktop-proxy/
polling/single-writer. Adds CLAUDE.md (determinism, frozen schema, fold
never vendored, gates, no new deps without justification, synthetic
fixtures, plus a fold-pin-bump checklist entry and the empty
[workspace] table's rationale, also commented in Cargo.toml itself).

Also folds in the deferred debt-ledger minors this same restructuring
touches: a cache-write failure now logs to stderr and still returns the
successful upstream result instead of failing the call (proxy.rs);
PullError moves to a thiserror derive; `figmog tools` no longer opens
the store or requires a resolved mirror (dispatched before resolve_db,
like serve); output-shape e2e tests for `tools`/`import-variables`;
`pub(crate) mod serve` drops the redundant pub(crate) (already
crate-wide from the root); open_store_checked's doc comment gains a
parallel-test panic-hook race note.

138 -> 142 tests. cargo test/clippy --all-targets -D warnings/fmt
--check/doc --no-deps all green on both feature configs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Deferred from the T4 ledger alongside the [workspace]-table comment: a
one-line explanation of why .superpowers/ (per-worktree SDD planning
state) is gitignored, so the entry doesn't read as an unexplained
leftover.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
§4 said the pipeline wires records into "eight" terminal sinks; the
table right below it (and store.rs's figmog_pipeline!) shows 14.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@hhff
hhff merged commit 9cd8bd2 into main Aug 17, 2026
2 checks passed
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