mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-06 02:48:25 +00:00
## Summary
Adds an opt-in `skip_git_hooks` boolean to `[run.checkpoint]` that
causes Fabro-managed run-branch checkpoint commits to pass `--no-verify`
to `git commit`, bypassing local hooks such as `pre-commit` and
`commit-msg`. Defaults to `false`. Metadata-branch snapshots and Fabro
`[[run.hooks]]` are unaffected.
```toml
[run.checkpoint]
skip_git_hooks = true
```
### Plan Summary
- `RunCheckpointSettings` (dense, in `fabro-types`) gains
`skip_git_hooks: bool` with `#[serde(default)]`.
- `RunCheckpointLayer` (sparse, in `fabro-config`) gains
`skip_git_hooks: Option<bool>` so layered config can distinguish unset
from explicit `false`.
- `RunCheckpointLayer::combine` is refactored from a wholesale-replace
to field-level merging: `exclude_globs` keeps its existing replace-wins
semantics; `skip_git_hooks` uses `.or()` (highest-priority layer that
sets it wins).
- `resolve_checkpoint` resolves `None → false`.
- `git_checkpoint` / `checked_git_checkpoint` in `sandbox_git.rs` accept
a new `skip_git_hooks: bool` and append `--no-verify` when true.
- `parallel_branch_commit_cmd` (new helper in `handler/parallel.rs`)
replaces the inline format string and accepts the same flag.
- `GitState` carries `checkpoint_skip_git_hooks`;
`RunOptions::checkpoint_skip_git_hooks()` exposes it; `execute.rs` and
`git.rs` thread it through.
- OpenAPI schema, TypeScript API client, and docs are updated.
### Key design decisions
**Field-level merging in `combine`**: the previous
`RunCheckpointLayer::combine` replaced the whole struct when
`self.exclude_globs` was non-empty. The refactor keeps that same replace
rule for `exclude_globs` while adding independent `Option::or` merging
for `skip_git_hooks`, so the two fields don't interfere.
**`--no-verify` only on run-branch commits**: the flag is injected only
in the two Git commit paths Fabro controls for run-branch checkpoints.
Metadata-branch snapshots use `git2` and never fire local hooks
regardless of this setting.
### Fabro Details
<details>
<summary>Ran 9 stages in 48m 3s for $13.91</summary>
| Stage | Duration | Cost | Retries |
|---|---|---|---|
| start | 0s | – | 0 |
| toolchain | 3s | – | 0 |
| preflight_compile | 2m 4s | – | 0 |
| preflight_lint | 2m 15s | – | 0 |
| implement | 24m 13s | $10.38 | 0 |
| simplify_opus | 10m 31s | $1.59 | 0 |
| simplify_gpt | 5m 8s | $1.93 | 0 |
| verify | 3m 4s | – | 0 |
| fmt | 3s | – | 0 |
| **Total** | **48m 3s** | **$13.91** | **0** |
</details>
<details>
<summary>Ran <code>ImplementPlan.fabro</code> (12 nodes and 15
edges)</summary>
```dot
digraph ImplementPlan {
graph [
goal="Implement and simplify",
model_stylesheet="
* { model: claude-opus-4-7; }
"
]
rankdir=LR
start [shape=Mdiamond, label="Start"]
exit [shape=Msquare, label="Exit"]
toolchain [label="Toolchain", shape=parallelogram, script="command -v cargo >/dev/null || { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && sudo ln -sf $HOME/.cargo/bin/* /usr/local/bin/; }; cargo --version 2>&1", max_retries=0]
preflight_compile [label="Preflight Compile", shape=parallelogram, script="cargo check -q --workspace 2>&1", max_retries=0]
preflight_lint [label="Preflight Lint", shape=parallelogram, script="cargo +nightly-2026-04-14 clippy -q --workspace --all-targets -- -D warnings 2>&1", max_retries=0]
fix_lints [label="Fix Lints", prompt="The preflight lint step failed. Read the build output from context and fix all clippy lint warnings.", max_visits=3]
implement [label="Implement", prompt="Read the plan file referenced in the goal and implement every step. Make all the code changes described in the plan. Use red/green TDD."]
simplify_opus [label="Simplify (Opus)", prompt="@prompts/simplify.md"]
simplify_gpt [label="Simplify (GPT-55)", prompt="@prompts/simplify.md", model="gpt-55"]
verify [label="Verify", shape=parallelogram, script="cargo +nightly-2026-04-14 clippy -q --workspace --all-targets -- -D warnings 2>&1 && cargo nextest run --cargo-quiet --workspace --status-level fail 2>&1 && cargo dev docs refresh 2>&1 && cargo dev docs check 2>&1", goal_gate=true, retry_target="fixup"]
fixup [label="Fixup", prompt="The verify step failed. Read the build output from context and fix all clippy lint warnings, test failures, and generated docs errors.", max_visits=3]
fmt [label="Format", shape=parallelogram, script="cargo +nightly-2026-04-14 fmt --all 2>&1", max_retries=0]
start -> toolchain
toolchain -> preflight_compile [condition="outcome=succeeded"]
toolchain -> exit
preflight_compile -> preflight_lint [condition="outcome=succeeded"]
preflight_compile -> exit
preflight_lint -> implement [condition="outcome=succeeded"]
preflight_lint -> fix_lints
fix_lints -> preflight_lint
implement -> simplify_opus -> simplify_gpt -> verify
verify -> fmt [condition="outcome=succeeded"]
verify -> fixup
fixup -> verify
fmt -> exit
}
```
</details>
⚒️ Generated with [Fabro](https://fabro.sh)
---------
Co-authored-by: Fabro <noreply@fabro.sh>
514 lines
14 KiB
Rust
514 lines
14 KiB
Rust
use fabro_test::{fabro_snapshot, test_context};
|
|
use httpmock::MockServer;
|
|
use insta::assert_snapshot;
|
|
use serde_json::{Value, json};
|
|
|
|
use super::support::{
|
|
compact_git_inspect, compact_inspect, remote_run_summary_json, run_success,
|
|
setup_seeded_completed_dry_run, setup_seeded_created_dry_run,
|
|
setup_seeded_git_backed_changed_run,
|
|
};
|
|
use crate::support::{run_projection_json, unique_run_id};
|
|
|
|
fn remote_run_summary(run_id: &str, status: &serde_json::Value) -> serde_json::Value {
|
|
remote_run_summary_json(
|
|
run_id,
|
|
"Nightly Build",
|
|
"nightly-build",
|
|
"Inspect remote state",
|
|
status,
|
|
"2026-04-19T12:00:00Z",
|
|
)
|
|
}
|
|
|
|
#[test]
|
|
fn help() {
|
|
let context = test_context!();
|
|
let mut cmd = context.command();
|
|
cmd.args(["inspect", "--help"]);
|
|
fabro_snapshot!(context.filters(), cmd, @"
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
Show detailed information about a workflow run
|
|
|
|
Usage: fabro inspect [OPTIONS] <RUN>
|
|
|
|
Arguments:
|
|
<RUN> Run ID prefix or workflow name (most recent run)
|
|
|
|
Options:
|
|
--json Output as JSON [env: FABRO_JSON=]
|
|
--server <SERVER> Fabro server target: http(s) URL or absolute Unix socket path [env: FABRO_SERVER=]
|
|
--debug Enable DEBUG-level logging (default is INFO) [env: FABRO_DEBUG=]
|
|
--no-upgrade-check Disable automatic upgrade check [env: FABRO_NO_UPGRADE_CHECK=true]
|
|
--quiet Suppress non-essential output [env: FABRO_QUIET=]
|
|
--verbose Enable verbose output [env: FABRO_VERBOSE=]
|
|
-h, --help Print help
|
|
----- stderr -----
|
|
");
|
|
}
|
|
|
|
#[test]
|
|
fn inspect_resolves_selector_via_server_endpoint() {
|
|
let context = test_context!();
|
|
let server = MockServer::start();
|
|
let run_id = unique_run_id();
|
|
let summary = remote_run_summary(
|
|
run_id.as_str(),
|
|
&json!({
|
|
"kind": "succeeded",
|
|
"reason": "completed"
|
|
}),
|
|
);
|
|
|
|
let resolve_run = server.mock(|when, then| {
|
|
when.method("GET")
|
|
.path("/api/v1/runs/resolve")
|
|
.query_param("selector", "nightly-build");
|
|
then.status(200)
|
|
.header("content-type", "application/json")
|
|
.body(summary.to_string());
|
|
});
|
|
let run_state = server.mock(|when, then| {
|
|
when.method("GET")
|
|
.path(format!("/api/v1/runs/{}/state", run_id.as_str()));
|
|
then.status(200)
|
|
.header("content-type", "application/json")
|
|
.body(
|
|
run_projection_json(
|
|
run_id.as_str(),
|
|
&json!({
|
|
"kind": "succeeded",
|
|
"reason": "completed"
|
|
}),
|
|
)
|
|
.to_string(),
|
|
);
|
|
});
|
|
|
|
let mut cmd = context.command();
|
|
cmd.args([
|
|
"inspect",
|
|
"--server",
|
|
&format!("{}/api/v1", server.base_url()),
|
|
"nightly-build",
|
|
]);
|
|
|
|
fabro_snapshot!(context.filters(), cmd, @r#"
|
|
success: true
|
|
exit_code: 0
|
|
----- stdout -----
|
|
[
|
|
{
|
|
"run_id": "[ULID]",
|
|
"parent_id": null,
|
|
"status": {
|
|
"kind": "succeeded",
|
|
"reason": "completed"
|
|
},
|
|
"run_spec": {
|
|
"run_id": "[ULID]",
|
|
"settings": {
|
|
"project": {
|
|
"name": null,
|
|
"description": null,
|
|
"metadata": {}
|
|
},
|
|
"workflow": {
|
|
"name": null,
|
|
"description": null,
|
|
"graph": "",
|
|
"metadata": {}
|
|
},
|
|
"run": {
|
|
"goal": null,
|
|
"working_dir": null,
|
|
"metadata": {},
|
|
"inputs": {},
|
|
"model": {
|
|
"provider": null,
|
|
"name": null,
|
|
"fallbacks": [],
|
|
"controls": {
|
|
"reasoning_effort": null,
|
|
"speed": null
|
|
}
|
|
},
|
|
"git": {
|
|
"author": null
|
|
},
|
|
"prepare": {
|
|
"commands": [],
|
|
"timeout_ms": 300000
|
|
},
|
|
"execution": {
|
|
"mode": "normal",
|
|
"approval": "prompt"
|
|
},
|
|
"checkpoint": {
|
|
"exclude_globs": [],
|
|
"skip_git_hooks": false
|
|
},
|
|
"clone": {
|
|
"enabled": true
|
|
},
|
|
"run_branch": {
|
|
"enabled": true,
|
|
"push": true
|
|
},
|
|
"meta_branch": {
|
|
"enabled": true,
|
|
"push": true
|
|
},
|
|
"sandbox": {
|
|
"provider": "local",
|
|
"preserve": false,
|
|
"stop_on_terminal": true,
|
|
"devcontainer": false,
|
|
"env": {},
|
|
"docker": null,
|
|
"daytona": null
|
|
},
|
|
"notifications": {},
|
|
"interviews": {
|
|
"provider": null,
|
|
"slack": null
|
|
},
|
|
"agent": {
|
|
"fabro_tools": false,
|
|
"permissions": null,
|
|
"mcps": {}
|
|
},
|
|
"hooks": [],
|
|
"scm": {
|
|
"provider": null,
|
|
"owner": null,
|
|
"repository": null,
|
|
"github": null
|
|
},
|
|
"pull_request": null,
|
|
"artifacts": {
|
|
"include": []
|
|
},
|
|
"integrations": {
|
|
"github": {
|
|
"permissions": {}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"graph": {
|
|
"name": "Remote Workflow",
|
|
"nodes": {},
|
|
"edges": [],
|
|
"attrs": {}
|
|
},
|
|
"workflow_slug": "remote-workflow",
|
|
"source_directory": "/srv/repo"
|
|
},
|
|
"start_record": null,
|
|
"conclusion": null,
|
|
"checkpoint": null,
|
|
"sandbox": null
|
|
}
|
|
]
|
|
----- stderr -----
|
|
"#);
|
|
|
|
resolve_run.assert();
|
|
run_state.assert();
|
|
}
|
|
|
|
#[test]
|
|
fn inspect_includes_parent_id_from_run_projection() {
|
|
let context = test_context!();
|
|
let server = MockServer::start();
|
|
let run_id = unique_run_id();
|
|
let parent_id = unique_run_id();
|
|
let summary = remote_run_summary(
|
|
run_id.as_str(),
|
|
&json!({
|
|
"kind": "succeeded",
|
|
"reason": "completed"
|
|
}),
|
|
);
|
|
|
|
let resolve_run = server.mock(|when, then| {
|
|
when.method("GET")
|
|
.path("/api/v1/runs/resolve")
|
|
.query_param("selector", "nightly-build");
|
|
then.status(200)
|
|
.header("content-type", "application/json")
|
|
.body(summary.to_string());
|
|
});
|
|
let run_state = server.mock(|when, then| {
|
|
when.method("GET")
|
|
.path(format!("/api/v1/runs/{}/state", run_id.as_str()));
|
|
let mut state = run_projection_json(
|
|
run_id.as_str(),
|
|
&json!({
|
|
"kind": "succeeded",
|
|
"reason": "completed"
|
|
}),
|
|
);
|
|
state["parent_id"] = json!(parent_id);
|
|
then.status(200)
|
|
.header("content-type", "application/json")
|
|
.body(state.to_string());
|
|
});
|
|
|
|
let output = context
|
|
.command()
|
|
.args([
|
|
"inspect",
|
|
"--server",
|
|
&format!("{}/api/v1", server.base_url()),
|
|
"nightly-build",
|
|
])
|
|
.output()
|
|
.expect("inspect should execute");
|
|
|
|
assert!(
|
|
output.status.success(),
|
|
"inspect failed:\nstdout:\n{}\nstderr:\n{}",
|
|
String::from_utf8_lossy(&output.stdout),
|
|
String::from_utf8_lossy(&output.stderr)
|
|
);
|
|
let items: Value = serde_json::from_slice(&output.stdout).expect("inspect JSON should parse");
|
|
assert_eq!(items[0]["run_id"], run_id);
|
|
assert_eq!(items[0]["parent_id"], parent_id);
|
|
|
|
resolve_run.assert();
|
|
run_state.assert();
|
|
}
|
|
|
|
#[test]
|
|
fn inspect_created_run_shows_run_spec_without_start_or_conclusion() {
|
|
let context = test_context!();
|
|
let run = setup_seeded_created_dry_run(&context);
|
|
let output = run_success(&context, &["inspect", &run.run_id]);
|
|
|
|
assert_snapshot!(serde_json::to_string_pretty(&compact_inspect(&output)).unwrap(), @r#"
|
|
[
|
|
{
|
|
"run_id": "[ULID]",
|
|
"status": {
|
|
"kind": "submitted"
|
|
},
|
|
"run_spec": {
|
|
"goal": {
|
|
"type": "inline",
|
|
"value": "Run tests and report results"
|
|
},
|
|
"workflow_name": "Simple",
|
|
"workflow_slug": "simple",
|
|
"sandbox_provider": "local",
|
|
"dry_run": true,
|
|
"provenance": {
|
|
"server_version": "[VERSION]",
|
|
"client_name": "fabro-cli",
|
|
"client_version": "[VERSION]",
|
|
"subject_auth_method": "dev_token"
|
|
}
|
|
},
|
|
"start_record": null,
|
|
"conclusion": null,
|
|
"checkpoint": null,
|
|
"sandbox": {
|
|
"provider": "local"
|
|
}
|
|
}
|
|
]
|
|
"#);
|
|
}
|
|
|
|
#[test]
|
|
fn inspect_completed_run_shows_run_start_conclusion_checkpoint() {
|
|
let context = test_context!();
|
|
let run = setup_seeded_completed_dry_run(&context);
|
|
let output = run_success(&context, &["inspect", &run.run_id]);
|
|
|
|
assert_snapshot!(serde_json::to_string_pretty(&compact_inspect(&output)).unwrap(), @r#"
|
|
[
|
|
{
|
|
"run_id": "[ULID]",
|
|
"status": {
|
|
"kind": "succeeded",
|
|
"reason": "completed"
|
|
},
|
|
"run_spec": {
|
|
"goal": {
|
|
"type": "inline",
|
|
"value": "Run tests and report results"
|
|
},
|
|
"workflow_name": "Simple",
|
|
"workflow_slug": "simple",
|
|
"sandbox_provider": "local",
|
|
"dry_run": true,
|
|
"provenance": {
|
|
"server_version": "[VERSION]",
|
|
"client_name": "fabro-cli",
|
|
"client_version": "[VERSION]",
|
|
"subject_auth_method": "dev_token"
|
|
}
|
|
},
|
|
"start_record": {
|
|
"has_start_time": true
|
|
},
|
|
"conclusion": {
|
|
"status": "succeeded",
|
|
"timing": "[TIMING]",
|
|
"stage_count": null
|
|
},
|
|
"checkpoint": {
|
|
"current_node": "report",
|
|
"completed_nodes": [
|
|
"start",
|
|
"run_tests",
|
|
"report"
|
|
],
|
|
"next_node_id": "exit"
|
|
},
|
|
"sandbox": {
|
|
"provider": "local"
|
|
}
|
|
}
|
|
]
|
|
"#);
|
|
}
|
|
|
|
#[test]
|
|
fn inspect_json_omits_run_dir() {
|
|
let context = test_context!();
|
|
let run = setup_seeded_completed_dry_run(&context);
|
|
let output = run_success(&context, &["inspect", &run.run_id]);
|
|
let items: serde_json::Value =
|
|
serde_json::from_slice(&output.stdout).expect("inspect output should parse");
|
|
let first = items
|
|
.as_array()
|
|
.and_then(|items| items.first())
|
|
.expect("inspect output should contain one item");
|
|
assert!(
|
|
first.get("run_dir").is_none(),
|
|
"inspect JSON should not expose run_dir"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn inspect_completed_run_reads_store_without_disk_metadata_files() {
|
|
let context = test_context!();
|
|
let run = setup_seeded_completed_dry_run(&context);
|
|
let output = run_success(&context, &["inspect", &run.run_id]);
|
|
|
|
assert_snapshot!(serde_json::to_string_pretty(&compact_inspect(&output)).unwrap(), @r#"
|
|
[
|
|
{
|
|
"run_id": "[ULID]",
|
|
"status": {
|
|
"kind": "succeeded",
|
|
"reason": "completed"
|
|
},
|
|
"run_spec": {
|
|
"goal": {
|
|
"type": "inline",
|
|
"value": "Run tests and report results"
|
|
},
|
|
"workflow_name": "Simple",
|
|
"workflow_slug": "simple",
|
|
"sandbox_provider": "local",
|
|
"dry_run": true,
|
|
"provenance": {
|
|
"server_version": "[VERSION]",
|
|
"client_name": "fabro-cli",
|
|
"client_version": "[VERSION]",
|
|
"subject_auth_method": "dev_token"
|
|
}
|
|
},
|
|
"start_record": {
|
|
"has_start_time": true
|
|
},
|
|
"conclusion": {
|
|
"status": "succeeded",
|
|
"timing": "[TIMING]",
|
|
"stage_count": null
|
|
},
|
|
"checkpoint": {
|
|
"current_node": "report",
|
|
"completed_nodes": [
|
|
"start",
|
|
"run_tests",
|
|
"report"
|
|
],
|
|
"next_node_id": "exit"
|
|
},
|
|
"sandbox": {
|
|
"provider": "local"
|
|
}
|
|
}
|
|
]
|
|
"#);
|
|
}
|
|
|
|
#[test]
|
|
fn inspect_git_backed_run_exposes_checkpoint_and_sandbox_state() {
|
|
let context = test_context!();
|
|
let setup = setup_seeded_git_backed_changed_run(&context);
|
|
let output = run_success(&context, &["inspect", &setup.run.run_id]);
|
|
|
|
assert_snapshot!(
|
|
serde_json::to_string_pretty(&compact_git_inspect(&output)).unwrap(),
|
|
@r#"
|
|
[
|
|
{
|
|
"run_id": "[ULID]",
|
|
"status": {
|
|
"kind": "succeeded",
|
|
"reason": "completed"
|
|
},
|
|
"run_spec": {
|
|
"goal": {
|
|
"type": "inline",
|
|
"value": "Edit a tracked file"
|
|
},
|
|
"workflow_name": "Flow",
|
|
"workflow_slug": "flow",
|
|
"llm_provider": "openai",
|
|
"sandbox_provider": "local",
|
|
"provenance": {
|
|
"server_version": "[VERSION]",
|
|
"client_name": "fabro-cli",
|
|
"client_version": "[VERSION]",
|
|
"subject_auth_method": "dev_token"
|
|
}
|
|
},
|
|
"start_record": {
|
|
"has_start_time": true,
|
|
"run_branch": "fabro/run/[ULID]",
|
|
"base_sha": "[SHA]"
|
|
},
|
|
"conclusion": {
|
|
"status": "succeeded",
|
|
"timing": "[TIMING]",
|
|
"final_git_commit_sha": "[SHA]",
|
|
"stage_count": null
|
|
},
|
|
"checkpoint": {
|
|
"current_node": "step_two",
|
|
"completed_nodes": [
|
|
"start",
|
|
"step_one",
|
|
"step_two"
|
|
],
|
|
"next_node_id": "exit",
|
|
"git_commit_sha": "[SHA]"
|
|
},
|
|
"sandbox": {
|
|
"provider": "local",
|
|
"working_directory": "[WORKTREE]"
|
|
}
|
|
}
|
|
]
|
|
"#
|
|
);
|
|
}
|