Skip to content

Key project memory by repository identity, not folder name - #1724

Open
michael-wojcik wants to merge 321 commits into
mainfrom
issue-1677-repository-identity-memory
Open

michael-wojcik wants to merge 321 commits into
mainfrom
issue-1677-repository-identity-memory

Conversation

@michael-wojcik

@michael-wojcik michael-wojcik commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

What this changes

pact-memory keyed a project's memory by the working directory's basename. That split one repository across machines whenever its folder was named differently, and merged unrelated repositories whenever they shared a name — this store held 2,535 rows under one folder name and a handful under generic names like Sites.

The project id is now derived from the repository.

  • Canonical id: host/owner/repo from the normalized origin remote. Host lowercased, path case preserved (a case split is recoverable, a merge is not), scheme-default ports dropped and non-default ports preserved, userinfo stripped before anything is logged.
  • Override: <git-common-dir>/pact-project-id, shared by every worktree, read for the identity root of whichever rung wins. An in-tree .pact/project-id is ignored: a clone, tarball, vendor copy or submodule can plant one.
  • Resolution order: supplied > repository override > CLAUDE_PROJECT_DIR > session record > worktree-identity fallback > git root > decline > user-scope setting > cwd.
  • Declines: a present network remote that cannot be represented, a declaration that cannot be honoured, or a .git marker git cannot answer for declines with the remedy named, rather than silently becoming a basename. Every decline carries a structured {source, reason, override_path} on project-id show and memory status.
  • Redirected checkouts: a .git FILE pointing at another repository's git directory is refused on every route — the worktree-admin shape, the submodule-admin shape, and a bare .git target. A deinit-ed submodule admin dir, whose core.worktree is unset while its origin survives, is treated as unprovable and declines.
  • Migration: reads widen to the caller's own legacy basename bucket while it still holds rows, gated by a plausibility check over absolute file paths. Writes bind the canonical id from the first save. project-id rekey --from <id> [--to] [--dry-run] [--apply] [--candidates] moves a bucket transactionally; a link whose path cannot be re-tracked is quarantined and reported rather than aborting a half-applied update.
  • Disclosure: status, show, the save envelope and the exclusion warning all carry source, id_shape, the candidate buckets with counts, and a shlex-quoted, runnable command rendered by ONE shared helper. A bucket excluded by the gate, suppressed by the submodule guard, or present only as a case variant is named with the literal command that moves it.

A repository-chosen name cannot become a store key

A project id is a store key, so any route that lets a repository pick that name is a read-scope grant. Five measured routes, three of them introduced by the migration and now closed:

  • Case fold: the legacy candidate folds to a case variant, so a checkout named foreignproj read the bucket ForeignProj. The fold is now gated on the identity root's filesystem: it happens only when the filesystem demonstrably cannot distinguish the spellings, never when that is undeterminable. A suppressed case variant is disclosed with its rekey command instead of being read.
  • Tracked .gitmodules name: [submodule "PACT-prompt/x"] path = docs made a docs/ checkout union the user's real PACT-prompt bucket. The legacy candidate is now suppressed when the resolved common dir lies under a submodule admin dir — by PATH SHAPE, so a default-named submodule's shared modules bucket is covered too.
  • Submodule path as the primary id: a submodule whose origin is a non-portable local path fell back to the checkout path's basename, and a tracked path = checks/ForeignProj then read AND wrote that bucket. A basename-derived id is refused for the submodule shape; a canonical origin or an operator pin still answers, and ordinary local repositories still basename by ruling.
  • Deinit-ed admin dir: git submodule deinit unsets core.worktree but leaves the origin, so a forged .git file could bind the victim's canonical id. An unset or unreadable core.worktree under .git/modules/ is now unprovable and declines.
  • Read-side writes: list, search, search_by_file, sync, get_status and _resolve_id_or_full initialised a store they were only reporting on — 35 CREATE VIRTUAL TABLE IF NOT EXISTS vec_memories statements per pass, and a 0-byte store grew to 102,400 bytes. A read-only scope now blocks schema creation, vector-table init and migrations; the WAL switch moved into init_schema behind busy_timeout.

Measured

  • Identity and touched-surface suite at the final head a950b6c9: 4,694 passed, 4 skipped, 0 failed, 0 errors across 81 modules (every module importing one of the changed scripts, plus every changed module), rc 0. Lint gate: both Ruff legs green (ruff 0.17.3).
  • The forged-pointer matrix is mutant-proven: with the declared-redirect guard disabled, four declared/record cells bind the victim and fail; with it enabled, all fifteen cells and the positive controls pass. The deinit-ed admin dir has its own read-and-write arm beside a live-submodule control.
  • The zero-CREATE class pins three shapes across six verbs: an existing 0-byte store is never initialised; a caller-named absent store answers empty and stays absent; a derived-location absent store bootstraps, which is the pre-existing production contract and a documented exception to the clause.
  • Mutation matrix at the fixed head: 15 mutations, each reddening exactly the arm it names (one co-red with a same-mechanism sibling, reported rather than hidden; one non-mutant discarded and re-issued at the call site).
  • Rekey on a byte-identical copy of the real 103 MB store: dry run changed no row; apply moved 2,554 memories, 53 file rows and 2,554 vectors with byte-identical embedding blobs in one transaction; a trigger-injected mid-transaction failure rolled back completely with foreign_key_check empty; a second apply was a no-op; the live store's hash was unchanged before and after every probe. The live PACT-prompt bucket is still included by the read union — the narrow guards cost it nothing.
  • Version 4.8.35 in all five release files, above main's 4.8.34.
  • CI fast-suite passed at that head; Bugbot completed with "no issues found", its summary confirming it ran; every review thread is resolved.

Fixed during this review

  • A remote whose scp path is absolute (git@host:/srv/git/repo.git) declined instead of canonicalising; it now yields the same id as the URL spelling.
  • A .git-marked directory where git cannot answer fell back to a folder basename; it now declines, walking the way git does.
  • Two read-path failures — a deleted cwd, and an embedded NUL in a stored file path — now fail closed.
  • save committed the memory before refusing a path, and a re-key stranded a poisoned link; the path list is validated before the connection and the cascade quarantines what it cannot re-track.
  • A present store that could not be opened answered {"ok": true, "result": []}; it now reports the error and names the remedy, so an unreadable store never reads as "no memories".
  • The recovery command every surface printed did not exist, was malformed in the CLI's own example, and omitted --db-path; it is now a runnable absolute-path command carrying the store, and a test executes it.
  • The plausibility gate's verified is an existence test, not an ownership test. That is now stated on every surface: a widened read can return rows from another checkout that happened to share the folder name, and an unverified inclusion is a discovery to review, not proof of ownership.
  • Smaller: unescaped paths in warnings, a false BOM comment, leading-whitespace classification, a duplicate length cap, a stale graph_stats comment, an exclusion warning that rendered a PosixPath repr, and rekey counters that under-reported.

