Skip to content

chore: wire selfHealingManager tests + quota contract CI enforcement - #536

Merged
KooshaPari merged 1 commit into
mainfrom
chore/test-infrastructure-resilience-wiring-20260807
Aug 7, 2026
Merged

KooshaPari merged 1 commit into
mainfrom
chore/test-infrastructure-resilience-wiring-20260807

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Aug 7, 2026 •

Copy link
Copy Markdown
Owner

User description

Three breadth governance improvements:

  1. vitest.config.ts: added src/lib/resilience/__tests__/**/*.test.ts to the include list. The selfHealingManager.test.ts file was already in vitest format but was never picked up by the test runner (no glob match).

  2. src/lib/resilience/tests/selfHealingManager.test.ts: fixed a latent bug in the "updateSettings returns true when threshold changes" test. It used zScoreThreshold: 4 which is not a real config field — the test was a draft from earlier work. Changed to criticalThreshold: 0.99 (which IS tracked by updateSettings). Now all 5 selfHealingManager tests pass.

  3. scripts/check/quota-contract.ts (NEW) + npm check:quota-contract: runs the QuotaStore contract test (from PR fix(quota): rewrite KeyvQuotaStore to satisfy QuotaStore interface (P0 type-drift) #505) via vitest and propagates exit code. Added to combined check:governance chain.

Note on ProcessManager darwin branch: per the audit followup, the darwin branch catch in src/lib/versionManager/processManager.ts:131-155 was already fixed in PR #507 (logs the error and returns {pid, alive: false}). No additional change needed.

TSC: 0 errors (was 0 baseline).


CodeAnt-AI Description

Wire resilience tests into the test suite and enforce quota contract checks in governance CI

What Changed

  • Self-healing manager tests are now included in regular test runs, including a corrected threshold-change scenario
  • Governance checks now run the QuotaStore contract test and fail when its compatibility checks do not pass
  • Added a dedicated command for running the quota contract check

Impact

✅ Resilience regressions caught during standard test runs
✅ Quota store compatibility checked in governance CI
✅ Failed contract checks stop the governance pipeline

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Three breadth governance improvements:

1. vitest.config.ts: added src/lib/resilience/__tests__/**/*.test.ts
   to the include list. The selfHealingManager.test.ts file was
   already in vitest format but was never picked up by the test
   runner (no glob match). Now runs as part of `npm run test`.

2. src/lib/resilience/__tests__/selfHealingManager.test.ts: fixed a
   latent bug in the "updateSettings returns true when threshold
   changes" test. It used `zScoreThreshold: 4` which is not a real
   config field — the test was a draft from earlier work. Changed to
   `criticalThreshold: 0.99` (which IS tracked by updateSettings).

   Before this PR, this test was unreachable (vitest didn't pick up
   the path). When wired up, the bug would have caused 1 of 5 tests
   to fail. Now all 5 pass.

3. scripts/check/quota-contract.ts (NEW): runs the QuotaStore
   contract test (from PR #505, the type-drift fix that prompted
   this whole governance pass) via vitest and propagates the exit
   code. Added npm script `check:quota-contract` and added to the
   combined `check:governance` chain.

TSC: 0 errors (was 0 baseline).
Copilot AI lite review requested due to automatic review settings August 7, 2026 23:05
@codeant-ai

codeant-ai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR d4ee684 Aug 07, 2026 · 23:05 23:09

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@codeant-ai

codeant-ai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@KooshaPari, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 54 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

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.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4d8d2cbb-61a4-410c-b553-5490230b6a11

📥 Commits

Reviewing files that changed from the base of the PR and between 4fc49c0 and d4ee684.

📒 Files selected for processing (4)
  • package.json
  • scripts/check/quota-contract.ts
  • src/lib/resilience/__tests__/selfHealingManager.test.ts
  • vitest.config.ts

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "review"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Aug 7, 2026
@KooshaPari
KooshaPari merged commit a7b72af into main Aug 7, 2026
23 of 29 checks passed
@KooshaPari
KooshaPari deleted the chore/test-infrastructure-resilience-wiring-20260807 branch August 7, 2026 23:06
Comment on lines +24 to +27
[
"node_modules/.bin/vitest",
"run",
CONTRACT_TEST,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The invoked Vitest run transpiles and executes the contract test but does not perform TypeScript type-checking, so the type-level assertions in quotaStore.contract.test.ts are removed before runtime and a broken QuotaStore implementation can still pass this governance check. Run the contract file through the relevant tsc configuration, or otherwise add an explicit type-check step before reporting success. [api mismatch]

Severity Level: Major ⚠️
- ❌ Governance CI can pass after QuotaStore interface drift.
- ⚠️ Broken quota implementations may reach runtime consumers.
- ⚠️ `typecheck:core` omits the contract test file.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** scripts/check/quota-contract.ts
**Line:** 24:27
**Comment:**
	*Api Mismatch: The invoked Vitest run transpiles and executes the contract test but does not perform TypeScript type-checking, so the type-level assertions in `quotaStore.contract.test.ts` are removed before runtime and a broken `QuotaStore` implementation can still pass this governance check. Run the contract file through the relevant `tsc` configuration, or otherwise add an explicit type-check step before reporting success.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

L17 Latency Regression Report

No trace file available — cannot compute regression

Threshold: 10% p99 regression.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

L17 Latency Budget Report

--- Latency Budget Summary ---
  Total endpoints checked: 0
  Passed: 0
  Warnings: 0
  Failures: 0

Checked against: budgets/rest-endpoints.yaml.

@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

const result = spawnSync(
process.execPath,
[
"node_modules/.bin/vitest",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CRITICAL: node_modules/.bin/vitest is a shell-script wrapper, not a Node entry point. spawnSync(process.execPath, ["node_modules/.bin/vitest", ...]) will throw a SyntaxError on Unix and fail on Windows because .cmd files cannot be executed by node directly. Use the actual entry point ./node_modules/vitest/vitest.mjs (as done elsewhere in this repo, e.g. scripts/dev/run-ecosystem-tests.mjs:77).


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
scripts/check/quota-contract.ts 25 node_modules/.bin/vitest is a shell-script wrapper; spawning it via node throws SyntaxError on Unix and fails on Windows. Use ./node_modules/vitest/vitest.mjs instead.
Files Reviewed (4 files)
  • package.json
  • scripts/check/quota-contract.ts - 1 issue
  • src/lib/resilience/__tests__/selfHealingManager.test.ts
  • vitest.config.ts

Fix these issues in Kilo Cloud


Reviewed by step-3.7-flash · Input: 88.3K · Output: 16.5K · Cached: 1.3M

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants