Commit graph

509 commits

Author SHA1 Message Date
Bryan Helmkamp
015efba19b Fix cli-table ignoring NO_COLOR environment variable
cli-table defaults to ColorChoice::Always, emitting ANSI escape codes
regardless of NO_COLOR. Fix all 5 call sites to:

1. Pass use_color to title cell .bold() instead of hardcoding true
2. Set .color_choice(Never) when colors are disabled
3. Use .display() instead of the free print_stdout/print_stderr
   functions (which re-wrap with Always defaults)

Affected commands: model list, model test, ps list, system df, rewind.
The model test snapshots are now clean plaintext.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:40:31 -04:00
Bryan Helmkamp
083068b109 Populate serve help snapshot
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:40:31 -04:00
Bryan Helmkamp
37c5569832 Convert serve help test to fabro_snapshot and delete orphaned snap file
Replace ad-hoc insta::assert_snapshot! with TestContext + fabro_snapshot!
for consistency. Delete the orphaned snapshot file from the deleted
cli.rs module.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:40:31 -04:00
Bryan Helmkamp
dc7bcf0686 Add git_init() helper to TestContext
Initializes a git repo in temp_dir. Replaces the local init_git_repo()
helper in repo.rs tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:40:31 -04:00
Bryan Helmkamp
6dedb2fbab Convert 6 more predicate assertions to fabro_snapshot
Replace predicates::str::contains checks with full snapshots in
single-command tests: repo deinit failure, repo init help, secret
get/rm missing key, exec missing API key, config show missing workflow.

The remaining predicate usages are in multi-step CRUD tests and legacy
config tests where programmatic assertions are still the better fit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:40:31 -04:00
Bryan Helmkamp
9deb84cd5a Convert workflow list test to use fabro_snapshot
Replace predicates::str::contains assertion with a full snapshot,
making the test more precise and consistent with other cmd/ tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:40:31 -04:00
Bryan Helmkamp
70efaeb69b Adopt write_temp/write_home helpers across cmd/ tests
Replace manual std::fs::create_dir_all + std::fs::write boilerplate
with context.write_temp() and context.write_home() in repo, workflow,
exec, and run tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:40:31 -04:00
Bryan Helmkamp
e641b2c90c Add write_temp/write_home helpers to TestContext
Add convenience methods that write a file under temp_dir or home_dir,
auto-creating parent directories. Returns &Self for chaining.

Apply write_home in config.rs fixture helpers and standalone tests,
replacing manual create_dir_all + write boilerplate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:40:31 -04:00
Bryan Helmkamp
ac22624c84 Remove arc() and fabro() helpers in favor of TestContext
Replace all ad-hoc arc()/fabro() command helpers with TestContext methods
(command(), run_cmd(), validate(), exec_cmd(), etc.) across all cmd/
test files. This eliminates 9 duplicate helper definitions and gives
every test consistent isolation (HOME, NO_COLOR, FABRO_STORAGE_DIR,
FABRO_NO_UPGRADE_CHECK).

Also removes init_cli_home() helper — TestContext's env-var-based
FABRO_STORAGE_DIR makes it unnecessary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:40:28 -04:00
Bryan Helmkamp
e3f83e1a32 Refactor scenario.rs to use TestContext for isolation
Replace manual fabro()/tempdir/--storage-dir boilerplate with TestContext
from fabro-test crate. This gives each scenario proper HOME isolation,
automatic NO_COLOR and upgrade-check suppression, and removes the need
for explicit --storage-dir CLI args.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:37:31 -04:00
Bryan Helmkamp
3945c1e902 Move cli.rs and scenario.rs tests into per-subcommand cmd/ files
Redistribute all tests from the monolithic cli.rs (2190 lines) and the
standalone tests from scenario.rs into their respective cmd/ files,
completing the migration to the one-file-per-subcommand structure.

- Delete cli.rs entirely; move tests to cmd/{run,config,llm,exec,doctor,serve}.rs
- Move scenario.rs standalone tests to cmd/{repo,secret,workflow,doctor}.rs
- Slim scenario.rs to only 6 parametrized E2E workflow scenarios + run lifecycle
- Create new cmd/serve.rs and cmd/workflow.rs modules
- Remove duplicate tests already covered by snapshot tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:37:24 -04:00
Bryan Helmkamp
c3634c0740 Replace trycmd tests with fabro-test crate and insta snapshots
Adopt uv's testing pattern: a shared `fabro-test` crate with TestContext
and fabro_snapshot! macro, plus one test file per subcommand under
tests/it/cmd/. This replaces the trycmd-based tests which were hard to
read and didn't compose well with programmatic assertions.

- Create lib/crates/fabro-test with TestContext, run_and_format,
  apply_filters, INSTA_FILTERS, and test_context!/fabro_snapshot! macros
- Add 42 snapshot tests across 16 subcommand files
- Delete trycmd.rs and all tests/cmd/ trycmd files
- Remove trycmd dependency, add fabro-test dev-dependency

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 11:28:41 -04:00
Bryan Helmkamp
f2729d22ef Clean up workspace clippy warnings 2026-03-30 11:27:25 -04:00
Bryan Helmkamp
c6313d74bc Use typed RunId across workflows 2026-03-30 09:20:11 -04:00
Bryan Helmkamp
5ca25c9068 Fix snapshot execution cleanup and GitHub PEM loading 2026-03-29 23:00:43 -04:00
Bryan Helmkamp
947db0713c Snapshot run settings for execution 2026-03-29 22:42:13 -04:00
Bryan Helmkamp
bafab58442 Fix asset capture robustness and retry filtering 2026-03-29 22:23:33 -04:00
Bryan Helmkamp
b6947af7af Add per-asset metadata (mime, md5, sha256) to asset capture
Replace the batch AssetsCaptured event with per-file AssetCaptured events
that include content hashes and MIME type. The asset collection manifest
now stores a captured_assets array with full metadata instead of bare
path strings, enabling downstream integrity verification and content
type awareness.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 22:10:09 -04:00
Bryan Helmkamp
be6e37fa26 Rename cli.toml to user.toml 2026-03-29 21:24:10 -04:00
Bryan Helmkamp
dfc30b6d3a Add FABRO_* environment variables for global CLI args
Enable clap's `env` feature and wire each global flag to a
corresponding environment variable (FABRO_DEBUG, FABRO_QUIET,
FABRO_VERBOSE, FABRO_NO_UPGRADE_CHECK, FABRO_STORAGE_DIR,
FABRO_SERVER_URL). Boolean flags use BoolishValueParser so they
accept 1/true/yes/on and their inverses.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:13:31 -04:00
Bryan Helmkamp
814c798cec Centralize global CLI override application 2026-03-29 21:08:16 -04:00
Bryan Helmkamp
652faf44d8 Infer CLI mode from storage and server flags 2026-03-29 20:58:46 -04:00
Bryan Helmkamp
38172be9c9 Handle projection and retro artifact write failures 2026-03-29 19:23:44 -04:00
Bryan Helmkamp
301eedb6fb Add disk-projecting run store decorator 2026-03-29 19:13:05 -04:00
Bryan Helmkamp
5c0a491de8 Rename ProjectFabroConfig and ProjectFabroSettings to drop Fabro prefix
The Fabro prefix is redundant within the fabro_config and fabro_types
crate namespaces. Aligns with the earlier ConfigLayer rename.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 14:21:36 -04:00
Bryan Helmkamp
e600e8cbba Reuse one CLI config layer during run creation 2026-03-29 14:16:51 -04:00
Bryan Helmkamp
9613d691f2 Refactor config resolution around ConfigLayer 2026-03-29 13:47:09 -04:00
Bryan Helmkamp
9aff6530b4 Add publish = false to all crates to prevent accidental crates.io publish
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:47:09 -04:00
Bryan Helmkamp
0abf7c1b4d Rename fabro-api crate to fabro-server
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:47:09 -04:00
Bryan Helmkamp
83b8888494 Harden store dump path handling 2026-03-29 13:47:09 -04:00
Bryan Helmkamp
a577f1bc4d Add store dump CLI export command 2026-03-29 13:47:09 -04:00
Bryan Helmkamp
2601f6cde2 Make metadata rebuild recovery robust 2026-03-29 13:47:09 -04:00
Bryan Helmkamp
f7392767ee Configure SlateDB flush_interval to 5ms for local storage
SlateDB defaults to 100ms flush_interval (tuned for S3 cost). For
local/in-memory object stores this adds unnecessary write latency.
Pass flush_interval through SlateStore::new() so callers control
the setting, and switch open_db() to use Db::builder().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:47:09 -04:00
Bryan Helmkamp
b577c4ff95 Rename fabro-types-derive to fabro-macros
Broader name better reflects the crate's role as the workspace's
proc-macro crate, not just derives for fabro-types.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:47:09 -04:00
Bryan Helmkamp
f9fe34ed97 Rebuild metadata branches from the run store 2026-03-29 13:47:09 -04:00
Bryan Helmkamp
fa26519869 Fix store migration gaps: retro agent, finalize commit, engine failure, and hydration tolerance
- retro_agent::upload_data_files reads from RunStore first with filesystem
  fallback for progress.jsonl, checkpoint, run record, and start record