Reviewer notes

  • The legacy bucket is shared by every repository whose current folder name matches it until an explicit rekey. That is today's behaviour; the change stops new memory accumulating there and makes the candidate visible.
  • The plausibility gate discriminates a same-name bucket; it does not certify one. The disclosure reports included_unverified as a first-class state rather than implying proof.
  • A copied database whose folder was renamed on the other machine still needs one project-id rekey.
  • status censuses every populated bucket in the store (ids and counts, no memory content) — required so a large stranded bucket cannot be silently omitted.
  • Vector search returns at most --limit: confirmation against stored projects widens the fetch to a fixed budget, so a store with many stale vector rows can return fewer results, including none, while matches exist. The bound is documented and pinned.
  • track_file is deliberately single-scope; get_file_ids(path, None) deliberately resolves the NULL-project row. The backlog filename stays folder-keyed on purpose.
  • Two accepted residuals, each documented with its reason in the architecture record: a .git FILE pointing at an arbitrary external git dir (a bare clone or a --separate-git-dir store) still binds that repository's identity, because refusing it would break the legitimate separate-git-dir control and reaching it requires knowing that path; and the .git/modules path-shape test declines a checkout whose own path literally sits under such a directory rather than binding it.
  • Reads still create WAL sidecars on a data-bearing store (measured), which is a store-directory side effect, not a schema CREATE; the derived-location first-run bootstrap is the other documented exception.

Refs #1677

@cursor cursor 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.

Stale Bugbot comment from a previous run.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

…t misdirected a rekey

The secretary's calibration count filtered on one project id, so a
session reading a canonical bucket beside an admitted legacy bucket
counted only part of its own records. sync now reports read_scope, the
list of project ids it read under (empty with no identity), on every
outcome, and the secretary counts with `json_each` over that list. When
sync did not run or the list is empty, the gate is reported as not
determined rather than counted. Its wording now names the folder name
as the key only when the origin is absent or local; an unrepresentable
origin declines, and sync reports empty with a null project_id.

Two refusals still printed angle-bracket placeholders: the unresolved
target's `--to=<canonical id>`, which the envelope escaped to U+003C,
and the missing-`--from` refusal's raw `<id>`. Both now print their
placeholders as typed. The CLI help told the reader to follow the
candidate `project-id show` names, said --to defaults to the detected
canonical id, and promised a rekey command for every bucket; it now
gives the memory skill's rule: only this checkout's own non-excluded
bucket carries a command, the command names both ends, and --apply
runs only with the user's explicit approval. The sync help also names
the status for a project with memories and no CLAUDE.md.

Tests pin the help through format_help and the real CLI's statuses,
check every rekey refusal and the show and status remedies for an
escaped bracket, and run the secretary's SQL against a two-bucket
store. A search-window test now asserts its vector-path preconditions,
so an ordering-dependent failure names its cause.
… identity code

find_git_marker resolved every GIT_CEILING_DIRECTORIES entry. Git keeps
entries that follow an empty entry exactly as written, without
resolving symlinks, and ignores relative entries. So a ceiling given as
a symlink after an empty entry stopped this walk where git keeps going,
and a relative entry stopped it where git ignores the entry; in both
cases a checkout could resolve a different repository from the one git
reports. The entries are now parsed by git's rule, and a real-git
differential across nine settings pins agreement with git rev-parse.

The shipped identity scripts (project_identity.py, memory_api.py,
database.py, backlog.py) and the test modules that exercise them
carried review and design labels, issue numbers and finding ids in
comments, docstrings and assertion messages, some of which
predate this branch. They are replaced with the behaviour each one
named, and no code token changes. A scan over those scripts and the
test modules this branch added pins their absence, with planted
positives and clean negatives for every label shape.

The two changes share project_identity.py, and the scan reads that
file, so they land together.
The user-scope `project_id` setting in config.json was read from the
memory directory of whichever store a command named. A command run with
--db-path pointing at another store therefore read, or missed, a
different user setting, so the same checkout could resolve to two ids
depending on the store argument.

config.get_user_memory_dir() returns the user memory directory with the
store scope set aside, and the setting is read there. The memory skill
says the file lives beside the default memory.db and that --db-path
does not move it. Tests pin the code path with a different store
selected, and the override module now patches the user-scope lookup.
Identity detection re-ran git subprocesses it had already run: the
working-directory repository root was derived again after the identity
root had been found, the divergence check re-resolved an id it already
had, and the worktree redirect check re-asked git for the git dir and
top level it was handed. Detection in a linked worktree made 7 git
calls and an in-repository save made 9, with repeats in both.

The constructor seeds the working-directory root from the identity root
when a git rung resolved it, the divergence check returns the resolved
id when the two roots agree, and the redirect check takes the git dir
and top level it is given. The two paths now make 5 and 4 calls with no
repeated command, and tests pin both counts.
…cascade

A present memory store that was not a SQLite database, or was corrupt,
fell through every read-only command with a bare SYSTEM_ERROR ("file is
not a database", "database disk image is malformed") and no remedy.
SQLite raises those as DatabaseError, and the handlers caught only
OperationalError, so the named remedy an unopenable store already got
was skipped. In a repository the rekey dry run also exited 2 from its
scope read, breaking its exit-3 contract.

project-id show, status, rekey --candidates and the rekey dry run now
name the remedy for such a store: check that --db-path names a PACT
memory store, or restore the file from a backup, and the store was not
modified. Exit codes stay 2 for the reports and 3 for rekey. Tests run
each command against random bytes and a corrupted real store, inside
and outside a repository, and check that the store bytes are unchanged.

The census docstrings now state what is measured: an absent or
schema-less store answers empty, and a present store that cannot be
opened or read raises with the remedy. The update docstring and the
memory skill document that a file link whose path cannot be re-tracked
stays on the old project, is counted in last_cascade_skipped, and never
aborts the re-key.
The location-divergence check compared the save's project with a
working-directory repository root and identity cached on the instance
at construction. A process that changed into another repository between
constructing its memory object and saving therefore got no divergence
warning, where the lazily filled cache it replaced still warned on the
first save.

The cached root and identity now record the directory they were derived
for. Each check compares that directory with the current one, which
costs one getcwd and no git call, and derives both again when it has
moved. A test constructs in one repository, changes into another and
expects one warning naming it; a control confirms the unmoved check
makes no git call, so the reduced call counts hold.
The calibration SQL in the secretary's instructions used numbered
placeholders, ?1 and ?2. Python's sqlite3 treats those as named, so
binding them from a sequence warns on Python 3.12 and is refused from
3.14, and a secretary running the count from Python would lose the gate.

The SQL now uses :name and :scope, and the instructions say to run it
with Python's sqlite3 and bind the mapping {"name":
"orchestration_calibration", "scope": json.dumps(read_scope)}. A test
reads the SQL and the binding from the instructions, builds the mapping
by parsing it rather than evaluating it, and runs the query with
warnings as errors against a read-only store with two buckets. The
sync read-scope test binds the same way.
The search-window test's child process warmed the embedding service
before the CLI ran, so the CLI's own first load was never the one the
test exercised. The flake that change was written for has no measured
cause: no failing log was kept and ten reproduction runs passed. What is
measured is the mechanism: a child that cannot embed falls back to
keyword search without saying so, and the test then failed as a missing
target.

