Skip to content

gate: say what the floor ratchet actually defends - #48

Open
iceteaSA wants to merge 1 commit into
cortexkit:masterfrom
legion-works:gate/ratchet-refusal-text
Open

iceteaSA wants to merge 1 commit into
cortexkit:masterfrom
legion-works:gate/ratchet-refusal-text

Conversation

@iceteaSA

@iceteaSA iceteaSA commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to your correction on #46. The refusal text taught the mechanism you got wrong, and I shipped it, so this replaces it with what the check actually defends.

What I reproduced before agreeing

squash stale(610) onto upstream(616)     ->  floor 616, gate.sh staged: 0 files
fork-before-raise, edits the floor line  ->  UU scripts/gate.sh, 1 conflict marker

A squash applies the diff rather than the branch's file contents, so master's raise survives and gate.sh is not even in the staged set. A branch that does touch the line conflicts loudly and GitHub refuses the merge. Neither path is silent, and the old text described the first one as the headline failure mode.

The silent route is the one you named: a human resolving that conflict by keeping their own side — which is what happened on this repo an hour before #46 landed. The check also covers a plain hand-edit downward, on a branch or on master, so the new text names both.

Rendered, not read off the diff

Tripped the arm with a lowered floor rather than trusting the string:

GATE FAILED: floor ratchet: this tree's workspace floor is 600 but origin/master
(408fc40) carries 618 — a squash does NOT carry a stale floor onto master (the diff
wins, and a branch that edits this line conflicts loudly), so the way a raise actually
gets dropped is a human resolving that conflict with --ours, or a hand-edit here;
re-measure on the merged tree, or set CK_GATE_FLOOR_LOWER_REASON

First attempt at that render died at inbound contracts before reaching the ratchet, because I had created the worktree without its sibling checkouts. The arm never ran, and the gate's failure was mine rather than the code's — worth mentioning because a gate that fails early looks the same as a gate whose later arm failed, if you only read the exit code.

Scope

One string. bash scripts/gate.sh exit 0 on the merged tree, workspace floor 618 >= origin/master 618 at 408fc40.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Replaces the floor ratchet refusal message so it no longer teaches a wrong mechanism. The old text claimed a fork-before-raise lowers the floor silently; actually a squash applies the diff so the raise survives, and a branch touching the line conflicts loudly. The new message names the real silent paths: a human resolving the conflict with --ours, or a hand-edit downward.

Written for commit 4a8a623. Summary will update on new commits.

Review in cubic

The refusal text asserted that a branch forked before a raise lowers the floor
silently and every gate still passes. Nothing verifies that sentence and it is
wrong. Constructed both paths on a scratch clone:

  squash stale(610) onto master(616)   -> floor 616, gate.sh not even staged
  fork-before-raise, edits floor line  -> UU, conflict marker

A squash applies the diff, not the branch's file contents, so master's raise
survives; a branch that does touch the line conflicts loudly and GitHub refuses
the merge. Neither is silent.

What is silent is a human resolving that conflict by keeping their own side --
which happened on this repo an hour before cortexkit#46 landed, by hand, and taking
--ours on the floor line would have dropped the raise with nothing to catch it.
The check also covers a plain hand-edit downward, on a branch or on master.

A refusal message is read exactly when someone is confused and looking for an
explanation, which is the worst place to keep a plausible wrong one. This says
what the check defends and names both routes that reach it.

Rendered by tripping the arm rather than read off the diff:

  GATE FAILED: floor ratchet: this tree's workspace floor is 600 but
  origin/master (408fc40) carries 618 -- a squash does NOT carry a stale floor
  onto master (the diff wins, and a branch that edits this line conflicts
  loudly), so the way a raise actually gets dropped is a human resolving that
  conflict with --ours, or a hand-edit here; re-measure on the merged tree, or
  set CK_GATE_FLOOR_LOWER_REASON

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

You’re at about 94% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/gate.sh">

<violation number="1" location="scripts/gate.sh:296">
P3: The new failure message refutes the doc comment directly above `assert_floor_not_lowered`, which still asserts the mechanism this PR is correcting. The comment at scripts/gate.sh:234-235 says a fork-before-raise branch "carries the OLD number forward in this file and merges green, silently reverting the raise", while the new message says "a squash does NOT carry a stale floor onto master (the diff wins, and a branch that edits this line conflicts loudly)" and that the raise is dropped only by a --ours resolution or a hand-edit. A reader debugging a gate failure now gets two mutually exclusive explanations of the same hazard in one function. Update the comment block (including the "Live instance" paragraph) to the corrected mechanism, or the file's own rationale rebuilds the confusion the PR set out to remove.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread scripts/gate.sh
return
fi
fail "floor ratchet: this tree's workspace floor is $ours but $target ($target_sha) carries $theirs — a branch forked before a raise lowers it silently and every gate still passes; rebase and re-measure on the merged tree, or set CK_GATE_FLOOR_LOWER_REASON"
fail "floor ratchet: this tree's workspace floor is $ours but $target ($target_sha) carries $theirs — a squash does NOT carry a stale floor onto master (the diff wins, and a branch that edits this line conflicts loudly), so the way a raise actually gets dropped is a human resolving that conflict with --ours, or a hand-edit here; re-measure on the merged tree, or set CK_GATE_FLOOR_LOWER_REASON"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The new failure message refutes the doc comment directly above assert_floor_not_lowered, which still asserts the mechanism this PR is correcting. The comment at scripts/gate.sh:234-235 says a fork-before-raise branch "carries the OLD number forward in this file and merges green, silently reverting the raise", while the new message says "a squash does NOT carry a stale floor onto master (the diff wins, and a branch that edits this line conflicts loudly)" and that the raise is dropped only by a --ours resolution or a hand-edit. A reader debugging a gate failure now gets two mutually exclusive explanations of the same hazard in one function. Update the comment block (including the "Live instance" paragraph) to the corrected mechanism, or the file's own rationale rebuilds the confusion the PR set out to remove.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/gate.sh, line 296:

<comment>The new failure message refutes the doc comment directly above `assert_floor_not_lowered`, which still asserts the mechanism this PR is correcting. The comment at scripts/gate.sh:234-235 says a fork-before-raise branch "carries the OLD number forward in this file and merges green, silently reverting the raise", while the new message says "a squash does NOT carry a stale floor onto master (the diff wins, and a branch that edits this line conflicts loudly)" and that the raise is dropped only by a --ours resolution or a hand-edit. A reader debugging a gate failure now gets two mutually exclusive explanations of the same hazard in one function. Update the comment block (including the "Live instance" paragraph) to the corrected mechanism, or the file's own rationale rebuilds the confusion the PR set out to remove.</comment>

<file context>
@@ -293,7 +293,7 @@ assert_floor_not_lowered() {
       return
     fi
-    fail "floor ratchet: this tree's workspace floor is $ours but $target ($target_sha) carries $theirs — a branch forked before a raise lowers it silently and every gate still passes; rebase and re-measure on the merged tree, or set CK_GATE_FLOOR_LOWER_REASON"
+    fail "floor ratchet: this tree's workspace floor is $ours but $target ($target_sha) carries $theirs — a squash does NOT carry a stale floor onto master (the diff wins, and a branch that edits this line conflicts loudly), so the way a raise actually gets dropped is a human resolving that conflict with --ours, or a hand-edit here; re-measure on the merged tree, or set CK_GATE_FLOOR_LOWER_REASON"
     return
   fi
</file context>

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