Skip to content

test(guards): forbid inline import() type references in src/ - #1110

Merged
Artic0din merged 2 commits into
mainfrom
cursor/guard-inline-import-c79e
Dec 6, 2026
Merged

Artic0din merged 2 commits into
mainfrom
cursor/guard-inline-import-c79e

Conversation

@Artic0din

Copy link
Copy Markdown
Owner

Problem

Closes #1106
Related issue: N/A

src/ui/libraryDiscovery.ts used an inline type import (focus?: import("./browseFocus.ts").FocusTarget) instead of a top-of-file import type. That hides dependency edges and fights the no-inline-imports rule.

Approach

  • Replaced the inline type with import type { FocusTarget } from "./browseFocus.ts".
  • Added a repoInvariants check that fails on any import("…") under src/.

Local proof: restoring the old inline form makes the invariant report src/ui/libraryDiscovery.ts:13.

Release Notes

None

Validation

  • node --experimental-strip-types --test --test-name-pattern='inline import' test/native/repoInvariants.test.ts — pass
  • Same test with the old inline form restored — fails on libraryDiscovery.ts:13
  • gitleaks git --staged — no leaks

Risks

None identified. browseFocus.ts does not import libraryDiscovery.ts, so the type import does not add a cycle.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
Open in Web Open in Cursor 

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-12-06T22:10:18.708761Z
We couldn’t complete this review. Comment @codex review to try again.
46f26af PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@sourcery-ai

sourcery-ai Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

Linked issues

Checked at commit 042e0d6

#1106 test(guards): forbid inline import() type references in src/ · 3 of 3 met

# Requirement Status Notes
1 Replace the inline type import with a top-of-file import type. ✅ Met FocusTarget is imported at the top of libraryDiscovery.ts and used in BrowseChange.
2 Add a check that fails on inline import() type/value references under src/. ✅ Met The repo invariant scans the TypeScript source files under src/ for literal-specifier import() references.
3 Prove the check by restoring the old inline form and showing the invariant fails. ✅ Met The PR validation reports that restoring the old form makes the invariant fail at libraryDiscovery.ts:13.

sourcery-ai[bot]

This comment was marked as resolved.

@cursor
cursor Bot force-pushed the cursor/guard-inline-import-c79e branch 2 times, most recently from 916bded to 20b776b Compare December 6, 2026 22:46
cursoragent and others added 2 commits December 6, 2026 23:19
Co-authored-by: Artic0din <Artic0din@users.noreply.github.com>
Co-authored-by: Artic0din <Artic0din@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/guard-inline-import-c79e branch from 20b776b to 042e0d6 Compare December 6, 2026 23:19
@Artic0din
Artic0din merged commit 94eea14 into main Dec 6, 2026
12 checks passed
@Artic0din
Artic0din deleted the cursor/guard-inline-import-c79e branch December 6, 2026 23:32
@github-project-automation github-project-automation Bot moved this from Todo to Done in Auger Dec 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

test(guards): forbid inline import() type references in src/

2 participants