The child now runs cli.py as __main__ through a wrapper that warms
nothing. It records whether the embedding service was loaded before
the CLI ran, and after the CLI exits it reports the vector path as
ready, unavailable or prewarmed from the same process. A degraded child
fails on unavailable and an injected warm-up fails on prewarmed, so
either cause is named rather than read as a missing result.
The planning-label scan covered the identity scripts but not
hooks/shared/backlog.py, which derives the same repository identity
and which this branch edited, so a label planted there passed. The
file joins the scanned scripts. It scans clean today, and a label
planted in one of its docstrings now fails exactly its case.
Three CI-environment binding tests failed whenever the suite ran from a
copy of pact-plugin/ alone. Each built its stand-in verify module
lazily, inside the patched loader. Outside a source checkout the
binding finds no repository root, so its hooks return before they call
the loader; the stand-in was never built, the source-checkout guard
inside it never ran, and each test asserted on a hook that had done
nothing. The five sibling tests skip in that layout. These three
failed there on main as well.

Each now builds the stand-in in the test body, before the gate is set,
so the same guard fires. Outside a source checkout the three skip with
the siblings' reason; in a source checkout they run and pass; and a
source checkout missing the verify script fails them, as it fails
their siblings.
On a store with a damaged page, status ran the embedding catch-up,
whose pending-work query still answered, and inserted vectors (about
1 MB on the measured store) before the same command failed with a bare
"database disk image is malformed". From outside a repository it wrote
and exited 0. That write predates this branch, but this branch's remedy
text told the user the store was not modified.

Once the catch-up has found pending work, and before its first write,
it runs PRAGMA quick_check on a read-only connection; on failure it
reports the fault, skips, and writes nothing. A session with no pending
work pays nothing. Running the check on every status cost two to five
times status's own time on a cold cache (about 1 s at 13 MB, 4 s at
53 MB), and running status's own reads first missed this store from
outside a repository, so both were rejected. The CLI's catch-all now
routes any sqlite DatabaseError through the store remedy, so every
command names it.

Opening a store in rollback-journal mode for writing switches it to WAL
and rewrites header fields, here and on main alike, so the remedy now
ends "no memory was written to it", which holds in every case, rather
than "the store was not modified". Tests cover a corrupt WAL store
(file byte-identical, embedder never called), a corrupt rollback-journal
store (nothing past the header changes beyond the fields an open
rewrites), and an intact store whose catch-up still embeds.
The CLI catch-all routed every sqlite DatabaseError through the store
remedy, including an error whose text already was that remedy, so most
store-fault messages printed it inside itself. Through the real CLI,
22 of 36 messages across show, status, rekey --candidates, the rekey
dry run, list and search, for random-bytes, unreadable and corrupt
stores, inside and outside a repository, were nested; 2 were already
nested before, where the rekey dry run wrapped the legacy probe's
remedy.

A built remedy is now raised as StoreFaultError, a subclass of
OperationalError, and the remedy builder returns such an error's text
unchanged. Every wrapper already calls that builder, so none changed,
no text is matched, and every handler and exit code stays as it was.
All 36 messages now carry the remedy exactly once, and a test checks
each faulting cell for exactly one remedy and its exit code.
decline_record's docstring still said override_path is None "when no
repository was found", while the code leaves it null for four causes:
a redirected .git file, a bare repository, a broken .git marker and a
declaration that no longer resolves. The memory skill already listed
those four, but nothing tied either document to the code.

The docstring now names the four causes. A test derives the null set
from every decline site in memory_api.py and project_identity.py,
counting a cause as null only when no site gives it a path, and
requires the memory skill's list and the docstring's list each to equal
it. A new null cause in the code, or a dropped or added name in either
document, fails the test; the docstring is compared with its whitespace
collapsed, so it can wrap.
A .git file naming the admin directory of a linked worktree of a
repository created with --separate-git-dir makes git report a working
tree and the victim's origin for the forged checkout. The worktree
listing check run from the target repository already refuses it as a
redirect, but no test named the layout, so a change to that check could
reopen it silently.

A test builds the layout with fresh repositories and a fake origin, and
covers the forged checkout at its root, from a subdirectory, declared
as the project directory, and declared at a subdirectory. Each must
resolve no id, report a redirect decline with no override path, read
nothing, refuse a save and leave the victim's rows untouched. A control
shows the genuine worktree still resolves the victim's id. The four
refusal cases fail on the commit before the listing check was added.
The twelve mode-000 cases of the store-fault remedy test make a store
unreadable with chmod and pass only when the suite is not root: as root
the read succeeds and the case fails on its exit code. The unreadable
store test in test_caller_path_is_not_created.py guarded the same way
with an inline uid check instead of the repository's marker.

Both now carry the requires_non_root marker, and only the mode-000
parameters are marked. Across the 40 test modules this branch touches,
these are the only cases that rely on file mode bits to provoke a
failure. Under a pretended root the fifteen cases skip with the marker's
reason and every other case still runs.
On a page-corrupt store with no vector table, status still changed the
file and then reported that no memory was written: the catch-up's
pending-work query opened a read-write connection, whose setup created
the vector table and its shadow tables before the integrity check ran.
A trace of every statement on every connection, across show, status,
rekey --candidates, the rekey dry run, list and search, for corrupt
stores with and without a vector table, found that query to be the only
write before the check.

The query now runs under the existing read-only scope on a store that
already has its memories table, so it creates nothing; with no vector
table every memory counts as pending. A store with no memories table is
still initialised there, since that is where a derived store gets its
schema, and the first embedding still creates the vector table. The
test for this runs the real pending query through the CLI and checks
the store bytes.

The catch-up tests were also order-dependent: their loader removed the
module from sys.modules but left a stale attribute on the package, so a
later fixture patched a module the code no longer used and the real
query ran. The loader now removes that attribute too.
A mutation pass over the remediation's guards found four whose removal
no test noticed: the worktree back-link check, the worktree
admin-directory check, the integrity check's handling of reported rows,
and the working-directory id cache. Each guard was correct, but every
existing case was already stopped by an earlier check, so the guard
never decided anything.

Each now has a case built so only it can stop the input: an entry whose
admin directory names a different path, a forged entry naming another
repository's linked worktree, a store whose integrity check returns rows
instead of raising, and an id cached before the working directory moves.
Each case fails with its guard removed and passes with it in place. The
prunable-entry check has no such case, because git marks an entry
prunable only when its directory is gone, which the next check already
drops.
The origin reader implemented git 2.46's rule that an empty
remote.origin.url value clears the urls before it. Git 2.43 has no such
rule and fetches the first url. With a list of A, an empty value and B,
git 2.43 fetches A while the identity keyed to B; with A followed by an
empty value, git 2.43 fetches A while the identity fell back to the
folder name. Choosing by git's version would give one repository two ids
on two machines sharing a store, which this change exists to prevent.

