release v0.33.1: two Windows accounts can share one project (#317) #320

Merged
buildagent merged 16 commits from release-v0.33.1 into master 2026-10-06 10:10:51 +02:00
Member

Fixes #317. Field case: two different Windows accounts, an admin account and a desktop user, work in the same project folder. The account that writes the index locks the other one out.

What changes

  • Index files inherit the project folder's ACL on Windows. There is no more protected owner-only DACL. The invoking user's SID keeps an explicit entry, so the v0.32 elevated/non-elevated fix still holds. The rule: the index is never more private than the folder it was built from.
  • Old owner-only indexes are repaired on open. The two exact DACL shapes that earlier versions wrote are reset to inherited (via SetNamedSecurityInfoW) when the owner opens the index. Any other protected DACL is left alone and reported.
  • Another account's daemon is serving the project. daemon.toml stays owner-only, because it holds that daemon's token. The second account gets an immediate, permanent index_unavailable_other_account refusal that names the other account and the remedies (stop that daemon, work as that account, or --no-daemon --db <path>). Never warming_up, and no respawn loop.
  • Another account's daemon crashed. Liveness is decided by the daemon lock, not by the leftover file. This account's daemon starts, leaves the foreign file in place, and publishes daemon-<pid>.toml beside it when it cannot remove it.
  • One ordering rule for refusals. Every permanent refusal is decided before any stored raw open error can answer, in the same order on both legs: access denied, then another account's daemon, then a schema newer than this build (merged with the v0.33.0 ordering fix).
  • doctor reports an index whose ACL is narrower than its folder.
  • Unix stays owner-only, on purpose. One index exposes every indexed file, so following a group-shared folder would leak files that are more private than the folder. Documented on harden_permissions.

Verification (Linux, local)

  • fmt, plus clippy -D warnings for Linux and windows-gnu, plus cargo doc -D warnings --document-private-items.
  • other_account_daemon_e2e 2/2 on both legs, non-root and COSI_TEST_AS_ROOT=1.
  • index_access_denied_e2e, schema_newer_refusal_e2e, index_state_disclosure_e2e, oneshot_daemon_e2e, query_cli, exit_reasons_e2e, warmup_e2e, plus the mcp-server, perms/db, doctor and daemon lifecycle/takeover/restart lib tests.
  • version_site_registry, release_notes_quoting, doc_citation_gate.
  • Seven mutations were re-run after the merge with the v0.33.0 ordering; every one went red at its assertion.

Only native Windows CI can confirm

  • New index files carry the folder's inherited ACEs plus the user's SID.
  • Both old DACL shapes are reset when opened, and an unknown protected DACL is left alone.
  • The shared-lock probe behaves on Windows.
  • A SYSTEM-only daemon.toml refuses its own owner, and owner_of names the owner.
  • The crashed case: the daemon cannot delete the stale daemon.toml and publishes daemon-<pid>.toml.

🤖 Generated with Claude Code

https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu

Fixes #317. **Field case:** two different Windows accounts, an admin account and a desktop user, work in the same project folder. The account that writes the index locks the other one out. ## What changes - **Index files inherit the project folder's ACL on Windows.** There is no more protected owner-only DACL. The invoking user's SID keeps an explicit entry, so the v0.32 elevated/non-elevated fix still holds. The rule: the index is never more private than the folder it was built from. - **Old owner-only indexes are repaired on open.** The two exact DACL shapes that earlier versions wrote are reset to inherited (via `SetNamedSecurityInfoW`) when the owner opens the index. Any other protected DACL is left alone and reported. - **Another account's daemon is serving the project.** `daemon.toml` stays owner-only, because it holds that daemon's token. The second account gets an immediate, permanent `index_unavailable_other_account` refusal that names the other account and the remedies (stop that daemon, work as that account, or `--no-daemon --db <path>`). Never `warming_up`, and no respawn loop. - **Another account's daemon crashed.** Liveness is decided by the daemon lock, not by the leftover file. This account's daemon starts, leaves the foreign file in place, and publishes `daemon-<pid>.toml` beside it when it cannot remove it. - **One ordering rule for refusals.** Every permanent refusal is decided before any stored raw open error can answer, in the same order on both legs: access denied, then another account's daemon, then a schema newer than this build (merged with the v0.33.0 ordering fix). - **`doctor`** reports an index whose ACL is narrower than its folder. - **Unix stays owner-only, on purpose.** One index exposes every indexed file, so following a group-shared folder would leak files that are more private than the folder. Documented on `harden_permissions`. ## Verification (Linux, local) - fmt, plus clippy `-D warnings` for Linux and windows-gnu, plus `cargo doc -D warnings --document-private-items`. - `other_account_daemon_e2e` 2/2 on both legs, non-root and `COSI_TEST_AS_ROOT=1`. - `index_access_denied_e2e`, `schema_newer_refusal_e2e`, `index_state_disclosure_e2e`, `oneshot_daemon_e2e`, `query_cli`, `exit_reasons_e2e`, `warmup_e2e`, plus the mcp-server, `perms`/`db`, `doctor` and daemon `lifecycle`/`takeover`/`restart` lib tests. - `version_site_registry`, `release_notes_quoting`, `doc_citation_gate`. - Seven mutations were re-run after the merge with the v0.33.0 ordering; every one went red at its assertion. ## Only native Windows CI can confirm - New index files carry the folder's inherited ACEs plus the user's SID. - Both old DACL shapes are reset when opened, and an unknown protected DACL is left alone. - The shared-lock probe behaves on Windows. - A SYSTEM-only `daemon.toml` refuses its own owner, and `owner_of` names the owner. - The crashed case: the daemon cannot delete the stale `daemon.toml` and publishes `daemon-<pid>.toml`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
Two Windows accounts sharing one project folder could not share its
index: every index file got perms::restrict_to_owner's protected
owner-only DACL, so whichever account wrote the index locked the other
out. v0.33.0 only made that a clear permanent refusal.

Rule: the index is never more private than the folder it was built from.

Windows
- index.db, -wal, -shm go through perms::inherit_folder_acl instead of
  restrict_to_owner: the DACL stays UNPROTECTED (the folder's entries
  flow in) plus one explicit full-access entry for the token user's SID,
  which keeps the v0.32 property (same user, elevated or not).
- Migration: a file still carrying the owner-only DACL an older build
  wrote (both historical shapes, recognised exactly by
  is_legacy_owner_only) is reset to inherit on open, before SQLite opens
  it and again after; logged at info. A protected DACL code-index did not
  write is left alone and logged at warn. Win32 SetNamedSecurityInfoW,
  no icacls.
- daemon.toml keeps restrict_to_owner: it is a capability token for a
  daemon running as one account, not the source.
- The over-the-shoulder remedy text now describes what is left to repair.

Unix keeps 0600/0700, deliberately, documented on harden_permissions:
the index aggregates every indexed file, a folder's mode does not bound
the most private file in it, and a group-writable state dir would let a
group member replace daemon.toml.

doctor: a new "index permissions" line (perms::index_narrower_than_folder):
WARN on Windows for a protected or denying DACL, with the repair; OK with
the stated cost for the Unix by-design case.

Tests: pure rule tests on every OS (mutation-run), a Unix group-shared
folder test, a doctor report test, and two Windows tests (inherit +
legacy reset) that only the native Windows job executes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
daemon.toml stays owner-only (it is a capability token). The second
account of the field case now gets one of two answers instead of an
attach error and a reattach loop:

1. The other account's daemon is SERVING (registration unreadable, lock
   held): both legs refuse at once with the new sibling code
   index_unavailable_other_account. The sentence names the owner (uid on
   Unix, DOMAIN\name or SID on Windows), says it does NOT converge on
   retry, and gives the remedies (stop that daemon, work as that account,
   or --no-daemon --db elsewhere). The structured index_unavailable block
   carries reason "other_account", path, owner, converges_on_retry false.
   No daemon is spawned to lose the lock race. The in-process leg refuses
   too: it cannot see the owner's port and would otherwise migrate and
   reconcile beside it.