- write_finalize_commit reads retro.json from store before falling back to disk
- persist_terminal_engine_failure uses build_conclusion_from_store instead of
  disk-only build_conclusion
- open_or_hydrate_run tolerates malformed checkpoint/conclusion/retro/sandbox
  JSON files during hydration (warns and skips instead of failing)
- Box<DbReader> in SlateRunDb fixes clippy large_enum_variant warning
- Fix tests that called open_or_hydrate_run on dirs without run.json
- Nextest test-groups replace global thread cap for better parallelism
- opt-level=1 for dev dependencies shrinks test binary sizes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:47:09 -04:00
Bryan Helmkamp
e2dc48c006 Fix remaining CLI store migration gaps 2026-03-29 13:47:09 -04:00
Bryan Helmkamp
96641f4acc Wire workflows and CLI to fabro-store 2026-03-29 13:47:09 -04:00
Bryan Helmkamp
038420d9c8 Replace mockito with httpmock in fabro-hooks, fabro-openai-oauth, and fabro-tracker
mockito's Server::new_async() triggers macOS SCDynamicStoreCreateWithOptions
via hyper-util (~300ms per test), which serializes on configd under workspace
concurrency and causes 4s+ timeouts. httpmock avoids this path entirely.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:47:09 -04:00
Bryan Helmkamp
9891c54305 Return graphs from workflow transforms 2026-03-29 13:47:09 -04:00
Bryan Helmkamp
6f2273941f Consolidate integration tests under tests/it 2026-03-29 13:47:09 -04:00
Bryan Helmkamp
6e543814be Replace mockito with HttpClient trait in fabro-github and detect import self-loops
Introduce an HttpClient trait abstraction over reqwest::Client so tests
use a lightweight MockHttpClient instead of spawning a TCP server via
mockito. This removes the mockito dev-dependency entirely and makes
tests faster and more deterministic.

Also add self-loop detection in ImportTransform to poison placeholders
that have edges pointing back to themselves.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:47:09 -04:00
Bryan Helmkamp
938ae2dfad Fix import transform edge cases 2026-03-29 13:47:09 -04:00
Bryan Helmkamp
c44a507771 Add file-based workflow imports 2026-03-29 13:47:09 -04:00
Bryan Helmkamp
9b91462713 Fix unreachable_pub and unsafe_code warnings in test code
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:47:09 -04:00
Bryan Helmkamp
a9d8f62823 Use static RSA key fixture to fix fabro-github test timeouts
Tests were spawning `openssl genpkey` per test, causing timeouts under
nextest's per-process parallelism with the 4s hard-kill limit. Replace
with a pre-generated key loaded via include_str!.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:47:09 -04:00
Bryan Helmkamp
2b52265e59 Fix clippy type_complexity lints with OnNodeCallback type alias
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:47:09 -04:00
Bryan Helmkamp
b76c6c2965 Add Printer enum and warn_user! macros for unified verbosity control
Introduces a uv-style Printer enum (Silent/Quiet/Default/Verbose) and
warn_user!/warn_user_once! macros in fabro-util, wires --quiet/--verbose
global flags into the CLI, and converts the `fabro init` deprecation
warning as a proof of concept.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:47:09 -04:00
Bryan Helmkamp
d277ecf04a Add detached engine process titles 2026-03-29 13:47:09 -04:00
Bryan Helmkamp
2fab727781 Fix clippy absolute_paths violation in ssh_common detect_clone_params
Import the daytona module instead of using inline crate::daytona:: path,
matching the workspace's import style rules.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 13:47:09 -04:00