Skip to content

registry: close 9 boot.rs/lifecycle.rs test gaps, fix a masked mutation (#564) - #576

Merged
t0k0sh1 merged 1 commit into
mainfrom
564-registry-untested-branches-pr-b
Aug 11, 2026
Merged

registry: close 9 boot.rs/lifecycle.rs test gaps, fix a masked mutation (#564)#576
t0k0sh1 merged 1 commit into
mainfrom
564-registry-untested-branches-pr-b

Conversation

@t0k0sh1

@t0k0sh1 t0k0sh1 commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

PR-B of 3 for #564. Covers src/registry/boot.rs, src/registry/lifecycle.rs(+ one fixture-driven test in src/hydrate.rs). PR-A (concurrency.rs + gauges.rs, #575) is the first; PR-C (engine.rs + registry.rs) will close #564.

boot.rs

  • Interleaving a context rename with its containing group's own rename in one crash-resume boot — no existing test plants both marker kinds at once (each covers only its own).
  • reconcile_groups's write_group failure arm (warn-only: memory is reconciled, the on-disk file stays stale until the next successful write). The two existing boot-time persistence faults consume their single-shot injector earlier in the same boot, never reaching this call.
  • preload_pinned's multi-worker path + its per-worker Err warn arm — every existing pinned test in the suite boots with exactly one pinned context, so workers == 1 always.

hydrate.rs

  • The boot-time hydrator manifest registration loop's name_from_stem None arm, for a manifest stem that fails to percent-decode.

lifecycle.rs

  • A pinned rename's re-preload failure (warn-only: the rename still succeeds, the context just stays cold instead of reloading hot under its new name).
  • The boot straggler contract (landed && !complete) with a group that actually needs its membership rewritten — the one existing incidental case has no group present, so the rewrite loop runs vacuously.
  • update_meta's dice_floor/semantic_floor clamps — every call site in the suite already passes an in-range value, so the clamp itself was never exercised; it's also the only guard left on the PATCH path (the create handler clamps up front, PATCH does not).
  • update_meta's pinned ensure_hot-failure rollback (meta.pinned must roll back to false, not strand a pinned-but-unloadable context).
  • hidden_label's Err arm — never called from any test in the suite.

Also fixed (found by the mutation sweep, in scope of #564's mandate to verify with cargo mutants)

  • sweep_stale_stem_files's destination-targeting-marker removal loop silently swallowed a real (non-NotFound) removal failure — mutants flagged !=== as undetected. Added a test that isolates the exact op via the persistence fault injector.
  • boot.rs's passage-vector ANN heads-up log condition has no externally observable behavior (log-only) — extracted into its own #[mutants::skip]'d helper (matching the existing remove_persisted_file_quietly precedent) rather than skip mutation coverage on all of boot_with.

Verified against #532's original claims; #564's own comment lists which of that audit's items are already closed by earlier PRs (#568/#569/#572/#573/#574) and out of scope here.

Test plan

  • cargo fmt
  • cargo clippy --all-targets — warnings ゼロ
  • cargo test — full suite passes
  • cargo mutants --profile=mutants --file src/registry/boot.rs --jobs 40 missed (after extracting the log-only condition)
  • cargo mutants --profile=mutants --file src/registry/lifecycle.rs --jobs 40 missed (after the sweep_stale_stem_files fix)
  • Pre-PR mutation gate (cargo mutants --in-diff) — 1 in-diff mutant, unviable (doesn't build), effectively 0 missed

Refs #564

Summary by CodeRabbit

  • バグ修正

    • 無効なマニフェストがブート処理を妨げず、正常な項目のみ登録されるよう安定性を向上しました。
    • 名前変更の復旧、ピン留めコンテキストの読み込み、グループ整合性の維持に関するエラー処理を改善しました。
    • メタデータの範囲外設定やスキーマ解決失敗時の状態保持を強化しました。
  • テスト

    • ブート、ライフサイクル、復旧処理に関する回帰テストを追加しました。

…on (#564)

boot.rs: interleaving a context rename with its containing group's own
rename in one crash-resume boot (neither marker kind's existing tests
plant both at once); reconcile_groups's write_group failure arm
(warn-only, memory correct but the file stays stale); preload_pinned's
multi-worker path (every existing pinned test uses a single context,
so workers==1 always) alongside its per-worker Err warn arm.

hydrate.rs: the boot-time hydrator manifest registration loop's
name_from_stem None arm, for a manifest stem that fails to decode.

lifecycle.rs: a pinned rename's re-preload failure (warn-only, stays
cold rather than failing the rename); the boot straggler contract
(landed && !complete) with a group actually needing its membership
rewritten, isolating it from the one existing incidental case (no
group present); update_meta's dice_floor/semantic_floor clamps
(every call site already passes in-range values, so the clamp itself
was never exercised, and the PATCH handler has no other guard);
update_meta's pinned ensure_hot failure rollback; hidden_label's Err
arm.

Also: cargo mutants flagged one real gap in sweep_stale_stem_files
(lifecycle.rs) — a destination-targeting marker whose removal fails
for a real reason (not NotFound) was silently swallowed rather than
propagated, with no test distinguishing the two. Added a
directly-targeted test using the persistence fault injector. Separately,
boot.rs's passage-vector ANN heads-up log condition had no observable
behavior for mutants to catch (log-only); extracted it into its own
#[mutants::skip]'d helper rather than skip all of boot_with.

Verified: cargo mutants --profile=mutants --file <module> --jobs 4
on both files, 0 missed after the sweep-fix and the extraction.
Refs #564
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Hydrator登録、ブート時のリネーム復旧とプリロード、ライフサイクルのロールバック、スキーマ解決に関する回帰テストを追加しました。ANN休止判定を専用ヘルパーへ抽出しました。

Changes

レジストリ復旧とライフサイクル

Layer / File(s) Summary
Hydrator登録の検証
src/hydrate.rs
有効な sake.ctx だけを登録し、無効な %ZZ.ctx を除外してブートがパニックしないことを検証します。
ブート復旧とプリロード
src/registry/boot.rs
ANN休止判定を専用ヘルパーへ分離します。コンテキストとグループのリネーム復旧、グループ整合性修正の永続化失敗、ピン留めコンテキストの並列プリロードを検証します。
メタデータとピン留め状態の復旧
src/registry/lifecycle.rs
dice_floorsemantic_floor0.0..=1.0 に制限します。ピン留め時のロード失敗と、リネーム後の再ロード失敗に対する状態保持を検証します。
リネーム掃引とスキーマ解決
src/registry/lifecycle.rs
リネームマーカー削除の失敗、部分的なリネーム復旧、破損イメージによるスキーマ解決失敗時の hidden_label を検証します。

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

  • t0k0sh1/taguru#564: Hydrator登録、リネーム復旧、プリロード失敗、永続化失敗の未検証分岐を直接テストで補完しています。

Possibly related PRs

  • t0k0sh1/taguru#568: hydrate.rsboot.rslifecycle.rs の状態管理、リネーム復旧、ロールバックに関する変更で直接関連します。
  • t0k0sh1/taguru#569: boot.rslifecycle.rs のリネームマーカー復旧処理に関する変更で関連します。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルは、boot.rsとlifecycle.rsのテスト追加およびマスクされたミューテーションの修正という主な変更を明確に示しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 564-registry-untested-branches-pr-b

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/registry/lifecycle.rs (1)

1655-1662: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

resident_estimate のロールバックも検証してください。

このテストは pinnedloaded を確認しますが、説明にある budget の resident_estimate を確認しません。rollback_meta 後の recount_entry が欠けても、このアサーションは成功します。失敗前後の resident estimate を比較してください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/registry/lifecycle.rs` around lines 1655 - 1662, Extend the failed
forced-preload test around rollback_meta and recount_entry to capture the
entry’s resident_estimate before the operation and assert afterward that it is
unchanged. Keep the existing pinned and loaded assertions, ensuring the test
detects missing resident-estimate rollback.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/registry/lifecycle.rs`:
- Around line 1655-1662: Extend the failed forced-preload test around
rollback_meta and recount_entry to capture the entry’s resident_estimate before
the operation and assert afterward that it is unchanged. Keep the existing
pinned and loaded assertions, ensuring the test detects missing
resident-estimate rollback.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5670a358-eebf-476f-9695-3dc22e091e21

📥 Commits

Reviewing files that changed from the base of the PR and between f15d252 and 9f8bb8d.

📒 Files selected for processing (3)
  • src/hydrate.rs
  • src/registry/boot.rs
  • src/registry/lifecycle.rs

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.

registry コアエンジン: 未検証分岐とテストのフレークリスク

1 participant