Skip to content

fix(gate): allow DelimitedFiles stdlib and scan @eval imports - #2169

Open
jacktrnr wants to merge 2 commits into
mainfrom
fix/2124-gate-import-scan
Open

jacktrnr wants to merge 2 commits into
mainfrom
fix/2124-gate-import-scan

Conversation

@jacktrnr

@jacktrnr jacktrnr commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2124

What

The run gate's Julia import scan (packages/amico-run/src/import_scan.ts) had two defects:

  1. It refused DelimitedFiles. JULIA_STDLIBS now also lists DelimitedFiles, Mmap, Sockets, Downloads, FileWatching, Libdl and Profile (all checked against Sys.STDLIB on Julia 1.12).
  2. @eval using X hid X from the scan. The scanner only matched lines that started with using/import. Now it:
    • matches each ;-separated statement, with an optional begin and/or @eval / @eval( prefix, so @eval using X, @eval import X, begin using X end and f(); using X; end are all scanned. Indented using in function bodies and begin … end blocks was already matched; a test now pins that.
    • fails closed on loading forms it cannot parse: Base.require(...), quoted :(using X), Expr(:using, …), @eval Mod using X. The reason reads dynamic package loading not supported — use a plain using/import: ….

The multi-line continuation fail-closed behavior and its test are unchanged. The entitlement allowlist is out of scope and untouched.

Acceptance criteria

  • A script with top-level using DelimitedFiles passes the import scan.
  • @eval using X / @eval import X inside a function is refused with the same reason as a top-level using X (the test compares the checkImports results for equality).
  • using/import inside a function body or begin … end block is scanned.
  • The existing multi-line-continuation fail-closed test is unchanged and passes.

Tests

  • packages/amico-run/test/import_scan.test.ts: 4 new cases (DelimitedFiles + stdlibs, @eval forms, in-block forms, dynamic-form fail-closed). 9/9 pass.
  • One-off check: every tracked *.jl in the repo (34 files) still scans with no fail-closed result, so no shipped template or exemplar regresses.
  • pnpm --filter amicode test: 5815 passed, 60 skipped.
  • amico-run full vitest: 2426 passed. 4 failures in upgrade-agents/upgrade-extension happen only under full-suite load; those files pass 16/16 in isolation and do not touch the import scan.
  • amico-run typecheck: clean.

Follow-up (not in this PR)

Once this merges, the atom-transport-demo scripts that use the @eval using workaround can move their imports back to top level.

🤖 Generated with Claude Code

…rt scan

Adds DelimitedFiles, Mmap, Sockets, Downloads, FileWatching, Libdl and
Profile to JULIA_STDLIBS so ordinary scripts need no @eval workaround.

Refs #2124

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7aa0aa03-ff45-4b55-a578-e60d96621fd7
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

…ding

The import scan only matched lines starting with using/import, so the
`@eval using X` + Base.invokelatest workaround hid every package a script
loaded. Now the scanner matches per ;-separated statement, accepts an
@eval / begin prefix, and fails closed on Base.require, quoted
:(using X), Expr(:using, ...) and @eval Mod using X. The multi-line
continuation fail-closed behavior is unchanged.

Refs #2124

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jacktrnr
jacktrnr marked this pull request as ready for review November 23, 2026 22:03
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.

fix(gate): the import scan refuses the DelimitedFiles stdlib, and the @eval workaround hides every import from it

1 participant