Skip to content

fix(cli): map an external project's paths to the cheap gate - #11

Merged
jerryshell merged 1 commit into
mainfrom
feat/external-next
Nov 4, 2026
Merged

jerryshell merged 1 commit into
mainfrom
feat/external-next

Conversation

@jerryshell

@jerryshell jerryshell commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Why

The roadmap's dogfooding item exists to find exactly this: a gate that only works for the bundled starter game.

With GAI_GAME pointing at ~/nova-survivors-gai, bin/gai next components/abilities/ability_base/ability_base.gd answered check, not script. The rule table knows the game/ prefix of the starter game, and a real project has no such prefix, so every script edit in a real project paid for the full check.

What changed

next resolves a path against the project when the project is not the bundled one:

  • a .gd gives script, and the command maps the path to res:// relative to the project (res://components/ability.gd);
  • a file under tests/ gives check;
  • anything else gives check.

Rule names read <game>/**/*.gd and <game>/tests/** so it is visible which project they belong to.

The dogfood run, in numbers

Against ~/nova-survivors-gai: 147 scripts, 15 autoloads, 94 class_names.

  • doctor: ok. check: ok. lint: 147 scripts, 0 problems.
  • test --scene-dir res://tests: 35 scene tests pass in 145 s.
  • export linux --output /tmp/...: 190.4 MiB, Steam runtime copied, and the binary starts headless with its save, settings, and Steam singleton loaded.
  • The bridge on the real game: script.classes returns 94 classes from the import cache, script.class returns AbilityBase with doc and methods, scene.tree returns the real MainMenu, a lock on /root/MainMenu allows the holder's write and refuses a guest with -32004, and the audit log shows role, ceiling, target, and outcome per mutating call.
  • check --script for one script on that project: 7.9 s.

Verification

  • test_external_project_scripts_use_the_script_gate: with GAI_GAME set, a project .gd gives gate script, the command is check --script res://components/ability.gd --no-run, a .tscn gives check, and a test .gd reports <game>/tests/**.
  • test_next 18 tests, test_build 16, bin/gai check green, pre-commit passes.
  • No engine source changes, so the Windows matrix is not re-run.

Dogfooding on nova-survivors-gai found this: with `GAI_GAME` set, `next` matched
`components/x.gd` only against the catch-all rule, so every script edit in a real
project was sent to the full check. The table knew the `game/` prefix of the
bundled starter game and nothing else.

`next` now resolves a path against the project when the project is not the
bundled one: a `.gd` gives `script` with a `res://` command, a file under
`tests/` gives `check`, anything else gives `check`. The rule names are
`<game>/**/*.gd` and `<game>/tests/**` so a reader can see which project they
belong to.

Measured on the real project: `check --script` for one script takes 7.9 s, which
is the difference between a script gate and the 90-second full check.

The same run recorded the rest of the dogfood: check ok with 15 autoloads, 35
scene tests, lint clean on 147 scripts, a 190.4 MiB Linux export that starts
headless, `script.classes` answering with 94 classes, and locks plus the audit
log working on a real scene.
@jerryshell
jerryshell merged commit e24090b into main Nov 4, 2026
20 checks passed
@jerryshell
jerryshell deleted the feat/external-next branch November 4, 2026 07:58
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