Skip to content

fix(ratchet): a new file inherits old-name lines only from files the change deletes - #1785

Merged
eldad-caura-ai merged 1 commit into
mainfrom
ratchet-new-file-moves
Oct 2, 2026
Merged

eldad-caura-ai merged 1 commit into
mainfrom
ratchet-new-file-moves

Conversation

@eldad-caura-ai

Copy link
Copy Markdown
Member

What

A line in a file the change adds now counts as moved only if a file the change deletes held the same text. Deletions from files that survive no longer pay for it, so the line is charged as new even when the repo-wide count of its text didn't rise.

  • New and deleted files come from git diff --name-status --no-renames. A renamed file is a deletion plus an addition, so it inherits from its own source however heavily it was edited, with no similarity threshold involved.
  • New files are visited first. Otherwise an existing destination of the same text could spend the budget on what is really the move, and both files would fail.
  • The failure text explains the rule. A failing new file whose text the repo already had is labelled (0 -> 1, new file: inherits only from deleted files).

Why

This closes the "new prose" gap from the rebrand close-out (action 7: treat old names in new files as new, even when the same text exists elsewhere).

Copies already failed, because the repo-wide count goes up. What was left was the move excuse. A new page or module that repeated a common branded line, such as an install command or a URL, passed whenever the same change deleted an identical line anywhere else. _minted's docstring calls that coincidence undecidable by counts. For new files it no longer has to be decided.

The cost

A line moved into a new file out of a file that stays (a split or an extract) now fails. #882 excused that because no marker reason described a move. For a new file, either a marker states the case truthfully (legacy-name-ok, legacy-name-floor), or the line is unrenamed debt being written into new prose. Whole-file renames, including heavily edited ones, still pass.

Testing

  • Suite: tests/test_legacy_name_ratchet.py passes, 210 tests, run the way the required workflow runs it (a two-file checkout, Python 3.13, pytest>=9.1.1,<10.0).
  • Five new tests, each confirmed to fail when the part of the rule it guards is removed:
    • test_a_move_into_a_new_file_from_a_file_that_stays_is_an_addition: fails if the rule is removed.
    • test_a_new_file_inherits_from_the_file_this_change_deletes: fails if new files can't inherit.
    • test_a_deleted_line_is_inherited_once: fails if inheritance doesn't use up the deleted line.
    • test_a_new_file_takes_the_charge_not_an_existing_destination (both sort orders): fails without the new-files-first ordering.
  • Eight existing tests modelled "a move between existing files" with a destination the change created. They now commit the destination first, which is what their docstrings describe. Their assertions are unchanged.
  • Replay: I replayed the last 40 first-parent commits of caura main and caura-enterprise dev under the old and the new script. Every commit gets the same verdict. A spot check confirmed both versions really ran.
  • Lint and gates:
    • ruff check (repo config) is clean on both files.
    • ruff format --check --isolated passes on the script (test_the_engine_stays_formatter_stable).
    • The legacy-name ratchet finds no new lines, and the do-not-touch sentinel reports all 35 strings survive.

Rollout

The org-wide required check runs the engine from ratchet-stable, which is at ccd11eb8 (2026-09-16). That branch also lacks #1732, which landed on 2026-10-01. Neither change applies to other repos until ratchet-stable is moved forward after this merges. It's a fast-forward, since ratchet-stable is an ancestor of main.

🤖 Generated with Claude Code

@eldad-caura-ai
eldad-caura-ai requested a review from a team as a code owner October 1, 2026 22:30
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

🤖 Review by Claude Code

Claude Code Review ✅ No issues found.


Reviewed by claude-sonnet-5-5 · cost $0.22409225

…change deletes

A line in a file this change adds now counts as moved only if a file the
change deletes held the same text. Deletions from files that survive no
longer pay for it, so the line is charged as new even when the repo-wide
count of its text did not rise.

This closes the "new prose" gap from the rebrand close-out (action 7: treat
old names in new files as new, even when the same text exists elsewhere).
Copies already failed, because the repo-wide count goes up. What was left was
the move excuse. A new page or module that repeated a common branded line,
such as an install command or a URL, passed whenever the same change deleted
an identical line anywhere else. The gate's own docstring calls that
coincidence undecidable by counts. For new files it no longer has to be
decided.

