Skip to content

fix(quality-gate): let the changed-code gate see the focused import plugins - #20912

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/changed-gate-sees-import-plugin
Sep 17, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/changed-gate-sees-import-plugin

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​10 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​10
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11

Problem

import/no-duplicates lives only in config/oxlint-code-quality-native-plugins.json, which only the repo-wide CI job audit:code-quality:native loads. Nothing an author runs before pushing evaluates it:

gate when an author runs it sees a duplicate import?
oxlint (lint-staged pre-commit) every commit no — exit 0
check:code-quality:changed before push no — 0 findings across all 6 buckets
audit:code-quality:native CI static analysis yes

Measured with a deliberate three-import probe file. So the first signal is a red static analysis job after push — and because CI lints the merge ref, one such warning on main's tip reds static analysis and verify on every open PR.

This is the second occurrence of the identical rule and shape (PR #18776, and now the file #20717 added, fixed standalone in #20907).

Fix

Add the focused-plugin config to OXLINT_SCANS, so the changed-code gate evaluates the same rules CI does.

import/no-cycle is allowed in this scan on purpose. In pr.yml, audit:code-quality:native is step 6 and "Install mobile dependencies" is step 8, so the repo-wide audit structurally cannot resolve a cycle inside mobile/. The changed-code gate is step 9 — after that install. Without the allow, the same rule would be evaluated under two different dependency states in one workflow, and locally it would report findings CI cannot reproduce.

Blast radius

Zero, beyond the violation already fixed in #20907. Repo-wide under this scan's config there is exactly one finding across src config tests mobile, and it is that one. The scan is changed-lines scoped, so no existing branch inherits anything else.

Verification

  • Positive control: probe file with three imports of one module → focused plugins: 1 new finding(s), gate exit 1.
  • Negative control: probe removed → all 7 buckets 0 findings, gate exit 0.
  • pnpm test config/scripts/check-changed-code-quality.test.mjs → 18 passed (adds one scan-shape test).

…lugins

import/no-duplicates was reachable only through the repo-wide CI audit, so an
author's first signal was a red static analysis job after push.
@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

The change adds a focused Oxlint scan to OXLINT_SCANS. The scan uses config/oxlint-code-quality-native-plugins.json and allows import/no-cycle. A test verifies both scan arguments.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 93e09

The focused scan is wired correctly, with only a recommended test improvement to protect its runtime execution and filtering.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, fix, scope, and verification, but it does not follow the repository template. It omits the required Linked Issue, Visual Proof or explicit N/A, Testing section fo… Update the description to include all required template sections. Add the linked issue number, write Visual Proof as N/A with a reason if applicable, preserve testing details in the Testing section, complete or mark the remaining checklist …
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding focused import-plugin checks to the changed-code quality gate.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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.
Full details: Description check

Explanation

The description explains the problem, fix, scope, and verification, but it does not follow the repository template. It omits the required Linked Issue, Visual Proof or explicit N/A, Testing section format, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections.

Resolution

Update the description to include all required template sections. Add the linked issue number, write Visual Proof as N/A with a reason if applicable, preserve testing details in the Testing section, complete or mark the remaining checklist sections, and provide the required Agent skill upstream boundary and Notes information.

✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
config/scripts/check-changed-code-quality.test.mjs (1)

60-68: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Exercise the focused scan through the changed-code quality entry point. The current test only inspects OXLINT_SCANS. It does not exercise main, which iterates the scans, forwards scan.args through runOxlintScan, and applies diagnosticTouchesAddedLines to each scan's diagnostics. The test can therefore pass if the focused scan is omitted, its arguments are lost, or changed-line filtering is bypassed. Add a focused integration test with a stubbed Oxlint result that asserts invocation and ignores diagnostics outside added lines.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 0ad06e20-fa18-438d-be59-a35d3167b4ca

📥 Commits

Reviewing files that changed from the base of the PR and between a9232e8 and 633b69b.

📒 Files selected for processing (2)
  • config/scripts/check-changed-code-quality.mjs
  • config/scripts/check-changed-code-quality.test.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one defer-able observation inline.

Reviewed changes

  • Focused-plugin scan added to the changed-code gate — config/scripts/check-changed-code-quality.mjs:27-37 adds a focused plugins scan so check:code-quality:changed runs config/oxlint-code-quality-native-plugins.json, the same config CI's audit:code-quality:native enforces, with import/no-cycle allowed.
  • Scan-shape test — config/scripts/check-changed-code-quality.test.mjs:60-68 pins the scan's config path and its --allow import/no-cycle wiring.

Independently verified: audit:code-quality:native (pr.yml:140) does precede Install mobile dependencies (pr.yml:154) and check:code-quality:changed (pr.yml:165); without mobile/node_modules the cycle rule resolves nothing even for two internal mobile/src files importing each other, while the same relative-import cycle in src/ is detected with root node_modules — so the allow's premise holds. --allow import/no-cycle drops exactly that rule (number_of_rules 16→15) and import/no-duplicates still fires; the gate passes on this PR's own diff (all buckets 0) and the 18 gate tests pass. Repo-wide the audit shows the single expected pre-existing finding, so the stated blast radius is accurate.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

'--config',
'config/oxlint-code-quality-native-plugins.json',
'--allow',
'import/no-cycle'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The allow is global, so this also turns import/no-cycle off for root src/ files, where CI's repo-wide audit does enforce it — the gate can now pass locally while static analysis fails on a root-file cycle. That's not a regression (the gate had no import rules before), but if the intent is mobile-only parity, scoping the allow to mobile files would keep root coverage intact.

Technical details
# Scope the `import/no-cycle` allow to the mobile dependency state

## Affected sites
- `config/scripts/check-changed-code-quality.mjs:34-35` — `--allow import/no-cycle` applies to every file the scan is handed, root included.
- `config/scripts/check-changed-code-quality.mjs:395-411` (`runOxlintScan`) — one invocation over one `files` list, so a single CLI `--allow` cannot express the split.

## Required outcome
- Root-file cycles that `audit:code-quality:native` would fail stay caught locally; mobile files keep the allow because CI's audit runs before `mobile/node_modules` exists.

## Suggested approach (optional)
- Give a scan an optional file predicate (or split the focused scan into a root invocation with no allow and a mobile invocation with `--allow import/no-cycle`) so the allow is scoped to `mobile/**`.
- Alternatively, leave as-is and accept that CI is the only `no-cycle` gate for root files — that is a reasonable call, hence informational.

@brennanb2025
brennanb2025 merged commit fbe7b19 into main Sep 17, 2026
28 checks passed
brennanb2025 added a commit that referenced this pull request Sep 17, 2026
…ntroduced

main's #20912 let the changed-code gate see the focused import plugins, which
surfaced eight import(no-duplicates) findings across seven of this branch's
files. Same bindings, one specifier each.
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…lugins (stablyai#20912)

import/no-duplicates was reachable only through the repo-wide CI audit, so an
author's first signal was a red static analysis job after push.
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