[PR #1494] [MERGED] [codex] Add feature-layer focused coverage #5111

Closed
opened 2026-10-22 04:13:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1494
Author: @Xelvanis
Created: 5/29/2026
Status: ✅ Merged
Merged: 5/29/2026
Merged by: @Xelvanis

Base: refactor ← Head: chore/world-state-patching-tests


📝 Commits (2)

  • 73ecb92 Add feature-layer focused coverage
  • cb67190 Fix feature-layer async review findings

📊 Changes

8 files changed (+1318 additions, -39 deletions)

View changed files

📝 graphify-out/.graphify_labels.json (+1 -0)
📝 graphify-out/GRAPH_REPORT.md (+21 -16)
📝 graphify-out/graph.json (+612 -16)
📝 graphify-out/manifest.json (+14 -4)
➕ src/features/runtime/world-state/hooks/use-world-state-patcher.test.ts (+352 -0)
📝 src/features/runtime/world-state/hooks/use-world-state-patcher.ts (+14 -2)
➕ src/features/shell/bot-browser/components/BotBrowserView.test.tsx (+260 -0)
📝 src/features/shell/bot-browser/components/BotBrowserView.tsx (+44 -1)

📄 Description

Linked issue

No linked GitHub issue; selected from the local feature-layer focused-test gaps chore.

Why this change

  • Adds focused regression coverage around two feature-layer areas that had meaningful failure-path gaps: Bot Browser provider search state and runtime world-state manual patching.
  • Fixes async edge cases found during failpath/Bunny review so stale provider results and stale world-state flushes do not overwrite newer user-visible state.

What changed

  • Added Bot Browser jsdom coverage for retryable provider failures, stale late failures after a newer refresh succeeds, and stale results resolving during the search debounce gap.
  • Added world-state patcher coverage for optimistic/manual patch coalescing, same-chat target preservation, failed durable retry, refresh suppression, durable restore-on-mount, and concurrent same-target in-flight flushes.
  • Updated Bot Browser search handling to validate both request generation and captured search criteria before applying results/errors/loading state.
  • Updated world-state patch reconciliation so completed older same-target writes only reconcile visible state when that completed patch is still the latest durable revision.
  • Refreshed Graphify output after source changes.

Refactor impact

Primary owner:

  • features/shell/bot-browser and features/runtime/world-state

Impact areas reviewed:

  • Bot Browser search loading/error/empty/retry states
  • World-state patch queue, optimistic visible state, durable localStorage restore, and refresh suppression
  • Feature-layer dependency boundaries and generated Graphify map

Boundary notes:

  • Feature/runtime-only TypeScript changes.
  • No engine, shared API, Rust, Tauri command, or remote-runtime boundary changes.
  • No raw Tauri invoke or raw remote-runtime fetch additions.

Pressure points touched:

  • None of the known pressure points were touched: ModeSurface, GameSurface, shared mode UI, src-tauri/src/lib.rs, and import modules are unchanged.

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

  • pnpm exec vitest run src/features/runtime/world-state/hooks/use-world-state-patcher.test.ts src/features/shell/bot-browser/components/BotBrowserView.test.tsx passed: 2 files / 10 tests.
  • pnpm typecheck passed.
  • pnpm check:architecture passed.
  • git diff --check origin/refactor...HEAD -- . ':(exclude)graphify-out/**' was clean.
  • graphify update . completed after the source changes.
  • Native Tauri/manual Bot Browser UI verification was not run.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

No docs changes were made because this PR changes focused feature/runtime behavior and regression tests, not contributor commands, architecture guidance, or public documentation.

UI evidence

Not added. This PR has jsdom regression coverage for the visible Bot Browser state transitions, but no screenshot or Tauri/manual UI pass.

Summary by CodeRabbit

  • Bug Fixes

    • Improved game state patch handling to prevent stale state from being applied.
    • Enhanced bot browser search to discard outdated results and prevent display of stale data during searches.
    • Added safeguards against race conditions in async operations.
  • Tests

    • Added comprehensive test coverage for game state patching and bot browser search behaviors.

Review Change Stack


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/1494 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/29/2026 **Status:** ✅ Merged **Merged:** 5/29/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `chore/world-state-patching-tests` --- ### 📝 Commits (2) - [`73ecb92`](https://github.com/Pasta-Devs/Marinara-Engine/commit/73ecb92ddc7d941848c831f346b1483504091e3d) Add feature-layer focused coverage - [`cb67190`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cb67190759d056b76a59f47cf848c882a2a9b01d) Fix feature-layer async review findings ### 📊 Changes **8 files changed** (+1318 additions, -39 deletions) <details> <summary>View changed files</summary> 📝 `graphify-out/.graphify_labels.json` (+1 -0) 📝 `graphify-out/GRAPH_REPORT.md` (+21 -16) 📝 `graphify-out/graph.json` (+612 -16) 📝 `graphify-out/manifest.json` (+14 -4) ➕ `src/features/runtime/world-state/hooks/use-world-state-patcher.test.ts` (+352 -0) 📝 `src/features/runtime/world-state/hooks/use-world-state-patcher.ts` (+14 -2) ➕ `src/features/shell/bot-browser/components/BotBrowserView.test.tsx` (+260 -0) 📝 `src/features/shell/bot-browser/components/BotBrowserView.tsx` (+44 -1) </details> ### 📄 Description ## Linked issue No linked GitHub issue; selected from the local feature-layer focused-test gaps chore. ## Why this change - Adds focused regression coverage around two feature-layer areas that had meaningful failure-path gaps: Bot Browser provider search state and runtime world-state manual patching. - Fixes async edge cases found during failpath/Bunny review so stale provider results and stale world-state flushes do not overwrite newer user-visible state. ## What changed - Added Bot Browser jsdom coverage for retryable provider failures, stale late failures after a newer refresh succeeds, and stale results resolving during the search debounce gap. - Added world-state patcher coverage for optimistic/manual patch coalescing, same-chat target preservation, failed durable retry, refresh suppression, durable restore-on-mount, and concurrent same-target in-flight flushes. - Updated Bot Browser search handling to validate both request generation and captured search criteria before applying results/errors/loading state. - Updated world-state patch reconciliation so completed older same-target writes only reconcile visible state when that completed patch is still the latest durable revision. - Refreshed Graphify output after source changes. ## Refactor impact Primary owner: - `features/shell/bot-browser` and `features/runtime/world-state` Impact areas reviewed: - Bot Browser search loading/error/empty/retry states - World-state patch queue, optimistic visible state, durable localStorage restore, and refresh suppression - Feature-layer dependency boundaries and generated Graphify map Boundary notes: - Feature/runtime-only TypeScript changes. - No engine, shared API, Rust, Tauri command, or remote-runtime boundary changes. - No raw Tauri invoke or raw remote-runtime fetch additions. Pressure points touched: - None of the known pressure points were touched: `ModeSurface`, `GameSurface`, shared mode UI, `src-tauri/src/lib.rs`, and import modules are unchanged. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> - [x] `pnpm check` passes locally - [x] `pnpm typecheck` passes locally - [x] `pnpm build` passes locally - [x] `pnpm check:architecture` passes locally - [x] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes - `pnpm exec vitest run src/features/runtime/world-state/hooks/use-world-state-patcher.test.ts src/features/shell/bot-browser/components/BotBrowserView.test.tsx` passed: 2 files / 10 tests. - `pnpm typecheck` passed. - `pnpm check:architecture` passed. - `git diff --check origin/refactor...HEAD -- . ':(exclude)graphify-out/**'` was clean. - `graphify update .` completed after the source changes. - Native Tauri/manual Bot Browser UI verification was not run. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims No docs changes were made because this PR changes focused feature/runtime behavior and regression tests, not contributor commands, architecture guidance, or public documentation. ## UI evidence Not added. This PR has jsdom regression coverage for the visible Bot Browser state transitions, but no screenshot or Tauri/manual UI pass. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved game state patch handling to prevent stale state from being applied. * Enhanced bot browser search to discard outdated results and prevent display of stale data during searches. * Added safeguards against race conditions in async operations. * **Tests** * Added comprehensive test coverage for game state patching and bot browser search behaviors. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1494?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:13:23 +07:00
Sign in to join this conversation.
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
Pasta-Devs/Marinara-Engine#5111
No description provided.