An empty or whitespace-only value anywhere in the list now declines as
an unrepresentable origin on every git version, with the override path
as the remedy and no extra git call. The decline carries a fixed detail
sentence naming the cause, which the warning and the unresolved refusal
print once; the raw list is never echoed. A test runs a real git fetch
against a fake ssh beside the decline and records the version-dependent
target. The docstrings and the changelog that described the reset rule
are corrected.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

The catch-up's integrity check opened its read-only connection with
the standard library's sqlite3, while every other store access goes
through the store driver (pysqlite3 when installed) with the vector
extension loaded. On this machine both link the same SQLite and agree:
quick_check returns ok on a healthy store with a vector table through
either driver, with or without the extension, and both report the same
rows on a corrupt one. A pysqlite3 build that bundles its own SQLite
would judge the file with a different engine than the one that writes
it.

The check now connects through the store driver and loads the vector
extension the way the pending-work query does. A failed extension load
is logged and the check runs without it, because quick_check does not
need it, so a load failure cannot read as corruption. The check still
runs only once pending work is found. A test runs the real catch-up on
an intact store that already has vectors and a pending memory, and
asserts the pending memory is embedded.
…ds them

Equivalent ssh and scp spellings of one remote produced different ids,
and two different directories could produce one id. A leading `~/` was
kept in the path, so `git@host:~/srv/repo` and `git@host:srv/repo`
split; an ssh url's `%2F` stayed inside one segment although git
decodes it to a separator; and an scp path's `%` was decoded although
git sends it literally, so `git@host:srv/%41bc` and `git@host:srv/Abc`
merged.

A leading bare `~/` is dropped for ssh, git+ssh, ssh+git and scp
(`~user/` and a lone `~` are kept), `%2F` splits an ssh url's path,
https keeps it, and an scp path's `%` is kept as `%25`. Azure DevOps
Services hosts keep decoding the scp path, because their server
decodes it, so all six Azure spellings still give one id. Each rule is
checked against the argv git 2.43 hands a fake ssh. Of the 775 remote
literals in the suite, 17 change id, all in these three classes.

classify_remote_origin's decline list, RootIdentity's decline_reason
sentence and detect_id_for_root's order docstring now match the code.
The test that a submodule inside a superproject worktree reads only its
canonical bucket passed even with the submodule-name suppression
removed: no recorded session had written the `vendor` bucket, so the
session-evidence gate refused it first and the suppression was never
reached.

The test now seeds a recorded session of the checkout that wrote the
bucket, so the evidence gate would admit it and only the suppression
keeps it out. With the suppression removed, both cases fail.
The legacy plausibility gate verified a bucket when a file row sat
anywhere under a gate root. A repository whose folder contains a
separate checkout therefore verified that checkout's same-named bucket
from its rows, and read it.

A file row now counts for a root only when no directory strictly
between the root and the row has its own `.git`, except a `.git` file
naming a git dir under the root's own `<common dir>/modules/`: a
registered submodule's rows stay the superproject's. Linked-worktree
gate roots take the same per-root test. On the reporter's rig the
nested checkout's bucket is now excluded; a superproject bucket whose
rows all sit in submodules is still verified.
A delivered checkout whose `.git` was a symlink to another checkout's
`.git` directory, or to a submodule's admin directory, bound that
repository's identity and read and wrote its bucket. The redirect check
tested `is_file()`, which follows the link and sees a directory, so it
treated the checkout as ordinary. The same target written as a `.git`
file was already refused.

A symlinked `.git` is now resolved to its target, and the target goes
through the same predicate a gitfile's `gitdir:` target does, so the two
routes cannot disagree. Absolute, relative and chained links to another
checkout's `.git` or a submodule admin directory are refused as
gitfile_redirect at every surface. Worktree-admin, bare and `repo`-style
`.repo/projects/<name>.git` targets behave as before, a separate git
directory not named `.git` still binds its own identity as before, and
a symlinked parent folder still resolves.
`project-id rekey` with `--to` left out moved this checkout's legacy
bucket even when it was unproven, that is, when no file row or recorded
session tied it to this repository, so one command could relabel
another checkout's memories under this repository's id. The unproven
and case-variant warnings also printed the rekey command through `%r`,
so pasted as printed it was one quoted word.

A defaulted `--to` now refuses an unproven bucket with REKEY_REFUSED
and moves nothing; `legacy_verdict` reports `unproven`, and an explicit
`--to` is unchanged. Both warnings print the shell-quoted command, and
the `show`/`status` rekey field and the case-variant command go through
one renderer that returns null for an id rekey would refuse. A command
holding a control character is not put in a log line; the warning
points at `project-id show`, whose JSON escapes it.
The memory skill said a missing store answers `store_absent: true`.
With `--db-path` naming a store that is not present, the CLI refuses
with DB_PATH_NOT_FOUND (exit 1) and creates nothing; only an absent
default store answers `store_absent: true`. The skill also said `--to`
may be left out for this checkout's own non-excluded bucket, which no
longer matches the code: a defaulted `--to` now refuses an unproven
bucket too.

The rekey row and the exit-code note now state both behaviours, and
DB_PATH_NOT_FOUND is listed among the exit-1 codes. Prose arms pin each
clause; deleting or inverting any of them reddens its arm.
…where the trace cannot follow

The store-work git pin traced an argument back through locals, self
attributes and callers, to a depth of eight, and stopped silently beyond it.
It did not follow a project function's return value or a write into a
container, so a store-work value could reach git through a helper, a list,
a starred argument or a deep chain without failing it.

The trace now has no depth bound: each expression is visited once in each
calling context, so it ends on any chain and on cycles. It follows the
values a call returns (a project function, a nested function, a local or
parameter holding a callable, a table lookup, a runner), every write into
a container (writer methods, item and attribute stores, aliases, writes a
callee makes, module-level tables), attributes, defaults, and starred and
unpacked arguments. A parameter read inside a function entered through a
call holds that call's arguments. A form the trace cannot follow fails the
pin: a computed callee, a callable it cannot name, or a function handed to
code whose calls it cannot see. Writes through setattr, vars() or a
standard-library function, and values carried by exceptions, are listed as
adversarial-only. A method named like a built-in container or str method
on a value the census cannot type is read as the built-in, a limit listed
with a pin on the two project methods that share such a name.

The stricter trace found one real flow on honest code. A write's
disagreement check hands the env and record values to
format_project_dir_disagreement, whose kind check asks git rev-parse about
the recorded project directory. That flow runs after the identity is
detected and is keyed on its own directory, so the two disagreement
conditions now carry a second reason suffix that says so. The pin allows
the flow only as an argument of that function and only for those two
conditions, traces each such argument on its own, and checks that each
call handing it over sits in a PACTMemory method other than __init__.

Rows cover each followed form, the fail-closed forms, the adversarial-only
list, a nine-step chain, a cycle and the allowance's keys. The trace caches
bindings and callees, and the tests that read it share one trace per tree.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

The advisory fast-suite runs serially and was cut off at 45 minutes on a
slow runner. Three of this PR's test modules repeated the same work for
every test. Each repeat is now built once and shared, and no test,
assertion or census population changes.

