Skip to content

VFS step 3: Dir.entries/Dir.children over the boot fixture - #30

Open
sam-xif wants to merge 1 commit into
nori/vfs-step1-file-read-writefrom
nori/vfs-step3-dir-entries
Open

sam-xif wants to merge 1 commit into
nori/vfs-step1-file-read-writefrom
nori/vfs-step3-dir-entries

Conversation

@sam-xif

@sam-xif sam-xif commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Summary

Implements step 3 of issue #7's ship order — directory listing — which continues the symbolic virtual filesystem after step 1 (PR #21). Dir.entries(path) answers [".", ".."] followed by the child basenames, and Dir.children(path) the basenames alone, in the stored (boot-sorted) order over the same boot fixture the step-1 operations use.

This is stacked on #21 (step 1). The base branch is nori/vfs-step1-file-read-write; the diff is step 3 only.

Closes: part of #7 (step 3).

What changed

Model (RubyCore/)

  • allocStrArr (Builtins/FS.lean) allocates the answer Array with one fresh String per name, accumulating through the foldPair_frame shape.
  • runFS handles Dir#entries / Dir#children: an absolute path that resolves to a dir yields the names; a miss would raise Errno::ENOENT and a non-dir Errno::ENOTDIR, both gated by name (step 7 owns Errno).
  • Prelude.boot's fsSingleton installs entries/children on Dir's eigenclass.
  • allocStrArr_frame joins rootFrameLem (stated after foldPair_frame, whose proof it uses).

Bug this fixes

Step 1 registered entries/children/mkdir as instance methods on Dir in builtinMethods but omitted them from the singleton install on Dir's eigenclass. So Dir.entries("/tmp") answered

NoMethodError: undefined method 'entries' for class Dir

on an ordinary, safe CRuby method — a wrong answer inside the type-error family the validator claims to exclude, not an honest gate. entries/children now dispatch through ordinary lookup. (Dir.mkdir is still the same class of gap; it is outside #7 step 3, so it is left for a follow-up rather than scope-crept here — see the new issue.)

Gating is honest

Unmodeled operations stay named Unsupported. Dir.entries("/nope") and Dir.entries("/tmp/readme.txt") gate on the Errno they would raise rather than fabricating one (step 7 models Errno).

Verification

  • lake build rubycore green.
  • lake build shows the same 198 pre-existing errors from main does not build: lean-gate is red (267 errors in Denote/ and Ratchet/) #9 as the base branch (dangling SubclassRule imports + the in-progress semantic rebuild CI runs report-only) — verified by building the base branch untouched; this PR adds none.
  • scripts/run_typed_ratchet.sh --clink-rebuild → CLINK REBUILD CHECKS PASS, 125 certified / 0 gated / 125 total.
  • scripts/check-proofs.sh → metatheory builds; headline theorems rest on propext + Classical.choice + Quot.sound only.
  • scripts/check-isolation.sh → OK.
  • Model-vs-CRuby observations over the fixture:
    • Dir.entries("/tmp") → [".", "..", "readme.txt", "vfsdata"]
    • Dir.children("/tmp") → ["readme.txt", "vfsdata"]
    • Dir.entries("/") → [".", "..", "tmp"]
    • Dir.entries("/tmp/vfsdata") → [".", "..", "nums.txt"]
    • Dir.entries("/nope") → gate (Errno::ENOENT); Dir.entries("/tmp/readme.txt") → gate (Errno::ENOTDIR)

The CRuby-materialized "vfs" difftest envelope (which must reproduce the fixture byte-for-byte) remains the next step and is not claimed here.


This PR was authored by Nori, an autonomous coding agent, on behalf of @sam-xif. The implementation, tests, and description above were produced by the agent; a human should review before merging.

Step 3 of issue #7's ship order. Dir.entries(path) answers
[".", ".."] ++ child-basenames and Dir.children(path) the basenames alone,
in the stored (boot-sorted) order, over the same symbolic tree step 1 built.

This also fixes a wrong answer step 1 left in place: entries/children were
registered as instance methods on Dir in builtinMethods but omitted from the
singleton install on Dir's eigenclass, so Dir.entries("/tmp") answered
NoMethodError for class Dir -- a name inside the type-error family the
validator claims to exclude, on an ordinary safe CRuby method.

- allocStrArr allocates the answer Array with one fresh String per name,
  accumulating through the foldPair_frame shape so framing goes through.
- runFS handles Dir#entries/Dir#children; a missing path (Errno::ENOENT) or a
  non-dir (Errno::ENOTDIR) gates by name, since Errno is step 7.
- fsSingleton's Dir row gains entries/children.
- allocStrArr_frame joins rootFrameLem (stated after foldPair_frame).

Verified: lake build rubycore green; lake build shows the same 198 pre-existing
passes (125/125); check-proofs.sh builds the metatheory on the standard three
axioms.
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.

2 participants