Release 0.37.1: language owner switch and rollback correctness, bare package lang filters #365
No reviewers
Labels
No labels
code-review
correctness
dos
performance
security
severity/high
severity/low
severity/medium
tech-debt
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
h-dv/code-index!365
Loading…
Reference in a new issue
No description provided.
Delete branch "train-0371"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes what dogfooding v0.37.0 on this repository found (1,355 files, 879
.rsat v0.37.0). Every defect here predates 0.37.0; 0.36.1 reproduces them. The version is bumped in this PR withversion_bump.sh. No schema change, and package bytes are unchanged.Switching a language to its package, and back
1. The rollback buffer kept the wrong files (
c2d5d477)languages owner rust package, the superseded generation held the 476 files that did not change hands, and none of the builtin.rsrows.activation::write_generationcreated a new package key withhost_epochNULL.packages::reconcile_extraction_epochthen marked every file of the package changed. The re-extract ranwriter::write_upsert, which deletes and re-inserts thefilesrow and so cascaded away the rows the switch had just withdrawn.contributions::mint_package_for_hostcreates the key at this host's epoch.2. An owner flip re-extracted the whole tree (
6cfd094d,b86b7e35)[languages]route, and the daemon startup, calledbuild_full_observedwith old == new. That runsstartup_rebuild.[[displaces]]; a match is exact.plugin enable's bounded dirty domain, with the new ruleCause::Displacement.NotRecovered::{NoPackageSet,NoRecord,CapExceeded,NoMatch}).3. A file edited after a switch kept the package's rows after a rollback (
6cfd094d)write_upsertgives an edited file a newfiles.id, and the switch joined the build queue's stalefile_id.Switch::owed).4.
plugin enableof a package that owns nothing re-extracted every file it claims (bdf652c9,d55456dc)dirty_domain, the claim and container rules now count a file only where the package is its owner on that side. They compare thecomponent_oftriple, not the key string.Unchangedand does not fail at the gate.Language filters (
ca3451d7,73455afe)lang: "vue"/"svelte"/ any package-shaped id now matches<pkg>/<id>insearch_text,search_symbolsandresolution_gaps, exactly as the full spelling does. The shared rule islang_profile::filter_glob, with its Rust twinfilter_admits, graded against SQLite.ambiguous_lang, withdid_you_meanlisting both. The spellings come from the newIndexAccess::lang_spellings.langfilter that empties a result names the spellings present (spellings_present).Measured on this repository (release binaries, isolated
CODE_INDEX_HOME)plugin enablerust (rust stays builtin).rs.rs, nothing elseplugin rollbackTests (each mutation was run, RED, then restored GREEN; I re-ran one mutation per lane myself)
crates/indexer/tests/owner_switch_rollback.rs(13 tests):crates/daemon/tests/language_owner_e2e.rs::a_restart_with_a_moved_owner_re_extracts_only_the_files_that_change_hands.crates/mcp-server/tests/lang_alias_e2e.rs: real vue and svelte packages, both legs; a bare id answers like the full one; an ambiguous id is refused.lang_profileunits,lang_profile_parity,rpc_coverage_e2eleg.Records that moved, attributed
release_gate_e2estep 8: now counts the superseded generation, (2, 3).c2d5d477reproduces the old total.tests/corpus/host-package-lifecycle.json: ruby/inert and ruby/removed were re-measured with a reason.count.*,influence.builtin_only,rule.tier1a_unique_own_file): the redundant retained copy of the one builtin-owned file (test/yajl_test.rb), which change 4 no longer re-extracts.active.*andgen.*value is unchanged. Bisected: reverting only the narrowing reproduces the old record.tests/corpus/baseline.jsonandcost-baseline.jsonare unchanged (md5 checked).DISPLACEMENT_HYPOTHESES_MAX_CONSENTSinbounding_site_registry(capacity: it changes no answer). The leg-routed suite population is 58.Verification
15da7dbd:--document-private-items -D warnings;psr4_vs_builtin, tier 3;precision_gate7/7, phantom 0;package_leg.sh <pkg> fulland all 7overheadlegs.15da7dbdrelease binaries: the measurement table above.Not changed, by design:
plugin rollbackputs the index back but leaves the approval and[languages]as they were, so the next pass re-applies them (its help says so). Making a rollback stick takesdisableorlanguages owner <lang> builtin.🤖 Generated with Claude Code
https://claude.ai/code/session_01YDDBdWU4yThi8Zi51E6FCj
An owner switch withdrew the replaced rows into the superseded generation correctly, and the very next index pass destroyed them. `activation::write_generation` minted a new package's key through `contributions::ensure_package`, leaving `plugin_packages.host_epoch` NULL ("derived under an unknown epoch") although every row under it was about to be written by this host. `packages::reconcile_extraction_epoch` then marked every file the package had just produced as changed, the pass extracted them a second time, and `writer::write_upsert`'s delete-and-reinsert of each `files` row cascaded the withdrawn rows of exactly the files that changed hands out of the rollback buffer. A rollback restored nothing for the switched language and left the package's rows live under a builtin activation. `contributions::mint_package_for_host` inserts a NEW key at `HOST_EXTRACTION_EPOCH` and leaves an existing key's epoch alone; NULL stays reserved for keys minted over rows an older binary wrote. `tests/owner_switch_rollback.rs` drives both operator routes (`plugin enable`, and the index pass that finds a moved `[languages]` owner) plus the reverse switch, and grades the buffer and the rollback byte-identically. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDDBdWU4yThi8Zi51E6FCj`files.lang` for a .vue/.svelte file is `de.h-dv.vue/vue` / `de.h-dv.svelte/svelte`, so `search_text {lang: "vue"}` answered 0 while the full spelling answered the file. `lang_profile::filter_glob` already widened a bare PROFILE name (`ruby` -> `*/ruby`, #112); it now widens any local-shaped bare id, so every tool built on `sql_lang_filter` (search_text incl. the #355 region arm, search_symbols symbols+imports, the token tier, resolution_gaps) answers `vue` exactly as `de.h-dv.vue/vue`. Full spellings and builtins are unchanged. - ambiguity: a bare non-profile id two packages declare is refused (`ambiguous_lang`, candidates in did_you_mean) by the MCP server for search_text / search_symbols / resolution_gaps, over the indexes the call searches. Spellings come from a new `IndexAccess::lang_spellings` RPC (files.lang + live extraction_components.lang); an older daemon answers "unknown method" -> not checked, never refused. - resolution_gaps' unknown_lang check uses the same rule (it refused `vue`, and `typescript` held only in a region). - empty_population: when `lang` alone emptied a result, its probe carries `spellings_present` (nearest first) and the note names them. - Rust twin `filter_admits` graded against SQLite in lang_profile_parity; `is_local_shaped` graded against LocalLangId. Tests: lang_alias_e2e (real frozen vue+svelte packages; two fixture packages sharing `tmpl`), both legs. Mutations run: restoring the profile-only gate -> RED `lang "vue" must answer exactly what "de.h-dv.vue/vue" answers` left ([], 0) right (["src/Panel.vue"], 1); ambiguous_lang -> None -> RED left None right Some("ambiguous_lang"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDDBdWU4yThi8Zi51E6FCjrecorded_displacement / recorded_activation return NotRecovered (NoPackageSet, NoRecord, CapExceeded{consents}, NoMatch{candidates}) instead of None, and both callers (index::reconcile_activation_before_index, the daemon's startup activation) log it at info, so a full rebuild is never unexplained. The consent cap is per (package, builtin) pair and the doc now says so. The project config is read once per recovery; only the routing pair varies between candidates. A file created or renamed into the switched domain after a switch has no build-queue row, but needs no new rule: the next pass's route gate (reconcile::classify_stat, producer half for first-party ids) reclassifies it. owner_switch_rollback now grades that on a first-party shape in both directions, plus the BuiltinsOnly recovery and the NoMatch fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDDBdWU4yThi8Zi51E6FCj