- test_remediation_identity_resolver: the listing-answer walk re-parsed
  memory_api and backlog on every call, so the binding reader cached by
  tree was rebuilt each time. The two modules are now parsed once per
  text of each file, so the reader is built once.
- test_remediation_identity_parser: each of the 1549 header forms built
  a new repository with five git commands. One repository is now built
  per module and each form copies it to its own folder. A main
  checkout's .git names no path outside itself, so the copy is the same
  repository at a new path.
- test_identity_rung_parity: each git-call floor cell created a store
  schema. The empty initialized store is now built once per text of the
  schema module and copied, with schema, rows and pragmas equal to a
  store created in place. The layout-predicate walk ran three times; it
  now runs once per text of project_identity and set of its module
  globals, and each caller gets its own copy of the result.

Serial time on one machine, before and after: resolver 101s to 41s,
parser 61s to 45s, rung parity 103s to 85s.
The route census proves by reading code that no value the memory store
work reads reaches a git command. It does not follow a value written
into a container item, or the result of a callable outside the project
such as copy.copy. A new module, test_store_work_git_values_runtime.py,
backs those two limits at runtime.

It builds one repository, an isolated HOME and config dir, and a store.
It puts a sentinel string into every field of a saved row, a file row, a
second bucket's id, the session ids of a legacy bucket, those sessions'
records (live folders and prune-ledger lines) and a disagreeing
session's record. Then it runs each store-work command once through a
git that logs every call's arguments, directory, and the GIT_*, PATH and
HOME variables. The commands are save, save --no-sync, update, update
--replace, sync, search, status, project-file, project-id show, delete,
and rekey with --candidates, --dry-run, --apply, an explicit --to and a
refused --from. Any sentinel in a git call fails the test.

Each sentinel must also be shown read in the run. Row values must appear
in command output. The session records and the prune ledger must be
opened, which an audit hook in the CLI process records. The legacy
bucket has no file rows, so the read scope checks its session evidence.
Each record either names another directory or starts before the
repository's description, so none counts as evidence and every one is
read. The description itself is read only for its ctime, so no string
can mark it.

The one allowed flow is the disagreement check. A write whose
CLAUDE_PROJECT_DIR disagrees with the session record asks git about the
recorded project directory. Each of the four write sites (save, update,
delete, sync) runs once with that disagreement, and must ask exactly
--show-toplevel and then --git-common-dir of that directory, once each,
and refuse.

Planting a row value into a git command's arguments in search, through a
dict item or through copy.copy, fails the test at its leak assertion.
The module takes about 10 s on an idle machine.
A call of `get` or `update` on a value the census cannot type was read
only as the built-in method, so a store-work value returned by
PACTMemory.get on an untyped receiver reached git without failing the
pin. Such a call is now read both ways: as the built-in, and as every
loaded project method of that name.

Reading by name alone hit honest code 402 times (every dict `.get`). A
receiver proof, `_builtin_receiver`, now decides when a value is a
built-in or standard-library object, so the by-name reading is skipped
for it. It asks `_foreign` first and then reads the value's form:
displays, comprehensions, built-in and standard-library class builds,
items and content methods by level, isinstance narrowing, comprehension
scope, *args and **kwargs, module objects, dataclass field values by
slot, and project-function returns. Honest-code hits on production: 0.
Top-level proofs are cached, so the pin stays within the time cap.

A method call no longer narrows what the trace reads from its receiver.
`obj.method(...)` was read as the attribute "method" of `obj`, so a
value written into a dict or list and read back with `.get()` or
`.pop()` never reached the git argument.

The pin's docstring names two limits of the static census, by ruling:
an item a project object was written into, and the result of a
non-project callable that hands back its argument. A pin fails if that
list changes, with one row per form. Rows cover each receiver-proof
form, both readings, the container read-back, the adversarial-only
narrowing rebind and positional field build.
The runtime test that fails when a marked store-work value reaches git
did not run list, get, search with --current-file or search with
--claude-md-root, and it ran save and sync only with a declared root.
All of these read store values. It now runs each of them once.

The test also pins the set of routes it runs, so dropping one fails it.
Each route whose output carries store rows (search in its three forms,
list and get) must print a marked row.

Every command and flag of the CLI's parser is now covered, except two
forms run through the same paths. Positional JSON input to save and
update changes only how a value arrives, and --limit only caps how many
rows come back.

The module now runs 26 CLI processes and takes about 14 s serial, up
from about 10 s.
The backlog commands refused with exit 65 from inside a checkout's .git
(the folder itself, a folder below it, or a linked worktree's admin
dir), declared and undeclared, because the backlog's root lookup asked
main_repo_root for the raw start. The memory skill's two detection rungs
already mapped such a start to its checkout (git_dir_checkout); the root
lookup did not.

One helper, _start_and_toplevel, now asks --show-toplevel and, when git
gives a common dir but no top level, asks again from the checkout that
git dir belongs to. Both detection rungs use it, keeping their question
order. main_repo_root uses it whenever its caller leaves the top level
unasked, which covers the backlog's root lookup, the filing-time
location check and project-id show's process root, so backlog.py and
cli.py are unchanged.

Measured on real repositories with a logging git, against the parent
commit: backlog add and show from the four inside-.git starts, declared
and undeclared, go from exit 65 to filing in main.json with project_path
main, at 7 git commands with none repeated (main 96900e5 filed there
too but asked two questions twice in an add, one in a set, and one in
a show run before the backlog file existed). From
such a working directory project-id show now reports the checkout as
process_repo_root, and a save declared for another project gets the
location warning, as from the checkout itself. Every other start and
route (main, a subfolder, a linked worktree, a separate-git-dir folder,
a submodule checkout and its git dir, a bare repository, a
separate-git-dir store) has the same exit code, git command count and
output as the parent commit. A bare repository and a separate-git-dir
store still refuse add, show and set, and write nothing.

The new test file fails its 8 filing rows at the parent commit and with
only the main_repo_root line reverted. The source pin in test_project_id
follows the moved --show-toplevel question.
…cases

Read verbs (search, search_by_file, get, list, status) run their lazy
initialization inside the read scope. They add no CT columns, create no
vector table and defer the embedding-dimension migration to the first
call outside a read scope. As before, the embedding catch-up still
writes vectors into a vector table that already exists. An absent
store on the derived route is still bootstrapped on first use.

A store from before v3.8.0 stays searchable: the keyword search reads
only the text columns the store has.

Inside a read scope, get_connection refuses an absent store instead of
leaving a 0-byte file.

project-id rekey:
- With no default store, a defaulted target is refused for the same
  inputs a present store refuses, instead of reporting success.
- A dry run opens the store in the read scope and keeps its journal
  mode.
- relations_repointed counts each moved relation once.
- A store that is present but cannot serve the command exits 3 from
  show and --candidates, as it already did from rekey.

Every sqlite-vec load goes through database.load_sqlite_vec, which
turns extension loading back off after the load.

