Skip to content

feat(runtime): guard root switches and isolate test global state#182

Merged
SutuSebastian merged 4 commits into
mainfrom
fix/runtime-test-isolation
Jun 11, 2026
Merged

feat(runtime): guard root switches and isolate test global state#182
SutuSebastian merged 4 commits into
mainfrom
fix/runtime-test-isolation

Conversation

@SutuSebastian

Copy link
Copy Markdown
Contributor

Summary

  • Enforce one project root per process: initCodemap and configureResolver throw when switching roots mid-process; audit --base worktree reindex is exempt via runtime-swap.ts bracket in makeWorktreeReindex.
  • Add maintainer test helpers (resetRuntimeForTest, installCodemapTestTeardown) with beforeEach/afterEach reset rolled out across initCodemap suites.
  • Validate user config at loadUserConfig time (JSON + imported configs) and document the breaking tighten in api.ts / architecture.md.

Test plan

  • bun test src/runtime.test.ts src/config.test.ts
  • bun run check
  • CI green
  • CodeRabbit pass

Closes PR 3 of the security-hardening orchestrator program.

Codify one-root-per-process: initCodemap/configureResolver throw on mid-process
root changes except audit worktree reindex (runtime-swap bracket). Validate user
config at loadUserConfig; roll beforeEach/afterEach teardown across initCodemap suites.
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@SutuSebastian, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 34 minutes and 58 seconds. Learn how PR review limits work.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff7e0e14-347c-4cd1-918a-8178b473fe58

📥 Commits

Reviewing files that changed from the base of the PR and between aae172f and ea7e477.

📒 Files selected for processing (42)
  • .changeset/runtime-test-isolation.md
  • docs/architecture.md
  • docs/plans/runtime-test-isolation.md
  • docs/plans/security-hardening-orchestrator.md
  • docs/roadmap.md
  • scripts/agent-eval/parse-agent-log.test.ts
  • src/api.test.ts
  • src/api.ts
  • src/application/affected-engine.test.ts
  • src/application/audit-engine.test.ts
  • src/application/audit-engine.ts
  • src/application/boundary-rules.test.ts
  • src/application/callback-synthesis-integration.test.ts
  • src/application/churn-ingest.test.ts
  • src/application/context-engine.test.ts
  • src/application/get-changed-files.test.ts
  • src/application/http-server.test.ts
  • src/application/index-engine.test.ts
  • src/application/index-freshness.test.ts
  • src/application/ingest-coverage-run.test.ts
  • src/application/mcp-server.test.ts
  • src/application/output-budget.test.ts
  • src/application/query-baseline.test.ts
  • src/application/query-engine.test.ts
  • src/application/query-recipes.test.ts
  • src/application/recipe-recency.test.ts
  • src/application/resource-handlers.test.ts
  • src/application/run-call-resolve-synthesis.test.ts
  • src/application/run-index.test.ts
  • src/application/tool-handlers.test.ts
  • src/application/trace-engine.test.ts
  • src/cli/cmd-affected.test.ts
  • src/cli/cmd-cli-parity-e2e.test.ts
  • src/cli/cmd-validate.test.ts
  • src/config.test.ts
  • src/config.ts
  • src/resolver.ts
  • src/runtime-swap.ts
  • src/runtime.test.ts
  • src/runtime.ts
  • src/test-helpers/runtime-reset.ts
  • src/worker-pool.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/runtime-test-isolation

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 and usage tips.

Pair exitRuntimeSwap in outer finally; reset swap depth in test teardown.
Add createCodemap/configureResolver/makeWorktreeReindex coverage; consumer-clean
docs/changeset; delete plan and repoint orchestrator + roadmap.
@changeset-bot

changeset-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ea7e477

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stainless-code/codemap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@SutuSebastian SutuSebastian merged commit 3568c5f into main Jun 11, 2026
11 checks passed
@SutuSebastian SutuSebastian deleted the fix/runtime-test-isolation branch June 11, 2026 06:25
@github-actions github-actions Bot mentioned this pull request Jun 11, 2026
SutuSebastian added a commit that referenced this pull request Jun 11, 2026
Delete orchestrator plan and check off roadmap now that #180#182 are shipped.
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