Repository navigation
chore: repo-compare.json: gate record against a MISS+failed-compare run producing no verdict - #637
Conversation
|
Tracking this PR for automated review ( |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. 📝 WalkthroughWalkthroughThe workflow now evaluates recursive ChangesWorkflow condition updates
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change gates recording when a fresh comparison produces no verdict while preserving cache-hit behavior; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Description checkExplanation The description provides the change summary, implementation details, test results, risk assessment, and compatibility context. It does not use the template headings or test-plan checkboxes, but it contains the required information and is mostly complete. Full details: Docstring CoverageExplanation Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 1 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…one.
**What I did:** Extended `compile_run_if` in `crates/flare-workflow/src/json.rs` to support a single top-level `OR`/`AND` combining two atomic conditions (each still `==`/`!=`/bare-truthy), and fixed a landmine I hit along the way: `expand_variables` leaves an unresolved `{{var}}` as literal template text rather than empty string, which would have made `verdict != ''` spuriously true whenever `compare` never ran. I now normalize any still-bracketed `{{...}}` output to falsy/empty inside `run_if` evaluation only (prompt expansion elsewhere is untouched, preserving the "agent sees the raw placeholder and refuses to fabricate" fallback).
Wired `record`'s gate in `.agentflare/workflows/repo-compare.json` to `{{cache_check}} != 'MISS' OR {{verdict}} != ''` — skips only on a fresh-analysis run with no verdict, still runs on a legitimate cache-hit passthrough.
**Tests:** added two unit tests directly against `compile_run_if` (`run_if_or_treats_unset_var_as_falsy_not_its_own_placeholder_text`, covering MISS+no-verdict skip / MISS+verdict run / cache-hit run; and `run_if_and_requires_both_sides`). Full `flare-workflow` crate suite: 29/29 passing, no regressions. JSON file validated as well-formed. Confirmed no other workflow file in the repo uses `run_if`, so this grammar change is isolated to `repo-compare.json`.
**Concerns:** the `OR`/`AND` split is a plain substring match, so a quoted literal containing the literal substring `" OR "` or `" AND "` would misparse — acceptable per the task's own scope note ("string-only, no full expression language"), but worth remembering if this grammar gets reused elsewhere.
Agentflare-Branch: task/181-repo-compare-json-gate-record-against-a
Agentflare-Item: 181-repo-compare-json-gate-record-against-a
f644eb4 to
9367452
Compare
…llow-up) CodeRabbit on #803 asked for a test exercising the dispatcher route rather than the compiled git shim directly. agentflare-shim's PATH dispatcher sets LEAN_CTX_AGENT before routing a command through lean-ctx -c git, but that marker was in neither agent-detector 0.2.1's catalog nor the AGENTFLARE_AGENT check, so a caller reaching this shim only via that route would misclassify as human and bypass the canonical-mutate guard entirely. - agent_invocation_detected() now also checks LEAN_CTX_AGENT directly. - human_shim strips it too, since it is ambient under lean-ctx sessions. - New test proves both branch-create and HEAD-detach stay denied under this marker, with the escape hatch set, matching the existing CLAUDECODE tests. Agentflare-Agent: claude-code_2-1-281_harness Agentflare-Branch: task/637-flare-git-shim-agent-settable-agentflare Agentflare-Item: 637 Agentflare-Session: 85157ad7-4af8-4643-ae34-bcbbf05e7434
…ical-mutate guard (#803) * fix(git-shim): agent-invoked calls can no longer self-clear the canonical-mutate guard (item 637) deny_canonical_detach_reason checked AGENTFLARE_GIT_ALLOW_CANONICAL_MUTATE before checking agent_invocation_detected(), so an agent denied by the worktree-mandatory guard could set the override itself and mutate the canonical checkout directly -- this happened twice in practice, most recently detaching the user's main working-directory HEAD. Reorder the checks so the override is only reachable for non-agent-invoked (human/interactive) calls; the stranded-checkout checkout/switch recovery path (main.rs:502) is left untouched since it's narrow and already audited. Flip the existing escape-hatch tests to assert denial for agent-invoked callers and add a test confirming human/interactive use is unaffected. Agentflare-Agent: claude-code_2-1-281_harness Agentflare-Branch: task/637-flare-git-shim-agent-settable-agentflare Agentflare-Item: 637 Agentflare-Session: e402be06-2dbb-4058-bb61-bf38039c7d27 * fix(git-shim): classify LEAN_CTX_AGENT as agent-invoked (item #637 follow-up) CodeRabbit on #803 asked for a test exercising the dispatcher route rather than the compiled git shim directly. agentflare-shim's PATH dispatcher sets LEAN_CTX_AGENT before routing a command through lean-ctx -c git, but that marker was in neither agent-detector 0.2.1's catalog nor the AGENTFLARE_AGENT check, so a caller reaching this shim only via that route would misclassify as human and bypass the canonical-mutate guard entirely. - agent_invocation_detected() now also checks LEAN_CTX_AGENT directly. - human_shim strips it too, since it is ambient under lean-ctx sessions. - New test proves both branch-create and HEAD-detach stay denied under this marker, with the escape hatch set, matching the existing CLAUDECODE tests. Agentflare-Agent: claude-code_2-1-281_harness Agentflare-Branch: task/637-flare-git-shim-agent-settable-agentflare Agentflare-Item: 637 Agentflare-Session: 85157ad7-4af8-4643-ae34-bcbbf05e7434
Only
repo-compare.jsonusesrun_if, so this change is isolated. Done.What I did: Extended
compile_run_ifincrates/flare-workflow/src/json.rsto support a single top-levelOR/ANDcombining two atomic conditions (each still==/!=/bare-truthy), and fixed a landmine I hit along the way:expand_variablesleaves an unresolved{{var}}as literal template text rather than empty string, which would have madeverdict != ''spuriously true whenevercomparenever ran. I now normalize any still-bracketed{{...}}output to falsy/empty insiderun_ifevaluation only (prompt expansion elsewhere is untouched, preserving the "agent sees the raw placeholder and refuses to fabricate" fallback).Wired
record's gate in.agentflare/workflows/repo-compare.jsonto{{cache_check}} != 'MISS' OR {{verdict}} != ''— skips only on a fresh-analysis run with no verdict, still runs on a legitimate cache-hit passthrough.Tests: added two unit tests directly against
compile_run_if(run_if_or_treats_unset_var_as_falsy_not_its_own_placeholder_text, covering MISS+no-verdict skip / MISS+verdict run / cache-hit run; andrun_if_and_requires_both_sides). Fullflare-workflowcrate suite: 29/29 passing, no regressions. JSON file validated as well-formed. Confirmed no other workflow file in the repo usesrun_if, so this grammar change is isolated torepo-compare.json.Concerns: the
OR/ANDsplit is a plain substring match, so a quoted literal containing the literal substring" OR "or" AND "would misparse — acceptable per the task's own scope note ("string-only, no full expression language"), but worth remembering if this grammar gets reused elsewhere.Opened by
claude-codeon flared:51bb8de6c33b for item #181 via agentflare.Summary by CodeRabbit
ORandANDlogic for more flexible automation.