The prune ledger is cut back to the whole lines in its last 1 MiB once
it passes 2 MiB.

The Working Memory managed comment names the memory config.json
setting and the home-directory folder name as keys.

New arms in tests/test_store_read_purity_and_rekey_counts.py; each
fails with its fix reverted. Tests that pinned the old exit code, the
old comment text, the old mock module and one stale census row are
updated.

CHANGELOG: the project-id bullet, the read-purity clause, the corrupt-
store exit codes (status keeps exit 2), a bullet for the four store-layer
gaps, and the Working Memory comment bullet now describe these changes.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

Comment thread pact-plugin/hooks/session_end.py Resolved
Rung parity: key the copied empty store on every schema input (schema
module text, read-only scope, vector extension state, embedding
dimension and the schema functions), so a patched input gets a fresh
store; filter the profiler by predicate name and file before reading a
return value, and make the NotImplemented truth warning an error in the
module; check the home-walk oracle against _git_skips_marker and the
derived origin rule against read_origin's own-file rule.

Runtime store-work test: let a session record vouch for the legacy
bucket last, so a list prints its rows and they join the read evidence,
and run rekey --from on that bucket with --to defaulted. The release
note's route list and run time now say so.

Other arms: a scope read outside a detection pass is not served inside
one; the override byte cap is tested at and past the cap; the forged
submodule declarations assert the exact declined identity; the two
name-provenance saves expect the resolver's refusal instead of
swallowing any error; the parser accepts every documented project-id
verb and flag; the answer eval binds only pure builtins; the submodule
arm skips with git's reason when the submodule cannot be added; the
roots-lookup test asserts one listing and no repeated git question
instead of absolute counts; one control message is reworded.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

- A github.com remote's owner and repository are lower-cased in the id,
  because GitHub treats them case-insensitively; every other host keeps
  its path's case.
- The backlog accepts git's listing of a separate-git-dir main worktree
  at the folder holding a git dir named .git, so the main checkout is
  among its own roots on current and older git.
- An undeclared start inside a bare repository or a separate-git-dir
  store is checked from the working directory, so the refusal names the
  root check and its remedy instead of advising CLAUDE_PROJECT_DIR.
- A submodule's linked worktree stays unknown when git, asked from the
  common dir's parent, says it is inside a git dir, whether core.worktree
  is set or unset.
- With core.worktree unset in a submodule's git dir, a save from the
  submodule's checkout files under that submodule's own origin when git
  names the checkout as its top level; elsewhere the redirect is still
  refused.
- A worktree admin dir's gitdir file is read through the one bounded,
  regular-file-only reader, which moves to shared/git_helpers.py, so a
  FIFO there cannot block project-id show or project-file.
- The legacy-memory warnings say "1 memory", the description-ctime
  docstring says what ctime measures, and the pruned-session index
  docstring names both of the reaper's writes.
- Tests pin each change, with a timeout-bounded child process for the
  FIFO, and the route census names the two reader calls the detection
  path now makes into shared/git_helpers.py.
The session reaper bounds pruned-sessions.jsonl by cutting it back to the
whole lines in its last 1 MiB once it passes 2 MiB. The cut-back truncated
the file in place and then rewrote it, and the store's ledger reader takes
no lock, so a read between the two calls found no lines at all.

The kept lines now go to a temp file in the ledger's folder, which is
synced and renamed over the ledger, so the reader sees the whole old file
or the whole new one. A failed rename removes the temp file and leaves the
old ledger whole.

A rename gives the ledger a new inode, so a writer that opened the old file
and then waited for the lock would append to a file no one reads. It then
finds that file over the limit, cuts it back and renames it over the new
ledger, dropping any line another writer had appended there. Every append
now goes through one opener that, after taking the lock, compares the open
file with the one at the path and reopens on a mismatch, at most eight
times.