2. That daemon CRASHED (registration unreadable, lock free): liveness
   decides. This account starts. Lockfile::acquire leaves a stale
   registration it may not remove in place and publishes
   daemon-<pid>.toml beside it, which read_state reads after the primary.

- lifecycle: PayloadState::Unreadable (read_state no longer errors on
  PermissionDenied), alt_payload_paths, unreadable_payload, lock_is_held
  (a shared, non-blocking probe, asked only when an unreadable
  registration exists), other_account_daemon, OtherAccountDaemon,
  INDEX_UNAVAILABLE_OTHER_ACCOUNT, and a debug-only
  FOREIGN_PAYLOAD_PID_ENV seam for root test runs.
- takeover names the other account on a lost lock race. That is still a
  clean LockBusy with no exit record, so startup_backoff never counts it
  (documented there).
- doctor's daemon line reports both states.
- perms::owner_of is public.

Tests: other_account_daemon_e2e (both states, both legs, non-root and
COSI_TEST_AS_ROOT arms; Windows staging with icacls) and lifecycle unit
tests. Mutations run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
version_bump.sh refused while db.rs and perms.rs stated the current
version in doc comments; they now cite the issue and the v0.32 field fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
other_account_daemon_e2e: name the in-process site W2b's ordering gave it
Some checks failed
CI / cargo fmt (pull_request) Successful in 46s
CI / OSS corpus tier-3 scale (nightly) (pull_request) Has been skipped
CI / Grammar rebuild from source (nightly) (pull_request) Has been skipped
CI / CI lane wall-clock headroom (pull_request) Successful in 46s
CI / guest crates (fmt, clippy, doc) (pull_request) Successful in 1m46s
CI / cargo doc (intra-doc links) (pull_request) Successful in 6m49s
CI / cargo deny (pull_request) Successful in 7m49s
CI / cargo test (abi, 32-bit + wasm32) (pull_request) Successful in 7m58s
CI / cargo check (MSRV 1.98) (pull_request) Successful in 8m0s
CI / cargo clippy (pull_request) Successful in 8m22s
CI / cargo check (windows-gnu) (pull_request) Successful in 8m46s
CI / OSS corpus (tier 1) (pull_request) Successful in 37m3s
CI / cargo test (pull_request) Failing after 55m48s
CI / cargo test (daemon transport) (pull_request) Has been skipped
CI / Plugin path cost + pool throughput (nightly) (pull_request) Has been skipped
CI (Windows) / fmt + clippy + build + test (windows) (pull_request) Failing after 1h12m6s
03e2885cd8
The in-process check now lives in pre_open_refusal and the route's in
permanent_refusal; the mutation notes say so and were re-run there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
cargo hashes a crate's version into its -C metadata, hence its
StableCrateId and every v0-mangled symbol it and its dependents emit.
code-index-guest and code-index-guest-kit took version.workspace, so the
two-account release's host bump (#317) renamed their symbols, permuted
eight functions of the Ruby extractor (and renumbered every call to
them), and moved the bytes of all nine build.py extractors at the same
length with no source change.

