Skip to content

test: restore global mock isolation - #1980

Merged
kevincodex1 merged 1 commit into
Twigpine:mainfrom
jatmn:fix/smoke-isolation-followups
Jul 16, 2026
Merged

kevincodex1 merged 1 commit into
Twigpine:mainfrom
jatmn:fix/smoke-isolation-followups

Conversation

@jatmn

@jatmn jatmn commented Jul 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • restore the real provider-startup module after ProviderManager tests
  • remove attribution's process-global governance mock and restore its model mocks
  • restore real settings, config, registry, and analytics modules after sponsored-tip tests
  • import the provider-startup module under a nonce so its regression test is independent of prior test mocks

Scope

Targets four serial smoke-test isolation defects only. This does not overlap #1978 or #1979.

Validation

  • bun test --feature=UNATTENDED_RETRY src/components/ProviderManager.test.tsx src/utils/providerStartupOverrides.test.ts src/utils/attribution.test.ts src/services/tips/sponsoredTips.test.ts src/services/tips/tipScheduler.test.ts
  • bun run smoke
  • git diff --check

Reviewed AGENTS.md and CONTRIBUTING.md.

Summary by CodeRabbit

  • Tests
    • Improved test isolation and cleanup across provider, settings, configuration, analytics, attribution, and sponsored tips test suites.
    • Ensured mocked modules are reliably restored to their real implementations after tests complete.
    • Updated provider override tests to load fresh module instances and verify stale environment settings are cleared.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Test module isolation

Layer / File(s) Summary
Dynamic loading of real modules
src/components/ProviderManager.test.tsx, src/utils/providerStartupOverrides.test.ts
Provider-related tests dynamically load real modules with cache-busting imports and restore captured implementations during cleanup.
Tips suite module teardown
src/services/tips/sponsoredTips.test.ts, src/services/tips/tipScheduler.test.ts
Tips tests explicitly re-bind real config, settings, analytics, and tip registry modules after restoring mocks.
Attribution module restoration
src/utils/attribution.test.ts
Attribution tests remove the governance policy stub and restore model, provider, and settings modules during teardown.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: bug

Suggested reviewers: kevincodex1, techbrewboss

🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
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.
Risk Surface Disclosed ✅ Passed PASS: The patch only changes test isolation files; no auth/provider-routing/startup production code was modified, so no risk-surface blocker is needed.
No Hidden Policy Change ✅ Passed Commit only touches five test files, and hunks are mock reset/import cleanup; no runtime policy, routing, telemetry, or permission code changed.
Title check ✅ Passed Concise and accurately describes the test-only mock-isolation fixes in the diff.
Description check ✅ Passed Covers summary, scope, and validation clearly; Impact and Notes sections are omitted but the core template is complete.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@jatmn
jatmn marked this pull request as ready for review July 16, 2026 03:02
@jatmn jatmn self-assigned this Jul 16, 2026
@jatmn jatmn added the bug Something isn't working label Jul 16, 2026

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@kevincodex1
kevincodex1 merged commit 47123b4 into Twigpine:main Jul 16, 2026
7 of 9 checks passed
@jatmn
jatmn deleted the fix/smoke-isolation-followups branch July 16, 2026 16:45
hotmanxp pushed a commit to hotmanxp/openclaude that referenced this pull request Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants