Skip to content

fix(cli): make --dry-run predict a refused hook-script rewrite (#1387) - #1473

Merged
DeusData merged 1 commit into
mainfrom
fix/dryrun-predicts-hook-refusal
Aug 7, 2026
Merged

fix(cli): make --dry-run predict a refused hook-script rewrite (#1387)#1473
DeusData merged 1 commit into
mainfrom
fix/dryrun-predicts-hook-refusal

Conversation

@DeusData

@DeusData DeusData commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Second half of #1387 — the part the reporter explicitly flagged: "--dry-run prints the same three-group summary, so you can't catch it before it bites."

Cause

With dry_run set, gate_ok/session_ok/subagent_ok were assigned true unconditionally, so the preview always claimed all three hook groups. When the on-disk script is not ours (user-modified, or a manual install embedding another binary path) the real install refuses the rewrite — so the preview promised what the run could not deliver.

Fix

  • cbm_text_owned_document_status() — a read-only classifier mirroring text_migrate_owned_document's decision without writing: absent / already current / an exact released document ⇒ the write proceeds; anything else ⇒ refused.
  • The dry run calls it per script, so the summary reflects reality, and every refused script is named with the reason rather than silently omitted (silence reads as "nothing to do", which is exactly what hid this).

Verification

cli_dry_run_predicts_refused_hook_script_issue1387 exercises the real dry-run path over an unowned gate script and asserts the warning names it. RED before (three groups promised, no warning), GREEN after, RED again on revert. cli + agent_profiles + config_text_edit: 292 passed, lint-ci clean, suite re-run twice for determinism.

The dry run claimed EVERY hook group as installable because gate_ok /
session_ok / subagent_ok were simply set to `true` when dry_run was on. When
the on-disk hook script is not ours - user-modified, or written by a manual
install pointing at another binary - the real install refuses to rewrite it,
so the preview promised what the run could not deliver. That is the second
half of #1387: the reporter had no way to see the loss coming, and said so.

- New read-only predicate cbm_text_owned_document_status() mirrors
  text_migrate_owned_document's decision WITHOUT writing: absent / already
  current / an exact released document => a write would proceed; anything else
  => it would be refused.
- The dry run uses it per script, so the three 'hooks:' lines now reflect what
  will actually happen, and each refused script is NAMED with the reason.
  Silence was the original defect: an unmentioned group reads as 'nothing to
  do', not 'this will be skipped'.

Test: cli_dry_run_predicts_refused_hook_script_issue1387 runs the real
dry-run path over an unowned gate script, capturing stdout, and asserts the
warning names the script. RED before, GREEN after, RED again on revert.
cli+agent_profiles+config_text_edit: 292 passed; lint-ci clean.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData
DeusData enabled auto-merge August 6, 2026 14:42
@DeusData
DeusData force-pushed the fix/dryrun-predicts-hook-refusal branch from a32c0da to d35589c Compare August 6, 2026 14:50
@DeusData
DeusData merged commit 7865b87 into main Aug 7, 2026
115 of 135 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