Skip to content

CodeRabbit Generated Unit Tests: Generate Unit Tests for PR Changes - #48

Merged
BillyOutlast merged 5 commits into
developfrom
coderabbitai/utg/417db63
Jul 26, 2026
Merged

BillyOutlast merged 5 commits into
developfrom
coderabbitai/utg/417db63

Conversation

@coderabbitai

@coderabbitai coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Unit test generation was requested by @BillyOutlast.

The following files were modified:

  • libraries/libarchive/tests/lib.rs
  • server/rules/no-prisma-delete.test.ts

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Author

Important

Review skipped

This PR was authored by the user configured for CodeRabbit reviews. CodeRabbit does not review PRs authored by this user. It's recommended to use a dedicated user account to post CodeRabbit review feedback.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d44c0058-6b17-4bfa-a09c-2e9cb90da28c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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: "auto_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

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

@greptile-apps

greptile-apps Bot commented Jul 26, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds generated unit tests for two components: a pair of Rust integration tests targeting the Reader::read_block method in libraries/libarchive, and a TypeScript RuleTester suite for the no-prisma-delete ESLint rule. It also renames no-prisma-delete.mtsno-prisma-delete.ts and updates the ESLint config import accordingly.

  • Rust tests (lib.rs): Two new tests verify that read_block accumulates exactly the bytes reported by the entry's size() and that it safely returns Ok(None) on repeated calls after an entry is exhausted, validating the iterative refactor described in the comment block.
  • ESLint rule tests (no-prisma-delete.test.ts): RuleTester cases correctly cover the allow-listed models (hard-delete permitted), non-prisma clients (ignored), and non-allowed models (error expected) — all consistent with the current blacklistedFunctions = ["delete"] in the rule.
  • File rename (no-prisma-delete.mts.ts): Import in eslint.config.mjs is updated to match; the rule's content is unchanged.

Confidence Score: 5/5

Safe to merge — tests are additive only, the rename is a mechanical one-line change, and no production logic was altered.

All test cases in no-prisma-delete.test.ts are correctly aligned with the current rule (blacklistedFunctions = ["delete"], allowedModels set). The Rust tests for read_block are well-scoped: one accumulates bytes against entry.size() to verify the iterative refactor, the other checks idempotent Ok(None) after drain. No new runtime paths or security surfaces were introduced.

Files Needing Attention: No files require special attention.

Important Files Changed

Filename Overview
server/rules/no-prisma-delete.test.ts New RuleTester suite; valid/invalid cases are logically consistent with the current rule (blacklist = ["delete"], allowedModels set).
libraries/libarchive/tests/lib.rs Two new Rust integration tests for read_block; Entry import correctly added; assertions match stated regression contract.
server/rules/no-prisma-delete.ts Renamed from .mts to .ts; no content changes.
server/eslint.config.mjs Import path updated to match the .mts → .ts rename; single-line change, no logic impact.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[CallExpression node] --> B{funcId in blacklistedFunctions?\n'delete'}
    B -- No --> C[Return / allow]
    B -- Yes --> D{tableExpr.object.name == 'prisma'?}
    D -- No --> C
    D -- Yes --> E{modelName in allowedModels?}
    E -- Yes\ncompanyGame, gameTag,\nlinkedAuthMec, linkedMFAMec,\ninvitation, apiToken,\ncertificate, session --> C
    E -- No --> F[report: noPrismaDelete]

    style F fill:#f66,color:#fff
    style C fill:#6a6,color:#fff
Loading

Reviews (4): Last reviewed commit: "fix: update eslint config import to use ..." | Re-trigger Greptile

Comment thread server/rules/no-prisma-delete.test.ts Outdated
Comment thread server/rules/no-prisma-delete.test.ts Outdated
coderabbitai Bot and others added 3 commits July 26, 2026 10:53
- Rename .mts to .ts (rolldown can't parse import type in .mts)
- Move RuleTester.run outside it() block (ESLint generates its own describe/it)
- 17 new tests pass (157 total)
@BillyOutlast
BillyOutlast force-pushed the coderabbitai/utg/417db63 branch from fd3f604 to 5eb82e5 Compare July 26, 2026 14:57
@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@BillyOutlast
BillyOutlast merged commit 4a6402c into develop Jul 26, 2026
23 of 24 checks passed
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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