Tests: a reader run before and after every write, truncate, sync and
rename of a cut-back never sees fewer lines than the result (the in-place
version gives 0); a writer held on the old file while another cuts back
and a third appends keeps all three lines (without the check, or with it
before the lock, the third writer's line is lost); a refused rename leaves
the old ledger and no temp file. The open-flag census row for the ledger
writer now names the new opener, which holds the flag reads.
The home walk's own judgement of whether git looked past a .git
directory is now a helper, and a new arm builds the one layout where its
top-level comparison decides: a .git directory that is a linked
worktree's git dir with its common dir in another repository. Git names
the folder as its top level and that .git as its git dir, so both the
walk's judgement and _git_skips_marker must keep it as a marker.

A new arm writes an override file a thousand times the cap and counts
the bytes the reader takes from it: the file is refused as too long from
at most the cap plus one byte, so a reader that reads the whole file and
checks afterwards fails.
The store-work value pin follows a helper's parameter only into the
attribute the helper reads, so a helper handed the store object no longer
inherits every write into that object. It also follows two shapes it read
as built-ins: a local an isinstance test narrowed and then rebound in the
function's own statements, and a field filled by position through a
classmethod's cls(...), type(self)(...), self.__class__(...) or a local
bound to the class. What stays listed adversarial-only needs deliberate
indirection: a walrus inside a comprehension or a nonlocal rebinding, and
a class reached through a table or getattr.

The route census derives the reasons it can compute from the code (record
builds, compiled literal patterns, hook-free classes in annotations, as
values and as bases) instead of listing them, so NOT_A_ROUTE holds only
judgement rows. The layout walk keys each form it cannot read by the
function the form calls and derives each reason from the live site, so
renaming a record class or a local no longer fails either census, while a
new form, a hook on a base or a new input still does. The docstring
sentence pins of the trace's ADVERSARIAL-ONLY and LIMITS lists check each
listed form's anchor and the row that proves it. Each of the three census
files records, in one table, why each exact-text pin it keeps is needed.

The planning-label scanner catches surface tags in any case and ids
inside a camel-case name, and the labels it now finds in the identity
tests are renamed to what each test checks.

The secretary's Working Memory step names every key the projection can
have, the home-directory checkout and the user setting included, and
counts a session as legacy evidence only when it was launched at the root
of the repository or of one of its linked worktrees. Its test runs the
resolver on a real layout for each case the passage names and the
evidence check for a root and a subfolder launch, tied to the prose by
short phrases.
The prune-ledger cut-back writes the kept lines to a new file in the
ledger's folder and renames it over the ledger. A crash between creating
that file and the rename left it in the slug folder for good: the session
reaper skips files, and nothing else removed it.

The cut-back now names the file itself, '.' + the ledger's name + '.' + 8
lowercase hex digits, created with O_CREAT|O_EXCL (which refuses any
existing name, a symlink included) and retried on a collision, so the
name no longer depends on tempfile's internals. At the start of every
cut-back, while the writer holds the ledger's lock, it removes the regular
files in that folder whose whole name matches that pattern. A cut-back's
file exists only while its cut-back holds the lock, so none of these is in
use. Symlinks, folders and every other name stay; errors are ignored.

Tests: a planted leftover is gone after the next cut-back, while the
ledger, a session folder, near-miss names, an unrelated file, and a
folder and a symlink with the exact name stay; and, as a control, a second
writer that would cut back too waits on the lock while a cut-back's file
is being written, and that file is not removed.
The store-work value pin lists a field filled by position through a class
reached by a table or getattr as adversarial-only. A new test fails if any
production module the pin reads calls a subscript or a call result with
positional arguments, and tells the author to classify the site. Today there
are none: over the pin's graph (45 modules, 1013 defs) the count of such
calls is 0.

The wider count, which also takes in calls of a parameter or a local that
holds a callable, is 25, and none of them can build a class. Seven are
parameters that hold a function (cli.py _best_effort_report's action, the
_with_store_scope decorator's method, background_work's two mutator calls,
pact_context's reader, state_file's two apply calls), two are the CLI's
handler taken from its table of command functions, and sixteen are
pin_caps' spend, a bound method or a lambda. Every caller passes a
function, a bound method or a lambda, and the trace follows these through
their callers, so they are not pinned: a table of them would fail on a
behaviour-neutral rename.

The planning-label scanner no longer flags a version token inside a
camel-case name (getV2Api, ApiV3Client, parseV10Response). Every label it
caught before, a camel-case finding id included, still fails it.
The memory skill told an agent never to pass --db-path, and also to run
the rekey command the CLI prints, which carries one. It now says the
printed command names the store the CLI resolved: run it exactly as
printed, its --db-path included, and never add --db-path yourself.

Session evidence for a legacy bucket counts only for a session launched
at the root of the repository or of one of its linked worktrees; a
session launched in a subfolder keeps its own session folder and is not
read. The skill, its pin and the release notes' Summary now say so. The
Summary also says what an unproven bucket does: its rows are left out of
list and search, each still answers get, and list, search and
project-id show print a warning with the rekey command.

The release notes name the identity memo the detection pass keeps (by
root, common dir and asked directory) beside the other kept answers,
and say what project-id show gave the other checkout before a
separate-git-dir pin: the origin's id, with source CLAUDE_PROJECT_DIR
in a declared session and origin remote in an undeclared one.

The v4.8.36 section merges bullets that restated one another: the
bounded and FIFO-safe readers, the redirect refusal and its remedies,
one remedy per verb, the include scan's headers, the include-only
origin, the empty and -z worktree listings, and six groups of test
bullets. Each merged bullet keeps every claim of the bullets it
replaces. With the two bullets this commit adds, the section goes
from 181 bullets to 164.
A session whose first memory call is a read ran its once-per-session
embedding catch-up under the read scope. With no vector table, or with
an embedding-dimension migration due, that sweep could not write, but it
still spent the session's attempt, so rows saved without an embedding
stayed invisible to vector search for the rest of the session.

The read now runs the catch-up only when a vector table already exists
at the current dimension. In that case the only write it makes is
vector rows for memories not yet embedded. Otherwise it postpones the
catch-up without spending the attempt. The first call outside the read
scope then runs any migration that is due, followed by the catch-up.
Each of the three cases has its own test: no table, a table with an
unembedded row, and a migration due. The comments that said the
catch-up writes under the read scope now state this one exception.

Every sqlite-vec load in the plugin goes through
database.load_sqlite_vec, which turns extension loading back off after
the load. A test now fails
if any other plugin code names enable_load_extension or load_extension,
or loads sqlite-vec through its module.

project-id rekey with a defaulted --to that equals --from now returns
the same no-op success as an explicit --to equal to --from, instead of
refusing. The refused-canonical route in the runtime git-value test now
uses another repository's canonical bucket, and its assertion requires
the canonical-bucket refusal itself.

The release notes state the catch-up exception, the single load path
and the defaulted no-op.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

A legacy folder-name bucket is still read whole or not at all, but the
evidence is now counted per row. `_legacy_session_census` groups the
bucket's memories by writing session and places each session's record
(live context file, or its prune-ledger line once reaped) under every
slug folder: recorded at this repository's root or a linked worktree's
root, recorded elsewhere, launched in a subfolder, started before
`description` last changed, or unattributed. A bucket is unproven, and
not read, when any of its rows was written by a session recorded at
another checkout, whether or not its file rows place it here. The
unproven warning names the cause and the counts, `legacy_scope` carries
`sessions` and `unproven_reason`, and a repository with no `description`
file is vouched for by a root-launch session record alone. Rows with no
session record cannot be placed and do not block a bucket another row
vouches for; such a bucket is read with a once-per-process warning that
gives their count and the rekey command. The census reads the store
through `database.bucket_session_counts`, which replaces
`bucket_session_ids`.

Read-only opens of a store with no `-wal` add `immutable=1`, so `show`,
`sync` and the other read verbs leave no `-wal` or `-shm` behind. A
read whose store stamp (inode, size, mtime, `-wal` presence) moved, or
that raised a database error, is repeated once with locking. Measured
beside a committing, checkpointing writer for 20 s: every read that
moved or raised was repeated, and no wrong answer passed the check.
`_store_stat_key` names the one change the per-command scope cache now
misses: another process's commit and close between two scope reads,
inside one timestamp tick, with no change in size.

Git boolean values are parsed once, by git's rules, in
`git_helpers.git_config_bool` (0 mismatches against git over 3067
values), and both callers use it. The include scan honours value
continuation, a `%2Egit` suffix is stripped, an Azure collection name
matches in any case, and a whitespace-only origin url follows the
no-portable-origin rule. The cwd rung's separate HOME landing is
removed: `_identity_at_root` reaches the same landing, warning and
result. The forged `.git` pointer that binds a pin the victim wrote is
recorded as adversarial-only. Docstrings, a read-only probe that now
closes its connection on failure, a supplied id's prior count, and the
filesystem-root containment check are corrected, each with an arm.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

project-id rekey with a defaulted --to refuses a legacy bucket that the
read gate does not read. The refusal gave one fixed reason: no file row
places the bucket and no recorded session from this repository wrote
it. That was wrong for a bucket kept out because one of its rows was
written by a session recorded at another checkout, by a session
launched in a subfolder, or by a session that started before the
repository's description file last changed.

The refusal now states the read gate's own cause for the bucket, in
the same words as the read warning, because both are built from one
table. It also counts the bucket's memories by who wrote them: sessions
recorded here, sessions launched in a subfolder, sessions that started
before the description file last changed, sessions recorded at another
checkout, and no recorded session. Each of the four causes has a test
that checks the clause and the five counts.

The route census lists the table and its use in the refusal as inputs
read after detection, as it already does for the read warning. The
release notes say the refusal gives the same cause and counts.
…s git calls

Arms that could not fail on the change they guard:
- The HOME landing case redirects Path.home() to the rig's home and points
  the HOME variable elsewhere, so the case reaches the home landing; a new
  arm requires its warning, and fails when the resolver reads HOME.
- A --separate-git-dir worktree stays unknown when git cannot answer whether
  the common dir's parent is inside a git dir.
- Without `worktree list -z`, a second worktree's admin gitdir that is a FIFO
  is skipped, not waited on (a timeout-bounded child process).
- Each legacy-bucket warning names a count of one in the singular and counts
  of zero and two in the plural.
- An admin gitdir record padded with spaces, tabs and blank lines still names
  its worktree, as git lists it.
- The FIFO show test asserts the resolved project id; the FIFO reader test
  waits for the writer to block in its open instead of sleeping a second.
- The runtime value test dates its vouching session from the description's
  ctime.

The git-environment scan now reads hooks/shared/project_scope.py and run_git
calls (env by keyword or by position), and a census fails on a plugin module
that runs git and is neither scanned nor listed with the reason its calls are
not resolver calls. The release notes' git-environment guard bullet
says so.

The answer eval evaluates type, id, hash, callable, hasattr and getattr; a
three-argument type and a getattr default are judged by what they hold.

Test hygiene: scoped monkeypatches instead of a mid-test undo(), caches
cleared by name so a renamed cache fails, a read-only case marked
requires_non_root, a CLI arm run from its repository, a renamed test that
said more than it checked, a shadowed loop name, a restored content
assertion, docstrings that describe the code instead of its history, and a
missing final newline.

@cursor cursor 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.

Stale Bugbot comment from a previous run.

assert time.monotonic() < deadline, "the writer never waited in its open"
time.sleep(0.01)

class TestAGitFileThatIsNotARegularFileNamesNothing:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Skipif no longer covers FIFO tests

Low Severity

The skipif for missing os.mkfifo now decorates _wait_until_waiting_in_open instead of TestAGitFileThatIsNotARegularFileNamesNothing. Pytest never collects that helper, so the class runs on platforms without FIFOs and the FIFO arms fail on os.mkfifo.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9c3b183. Configure here.

A census test that reads Python source or a docstring and looks a fixed
string up in it is a change detector. Each module that holds such tests now
lists every one with its reason, and a scanner (source_text_pins) checks the
list both ways: an unlisted pin fails, and so does a listed function that no
longer pins anything. Four pins that only checked a token in the source now
run the code instead: the override reader's not_canonical reason, the rekey
envelope's fields, the remedy the legacy-write refusal prints, and the
update envelope's last_cascade_skipped.

- Move the code readers other test modules imported from
  test_identity_rung_parity.py into tests/fixtures/code_readers.py.
- The layout table's reasons say how the walk reads each function (a
  predicate, a refusal or not a predicate), not how its annotation is
  spelled, so rewording a type hint changes no row.
