Skip to content

test(runtime): guard both halves of the headless hydrate repo gate - #10443

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/restore-floating-tab-inventory-guard
Jul 24, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/restore-floating-tab-inventory-guard

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

Summary

No user-visible change — test-only. #10437 fixed two real behaviors, but neither is asserted on main today, so a revert of either would land silently. This adds a guard for each.

#9343 broke two contracts at once:

  1. Fail-open on an unavailable inventory. The gate read this.store?.getRepos?.() ?? [], so a store that cannot report repos yielded an empty set — indistinguishable from "every repo is gone" — and hydrated zero tabs.
  2. The floating-tab poll stays inventory-free. The gate resolved getRepos eagerly on every hydrate, including the hot poll path that is contractually free of repo/provider inventory work.

#10437 fixed both. But the way the failing tests were repaired in 772081577e (#10429) left both unguarded:

  • The poll test's expect(getRepos).not.toHaveBeenCalled() was deleted and replaced with a comment saying hydrate "may consult getRepos".
  • orca-runtime-terminal-retirement.test.ts was given getRepos: () => [LIVE_REPO], so its store always reports a live repo and never exercises the unavailable case.

Screenshots

No visual change.

Testing

  • pnpm typecheck — passes

  • pnpm test — src/main/runtime/ = 2623 passed, 1 skipped

  • pnpm lint — oxlint clean on the touched file (via lint-staged)

  • pnpm build — not run; this PR touches one .test.ts file, no production code.

  • Both guards verified to fail against the pre-fix(runtime): stop the headless hydration repo gate from dropping every tab #10437 code, not just to pass against the current code:

    Guard Regression reintroduced Result
    Poll stays inventory-free eager new Set((getRepos?.() ?? []).map(...)) expected "vi.fn()" to not be called at all, but actually been called 2 times
    Fail open when unavailable new Set((knownRepos ?? []).map(...)) — laziness kept, null collapsed expected [] to deeply equal [ ObjectContaining{…} ]

    The production file is byte-identical to main in this PR; the reverts above were local scratch edits, used only to confirm each assertion has teeth.

Note on the first attempt

My initial fail-open test lived in orca-runtime-terminal-retirement.test.ts and passed even with the regression reintroduced — syncSplit() populates the tabs in memory, so hydration never ran and the assertion proved nothing. It's rewritten here against makeWorkspaceSessionWithHeadlessTerminal(), which reaches the gate for real. Flagging it because a green test that cannot fail is worse than no test.

AI Review Report

Self-reviewed. Checks run:

Security Audit

No input handling, command execution, path handling, auth, secrets, dependency, or IPC surface touched — two test cases against an in-memory store mock. Nothing to follow up.

Notes

#9343 broke two contracts at once and #10437 fixed both, but neither is
asserted: #10429 repaired the failing tests by deleting the poll assertion and
by handing the retirement store a live repo, so a revert would land silently.

Restore `expect(getRepos).not.toHaveBeenCalled()` on the floating-tab poll, and
add a hydrate case for a store that cannot report repos. Verified both fail
against the pre-#10437 code: the poll assertion reports getRepos "called 2
times", and the hydrate case returns [] instead of the persisted tab.
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 27ab4583-9ab9-48d8-8819-0a0b12022c81

📥 Commits

Reviewing files that changed from the base of the PR and between 6a72c8f and 38839fc.

📒 Files selected for processing (1)
  • src/main/runtime/orca-runtime.test.ts

📝 Walkthrough

Walkthrough

Expanded OrcaRuntimeService tests to verify floating-tab hydration does not call getRepos. Added coverage for persisted mobile session tabs when getRepos is unavailable, asserting hydration preserves the expected terminal tab shape.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the test-only PR focused on guarding runtime hydrate repo-gate behavior.
Description check ✅ Passed The description matches the required template and includes summary, screenshots, testing, review, security, and notes sections.
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

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.

@brennanb2025
brennanb2025 merged commit e058370 into main Jul 24, 2026
2 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#10443)

stablyai#9343 broke two contracts at once and stablyai#10437 fixed both, but neither is
asserted: stablyai#10429 repaired the failing tests by deleting the poll assertion and
by handing the retirement store a live repo, so a revert would land silently.

Restore `expect(getRepos).not.toHaveBeenCalled()` on the floating-tab poll, and
add a hydrate case for a store that cannot report repos. Verified both fail
against the pre-stablyai#10437 code: the poll assertion reports getRepos "called 2
times", and the hydrate case returns [] instead of the persisted tab.
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