Skip to content

refactor: move file I/O from core to system (capability model)#130

Merged
jig merged 2 commits into
developfrom
refactor/fs-core-to-system
Jul 23, 2026
Merged

refactor: move file I/O from core to system (capability model)#130
jig merged 2 commits into
developfrom
refactor/fs-core-to-system

Conversation

@jig

@jig jig commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Moves slurp, spit, load-file and load-file-once from core to the system library, making core a pure base with no ambient filesystem access. core keeps eval/read-program/read-string — it can evaluate code you hold as data — but can no longer read a file to run it. File access becomes an explicit capability:

  • +system (nssystem.Load) — raw host I/O: slurp/spit, load-file/load-file-once, plus chdir/cwd/mkdtemp/remove-all and the env-var builtins.
  • +require — structured module loading; require reads modules itself (in Go), so it works without system or slurp.

A coherent three-tier capability model, aligned with the integrity work.

What moved

  • slurp/slurp_source/spit + the VerifySource integrity hook: lib/corelib/system.
  • load-file header (header-load-file.lisp) + load-file-once: nscore.LoadInputnssystem.Load.
  • read-program and eval stay in core.
  • command's setupIntegrity now installs system.VerifySource.

Compatibility

  • Not user-facing: the lisp binary loads system by default, so scripts using slurp/spit/load-file are unaffected, as is running a script (the CLI does that via load-file).
  • Breaking for embedders who loaded only core/nscore and used those builtins: they must now also nssystem.Load (after core and its input layer — load-file builds on slurp-source from system plus read-program/eval from core). Documented as a ⚠️ Changed entry in the CHANGELOG.

Test plan

  • Updated the ~15 test harnesses that build core-only envs and use slurp/load-file to also load system/nssystem.
  • Full suite green with and without -tags debugger (the tag activates slurp's lispruntime module-registration path).
  • Binary e2e: running a script (load-file path) and spit+slurp round-trip both work. core.LoadInput now registers only stdin/exit; a core-only env has no slurp/load-file (capability model holds by construction).
  • docgen blurbs + LANGUAGE.md regenerated.

🤖 Generated with Claude Code

jig and others added 2 commits July 23, 2026 16:18
slurp, spit, load-file and load-file-once move from core to the system
library. core becomes a pure base with no ambient filesystem access: it
keeps eval/read-program/read-string (evaluate code held as data) but can
no longer read a file to run it. File access is an explicit capability —
+system for raw I/O, +require for structured module loading (require
reads modules itself in Go, so it needs neither slurp nor system).

- Move slurp/slurp_source/spit + the VerifySource integrity hook from
  lib/core to lib/system; move the load-file header (header-load-file.lisp)
  and load-file-once from nscore.LoadInput to nssystem.Load. read-program
  and eval stay in core.
- command's setupIntegrity now installs system.VerifySource.
- Not user-facing: the lisp binary loads system by default, so scripts
  and CLI script execution (which uses load-file) are unaffected.
  Breaking for embedders loading only core — they must add nssystem.Load
  (after core + its input layer). Documented in the CHANGELOG.
- Updated the ~15 test harnesses that build core-only envs and use
  slurp/load-file to also load system/nssystem; docgen blurbs and
  LANGUAGE.md regenerated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fullEnv REPLed the load-file header but didn't register slurp-source
(which moved to system), so load-file failed and the DAP server hung
waiting for a stopped event that never came — a 10m timeout under
-tags debugger ./... on CI. Add system.Load(ns). Verified the full
tagged suite passes with no hang.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jig
jig merged commit cd1064e into develop Jul 23, 2026
14 checks passed
@jig
jig deleted the refactor/fs-core-to-system branch July 23, 2026 14:38
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