Renames keep passing. The new and deleted files come from
`git diff --name-status --no-renames`, so a renamed file is a deletion plus
an addition, and it inherits from its own source however heavily it was
edited, with no similarity threshold in play. New files are visited first,
so an existing destination of the same text is not charged for what is
really the move.

The cost, taken knowingly: a line moved into a new file out of a file that
stays now fails. #882 excused that because no marker reason described a
move. For a new file, either a marker states the case truthfully
(legacy-name-ok, legacy-name-floor), or the line is unrenamed debt being
written into new prose.

Tests: five new ones, each confirmed to fail when the part of the rule it
guards is removed. Eight existing tests modelled a move between existing
files with a destination the change created. They now commit the
destination first, which is what their docstrings describe. Replaying the
last 40 commits of caura main and caura-enterprise dev gives the same
verdict under the old and new rule for every one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: eldad-caura <eldad@caura.ai>
@eldad-caura-ai
eldad-caura-ai force-pushed the ratchet-new-file-moves branch from e229653 to a20bcf9 Compare October 2, 2026 12:12
@eldad-caura-ai

Copy link
Copy Markdown
Member Author

@erni-a please arprpveo

@eldad-caura-ai
eldad-caura-ai merged commit 71b8883 into main Oct 2, 2026
14 checks passed
@eldad-caura-ai
eldad-caura-ai deleted the ratchet-new-file-moves branch October 2, 2026 12:25
@caura-deploy-bot caura-deploy-bot Bot mentioned this pull request Oct 2, 2026
erni-a pushed a commit that referenced this pull request Oct 3, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>backend: 3.21.0</summary>

##
[3.21.0](backend-v3.20.1...backend-v3.21.0)
(2026-10-03)


### Features