The two crates now carry a literal version, pinned at the value the
checked-in extractors were built with, so no package's bytes move. The
guest lockfiles record it and are no longer host bump sites;
version_bump.sh does not walk crates/guest or crates/guest-kit (#318).

Guard: version_site_registry's
guest_build_inputs_do_not_inherit_the_host_version follows the real
path-dependency edges from every guest cdylib and requires a literal
version on every in-tree crate it reaches, and requires the bump
script's prune. Lockfile gates (version_site_registry, release_gate)
now compare against the guest SDK manifest, not the workspace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
The SDK manifest changed (its own literal version, #318), so the pin
third parties build against moves to the commit that landed it. Two
commits by construction: a commit cannot name its own hash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
`a_rollback_skips_queued_files_that_no_longer_exist` assumed a re-index
replaces the edited file's row under a NEW id. `files.id` is a plain
rowid (no AUTOINCREMENT) and `write_upsert` replaces by DELETE + INSERT,
so SQLite mints max(rowid)+1 -- the deleted id itself whenever the
edited file held the max. Which file holds the max is decided by readdir
order (the walker does not sort) and rayon's completion order.

Reproduced the CI failure exactly (left: 5, right: 5) by putting the
tree on tmpfs with RAYON_NUM_THREADS=1: src/notes.md took id 5 of 5 on
every run. The earlier size-change edit was not the cause.

The fix indexes one more file in a pass of its own before the edit, so
the queued id is never the max, and asserts the queued id names no row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
`daemons_started` counts the daemon's INFO line `daemon listener bound`.
CI's `test` job sets `CODE_INDEX_LOG: warn` job-wide, the daemon falls
back to it, and so no daemon ever wrote the line: the control "one
daemon serves" read 0 on CI and passed locally, and the no-respawn
check under it was 0 == 0 whatever the second account did.

Not a root problem: reproduced as an ordinary user with
`CODE_INDEX_LOG=warn cargo test -p code-index-mcp --test
other_account_daemon_e2e` (left: 0, right: 1).

Both spawns now pin `CODE_INDEX_LOG=info`, which the daemon inherits
from its server. Verified green 5 of 5 in the CI image as uid 0 on
overlayfs with the job's env.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
Merge branch 't-ci-only': two CI-only test failures, root-caused
Some checks failed
CI / cargo fmt (pull_request) Successful in 51s
CI / OSS corpus tier-3 scale (nightly) (pull_request) Has been skipped
CI / Grammar rebuild from source (nightly) (pull_request) Has been skipped
CI / CI lane wall-clock headroom (pull_request) Successful in 43s
CI / guest crates (fmt, clippy, doc) (pull_request) Successful in 1m29s
CI / cargo doc (intra-doc links) (pull_request) Successful in 5m49s
CI / cargo clippy (pull_request) Successful in 5m59s
CI / cargo check (MSRV 1.98) (pull_request) Successful in 6m29s
CI / cargo test (abi, 32-bit + wasm32) (pull_request) Successful in 6m53s
CI / cargo check (windows-gnu) (pull_request) Successful in 6m58s
CI / cargo deny (pull_request) Successful in 7m33s
CI / OSS corpus (tier 1) (pull_request) Successful in 31m7s
CI / cargo test (pull_request) Successful in 51m18s
CI (Windows) / fmt + clippy + build + test (windows) (pull_request) Failing after 1h11m59s
CI / cargo test (daemon transport) (pull_request) Successful in 12m16s
CI / Plugin path cost + pool throughput (nightly) (pull_request) Has been skipped
73e001caf5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
other_account_daemon_e2e: reset the ACL before staging a SYSTEM-only daemon.toml
Some checks failed
CI / cargo fmt (pull_request) Successful in 55s
CI / OSS corpus tier-3 scale (nightly) (pull_request) Has been skipped
CI / Grammar rebuild from source (nightly) (pull_request) Has been skipped
CI / CI lane wall-clock headroom (pull_request) Successful in 40s
CI / guest crates (fmt, clippy, doc) (pull_request) Successful in 1m15s
CI / cargo doc (intra-doc links) (pull_request) Successful in 13m33s
CI / cargo deny (pull_request) Successful in 16m35s
CI / cargo check (MSRV 1.98) (pull_request) Successful in 17m56s
CI / cargo test (abi, 32-bit + wasm32) (pull_request) Successful in 18m15s
CI / cargo clippy (pull_request) Successful in 20m9s
CI / cargo check (windows-gnu) (pull_request) Successful in 21m29s
CI / OSS corpus (tier 1) (pull_request) Successful in 1h4m19s
CI (Windows) / fmt + clippy + build + test (windows) (pull_request) Failing after 1h13m30s
CI / cargo test (pull_request) Successful in 1h13m41s
CI / Plugin path cost + pool throughput (nightly) (pull_request) Has been cancelled
CI / cargo test (daemon transport) (pull_request) Has been cancelled
a12aa3e4f1
Native Windows CI fired the staging control ('the SYSTEM-only DACL did
not lock this runner out of daemon.toml'). The daemon writes daemon.toml
owner-only (explicit OWNER RIGHTS + user-SID entries, restrict_to_owner);
icacls /inheritance:r /grant:r removes only INHERITED entries and only
replaces SYSTEM's grant, so the explicit entries survived. The crashed
case passed because its daemon.toml is written by the test and carries
only inherited entries. /reset first, then the SYSTEM-only DACL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
perms: the restrict_to_owner test's control unprotects through SetNamedSecurityInfoW
Some checks failed
CI / cargo fmt (pull_request) Successful in 53s
CI / OSS corpus tier-3 scale (nightly) (pull_request) Has been skipped
CI / Grammar rebuild from source (nightly) (pull_request) Has been skipped
CI / guest crates (fmt, clippy, doc) (pull_request) Successful in 1m27s
CI / CI lane wall-clock headroom (pull_request) Successful in 1m28s
CI / cargo doc (intra-doc links) (pull_request) Successful in 6m16s
CI / cargo deny (pull_request) Successful in 7m54s
CI / cargo test (abi, 32-bit + wasm32) (pull_request) Successful in 8m2s
CI / cargo check (MSRV 1.98) (pull_request) Successful in 8m2s
CI / cargo clippy (pull_request) Successful in 8m33s
CI / cargo check (windows-gnu) (pull_request) Successful in 8m51s
CI / OSS corpus (tier 1) (pull_request) Successful in 40m45s
CI / cargo test (pull_request) Successful in 59m28s
CI (Windows) / fmt + clippy + build + test (windows) (pull_request) Failing after 1h12m4s
CI / cargo test (daemon transport) (pull_request) Successful in 12m59s
CI / Plugin path cost + pool throughput (nightly) (pull_request) Has been skipped
c8dda55d21
Native Windows CI fired restrict_to_owner_applies_a_protected_dacl's
CONTROL ('the file must start unprotected'). #317 moved
dacl_is_protected onto read_dacl (GetNamedSecurityInfoW), while the
control still wrote its unprotected DACL with the legacy
SetFileSecurityW, which does not mark the DACL unprotected the way the
named API reports it. The control now goes through the same
SetNamedSecurityInfoW + UNPROTECTED_DACL_SECURITY_INFORMATION path the
product's set_inheriting_dacl uses (extracted as
set_unprotected_explicit_dacl; production behaviour unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
perms: restrict_to_owner_grants_the_invoking_user_by_sid starts from the protected legacy shape
Some checks failed
Release Build / Pack the first-party packages-1 (push) Successful in 55s
Release Build / Pack the first-party packages-8 (push) Successful in 1m2s
Release Build / Pack the first-party packages-3 (push) Successful in 1m2s
Release Build / Pack the first-party packages (push) Successful in 1m11s
Release Build / Pack the first-party packages-6 (push) Successful in 1m11s
Release Build / Pack the first-party packages-2 (push) Successful in 1m18s
Release Build / Pack the first-party packages-7 (push) Successful in 1m21s
Release Build / Pack the first-party packages-5 (push) Successful in 1m29s
Release Build / Pack the first-party packages-4 (push) Successful in 1m31s
Release Build / Build windows-x86_64 (push) Successful in 18m3s
Release Build / Assemble the release archives (push) Successful in 3m20s
Release Build / Windows archive smoke (msvc) (push) Successful in 26s
Release Build / Create Forgejo Release (push) Successful in 9m27s
Release Build / Seed the package channel (push) Successful in 2m33s
CI / cargo fmt (push) Successful in 51s
CI / OSS corpus tier-3 scale (nightly) (push) Has been skipped
CI / Grammar rebuild from source (nightly) (push) Has been skipped
CI / CI lane wall-clock headroom (push) Successful in 47s
CI / guest crates (fmt, clippy, doc) (push) Successful in 53s
CI / cargo doc (intra-doc links) (push) Successful in 4m42s
CI / cargo clippy (push) Successful in 6m9s
CI / cargo check (MSRV 1.98) (push) Successful in 6m42s
CI / cargo test (abi, 32-bit + wasm32) (push) Successful in 6m52s
CI / cargo check (windows-gnu) (push) Successful in 6m55s
CI / cargo deny (push) Successful in 6m58s
CI / OSS corpus (tier 1) (push) Successful in 33m39s
CI (Windows) / fmt + clippy + build + test (windows) (push) Failing after 1h12m2s
CI / cargo test (push) Successful in 1h14m6s
CI / cargo test (daemon transport) (push) Successful in 27m49s
CI / Plugin path cost + pool throughput (nightly) (push) Has been skipped
74f45e7bfc
With the previous fix, restrict_to_owner_applies_a_protected_dacl passes
on native Windows. The next control then fired: 'an OW/SY-only DACL must
not already name the user'. Its start state was the now correctly
UNPROTECTED DACL, which inherits the temp folder's entries, and those
name the user. This test's question is the legacy (pre-#317) shape vs
the fixed one, so it now stages that exact protected shape,
D:P(OW)(SY), which names no user and inherits nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0126PDDLB4wNHxKXvWM1VNmu
buildagent deleted branch release-v0.33.1 2026-10-06 10:10:51 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
h-dv/code-index!320
No description provided.