- The empty-store cache key covers load_sqlite_vec and sqlite_vec.load,
  with an arm for each.
- The computed-callee test also catches a local bound to a table lookup or
  a call result and then called; a table holding only the module's own
  functions is exempt.
- The label scanner states that its version-name exemption also passes a
  V-lettered id inside a name, and lists that form adversarial-only.
- The planning-label scan covers every file this change created, the two
  LLM-loaded files it edits and the memory scripts it edits, each whole,
  with a committed list checked for existence and for unlisted files.
- A census checks that every test the census prose names exists.
- The home-shape verdict drops a condition that never decided it, and the
  grammar probe passes every field to the node constructor.
Main published 4.8.36 with the parallel fast CI suite, so this branch's
release becomes 4.8.37. The merge keeps main's 4.8.36 release notes as
they are and puts this branch's section above them as 4.8.37. All five
release files now name 4.8.37.

The merge also carries the last prose of this round:

The secretary's calibration count takes its read scope from
`project-id show` after the sidecar check, whether or not the briefing
ran `sync`. A session that skips `sync`, as every session with a
resumption claim does, now reports the gate instead of "not determined".

The Working Memory comment written into every CLAUDE.md is cut from 617
to 342 characters. It names what keys the section, points to
`project-id show` for the key in use and how it was chosen, and keeps
that a decline writes nothing. Migrating a CLAUDE.md with no managed
block now drops a memory-section comment of any earlier wording, so the
rebuilt section carries the current comment once instead of both.

The memory skill says that an ssh host alias stays in the project id,
and that a pin holding the https form gives the alias clone the https
clone's bucket. The release notes name `case_variant` rekey rows in the
summary, and say what the comment and the migration now do.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 4 total unresolved issues (including 3 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 82a2ba7. Configure here.

A vector table left at an older dimension with no rows read as
"nothing stored". A read-first session ran the embedding catch-up into
it, every insert was refused for its width, and the once-per-session
attempt was spent; the migration skipped the table for the same
reason. The dimension is now read from the table's own declaration,
falling back to a stored vector, so an empty old-dimension table is a
migration due: a read postpones the catch-up and the first call outside
the read scope rebuilds the table, then catches up. A table whose
dimension cannot be read at all counts as due as well.

`project-id rekey --from=X --to=X` was refused as bad input when X was
a folder-name bucket, although an equal source and target moves nothing
and is documented as a no-op. It now returns the no-op success; a
folder-name target that differs from --from is still refused.

Every command now answers a store sqlite cannot open, read or write
with exit 3, as the project-id verbs already did, naming the store's
remedy when it has one. A save whose read-back finds no row, a failed
setup and any other unexpected error also exit 3. Exit 2 is left for a
usage error, a missing or invalid project-id argument, the field
validation error that lists the allowed fields, and the refusal to open
the default store from a test process that gave no --db-path.

The prune-ledger append, its cut-back and the teammate-registry rewrite
retry a short write until every byte is written, so a short write no
longer leaves a truncated line.

The refusal for an unproven bucket counts its memories with wording
that reads correctly for any number, and three comments that described
the change instead of the code are rewritten. The release notes state
each change.
…nked store's journal

An lstat or stat failure other than absence no longer reads as a missing
.git. find_git_marker and the unnamed-main-worktree check treat only
FileNotFoundError and NotADirectoryError as absent; any other error keeps
the marker, so git runs, fails, and the id declines as broken_git_marker
instead of naming the folder.

The legacy-bucket session census counts a session started in a separate
checkout nested under the root as elsewhere, not as a subfolder launch:
the session's own git marker must sit at a root. This also holds for a
checkout at "/".

A store reached through a symlink checks its -wal file beside the resolved
file, as SQLite writes it, in the stat key, the read-only connection and
the store stamp.

ssh://, git+ssh:// and ssh+git:// paths are url-decoded the way git
decodes them before it calls ssh, then re-quoted outside the raw segment
characters; the scp form stays literal. On a case-insensitive host,
lower-casing keeps percent escapes upper-case and drops a trailing .GIT.
backlog.py accepts the ssh+git scheme.

The git boolean parser accepts -2^31 with or without a unit, as newer git
does; every value either supported git accepts is accepted.

get, update and delete by full id reach a row outside the read scope;
the rule is now stated in _resolve_id_or_full. The warning and refusal
clauses avoid verb agreement, description_newer names the case where git
cannot name the repository, and the printed remedy for an id rekey refuses
names why. The remedy for a store that is not a database no longer names
--db-path, which the caller may not have passed; it names the file. The
worktree path no longer calls Path.cwd outside its guard,
and a dead fallback argument is removed.

This branch has not been deployed

No deployments
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