* **contradiction:** add a per-tenant switch to turn contradiction
detection off (SIDE-58)
([#1761](#1761))
([8ce0fff](8ce0fff))
* **search:** per-request recall_boost/entity_boost opt-outs on REST
/search ([#1763](#1763))
([9a6eb4e](9a6eb4e))
* **stats:** report pending background work and a settled flag on GET
/memories/stats ([#1768](#1768))
([5ea8f80](5ea8f80))


### Bug Fixes

* apply the same identity, trust, fleet and visibility rules across
write paths, lifecycle and audit
([#1775](#1775))
([b58759f](b58759f))
* **audit:** give the audit flusher's storage-slot acquire its own
budget (oss-0927-m-04)
([#1741](#1741))
([ac33b26](ac33b26))
* **ci:** isolate review tools from runner credentials
([#1784](#1784))
([5bc489e](5bc489e))
* **ci:** validate review-memory authors before model capture
([#1783](#1783))
([2273911](2273911))
* **embed:** record the re-embed give-up that reported success
(oss-0924-m-05) ([#1733](#1733))
([d9ee8a5](d9ee8a5))
* **enrich:** record the enrichment give-up that reported success
(oss-0927-m-02) ([#1736](#1736))
([94a142b](94a142b))
* **events:** refuse a forge dry_run instead of silently running for
real ([#1737](#1737))
([2e10e33](2e10e33))
* **graph:** preserve relations with surviving evidence
([#1787](#1787))
([37f8f15](37f8f15))
* **graph:** validate relation errors and tenant-scope overlap seeds
([#1782](#1782))
([17da42f](17da42f))
* **interview:** accept adapter streams and bind them to their agent
([#1788](#1788))
([3930964](3930964))
* lifecycle dedup cadence, bulk write ordering, fresh reads, skill fleet
scope, PII policy on edits
([#1772](#1772))
([f5983a0](f5983a0))
* lifecycle, storage, write-path and configuration reliability
([#1776](#1776))
([adca395](adca395))
* **lifecycle:** settle the embed-backfill topic on one spelling
([#1739](#1739))
([586b249](586b249))
* **llm:** refuse anthropic structured output instead of silently faking
it (oss-0915-m-01)
([#1742](#1742))
([fab8174](fab8174))
* low-batch (oss-0909-l-02, l-03, l-04)
([#1744](#1744))
([77abe9e](77abe9e))
* **plugin:** align tool parameters and document requests with REST
([#1779](#1779))
([b3ef98d](b3ef98d))
* **plugin:** bound credential provisioning and reject API redirects
([#1780](#1780))
([8bf503d](8bf503d))
* **plugin:** honor auto-write opt-out for conversation persistence
([#1778](#1778))
([ad8f8c3](ad8f8c3))
* **plugin:** preserve keystone truncation and normalize tool results
([#1781](#1781))
([1adae88](1adae88))
* **plugin:** refuse to send the API key over plain HTTP to non-loopback
hosts (oss-0917-m-01)
([#1745](#1745))
([4981f45](4981f45))
* **ratchet:** a new file inherits old-name lines only from files the
change deletes ([#1785](#1785))
([71b8883](71b8883))
* **ratchet:** read a JSON key's $comment marker on the line below it
([#1732](#1732))
([a196921](a196921))
* respect memory visibility in lifecycle passes, keep distinct entities
apart, bound Google LLM calls
([#1771](#1771))
([bed4935](bed4935))
* **search:** caller-named top_k beats profile/tenant default top_k
([#1764](#1764))
([47c2796](47c2796))
* **search:** honour explicit top_k on recent_context; expose retrieval
strategy header ([#1762](#1762))
([b6dde15](b6dde15))
* **settings:** let a null unset a search.default_profile knob
([#1765](#1765))
([0e6f4ab](0e6f4ab))
* **storage:** compile the stats breakdown filter without psycopg bind
casts ([#1790](#1790))
([11d5d13](11d5d13))
* **tasks:** record the three known-open give-ups; exclude the audit one
(oss-0927-m-03) ([#1746](#1746))
([2f6c247](2f6c247))
* **tests:** let unit-marked tests run without a database
([#1747](#1747))
([51542cb](51542cb))
* tighten fleet command validation, installer URL handling and settings
storage ([#1769](#1769))
([f96768c](f96768c))


### Dependencies

* bump the uv-minor-patch group across 4 directories with 9 updates
([#1770](#1770))
([0194ce6](0194ce6))
* update sqlalchemy[asyncio] requirement from &lt;2.1,&gt;=2.0.51 to
&gt;=2.0.51,&lt;2.2 in /core-storage-api
([#1758](#1758))
([1e9d73f](1e9d73f))


### Documentation

* **embedding:** stop telling operators the nightly sweep repairs
unembedded rows (oss-0927-h-01)
([#1740](#1740))
([b6cc308](b6cc308))
* **embedding:** the gateway's None is not queued for a backfill sweep
(oss-0927-m-01) ([#1735](#1735))
([5e1179e](5e1179e))
* update Eldad's GitHub handle to
[@eldad-caura-ai](https://github.com/eldad-caura-ai)
([#1767](#1767))
([d148bb6](d148bb6))
</details>

<details><summary>plugin: 2.23.4</summary>

##
[2.23.4](plugin-v2.23.3...plugin-v2.23.4)
(2026-10-03)


### Bug Fixes

* apply the same identity, trust, fleet and visibility rules across
write paths, lifecycle and audit
([#1775](#1775))
([b58759f](b58759f))
* **plugin:** align tool parameters and document requests with REST
([#1779](#1779))
([b3ef98d](b3ef98d))
* **plugin:** bound credential provisioning and reject API redirects
([#1780](#1780))
([8bf503d](8bf503d))
* **plugin:** honor auto-write opt-out for conversation persistence
([#1778](#1778))
([ad8f8c3](ad8f8c3))
* **plugin:** preserve keystone truncation and normalize tool results
([#1781](#1781))
([1adae88](1adae88))
* **plugin:** refuse to send the API key over plain HTTP to non-loopback
hosts (oss-0917-m-01)
([#1745](#1745))
([4981f45](4981f45))
* tighten fleet command validation, installer URL handling and settings
storage ([#1769](#1769))
([f96768c](f96768c))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: release-please[bot] <release-please[bot]@users.noreply.github.com>
Co-authored-by: caura-deploy-bot[bot] <265395343+caura-deploy-bot[bot]@users.noreply.github.com>
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.

2 participants