Repository navigation
v4 T-4.5 Lane C: model extdeps/process.dag + extdeps/file_system.dag — OS-interaction substrate bundle (L-2 spec-first, // Anchor: version-pinned, C5-fidelity, forward-model) #3209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6ddc9d8
65b4bd6
e90f71d
7a107e9
bf4b1cf
4af1ab7
cd82dbe
2721408
240a0ab
61c206b
72008f9
061cba0
430cf44
40f3523
3e5fccc
f31b367
fdee13c
33e3427
0f88009
ac2680f
5713d7e
8dcbc63
b07ffae
690a51e
a918eb0
0d91b1c
1ad0327
a1f8afa
c359b67
5eb8b72
f635cdd
0c6fc55
b3b4436
3b420f7
dcaefb0
dbffab5
ad0c0f5
624c707
d1ef44e
ba75e6e
9bd798c
42e3a0c
2673cd4
d175019
d4a7955
86fe25f
16725e9
02c9073
1ab7862
3d3c4a8
b851f7f
c6370ec
46e823c
41cba61
13ba7c2
9fa2104
307bd35
8887dc5
9bb14c4
2ba6077
57b8e69
e338be5
904945f
968cf9e
966f863
0ea648a
9ebf671
a42e0b3
e0b91d5
ea44aac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,109 @@ | ||
| // src/v4/extdeps/file_system.dag | ||
| // | ||
| // Scope: file system model — paths, file kinds, read/write/list operations. | ||
| // Anchor: https://en.wikipedia.org/wiki/File_system | ||
| // + https://pubs.opengroup.org/onlinepubs/9699919799/ (POSIX File and Directory Operations) | ||
| // | ||
| // Owns: | ||
| // - Path = AbsolutePath | RelativePath | ||
| // - AbsolutePath { components: NonEmptyList<PathComponent> } | ||
| // - RelativePath { components: List<PathComponent> } | ||
| // - PathComponent (NonEmptyStr, no slashes, no nulls — per POSIX portable filename charset) | ||
| // - FileKind = RegularFile | Directory | Symlink(target: Path) | ||
| // - read_file(p) -> Result<FreeMonoid<Char>, Diagnostic> | ||
| // - write_file(p, body) -> Result<Unit, Diagnostic> | ||
| // - list_dir(p) -> Result<List<PathComponent>, Diagnostic> | ||
| // - file_kind(p) -> Result<FileKind, Diagnostic> | ||
| // | ||
| // Scope NOT included in v4 (subset for compiler self-hosting needs): | ||
| // - Permissions (mode bits) — out of scope; v4 compiler reads/writes own files | ||
| // - Timestamps (atime/mtime/ctime) — out of scope; not needed for emission | ||
| // - Memory mapping — out of scope; v4 reads files into memory wholesale | ||
| // - File locking — out of scope; v4 is single-process | ||
| // | ||
| // Consumes: | ||
| // - std/diagnostic.dag: Diagnostic | ||
| // - std/text.dag: Char, String (and their Tier-2 totalizations) | ||
| // - std/algebra.dag: FreeMonoid<Char> | ||
| // - std/collection.dag: List, NonEmptyList | ||
| // | ||
| // Status: scaffold — fill per TASKS.md T-4.5 | ||
| // Brief: see BRIEF_TEMPLATE.md; this file's I/O contract is the immutable | ||
| // contract for the worker. Splitting this file requires explicit operator | ||
| // ratification (substrate extension = stop signal). | ||
|
|
||
| // Scope: file system substrate — paths, file kinds, read/write/list/kind operations. | ||
| // Owns: PosixByteString, NamedPathComponent, PathComponent, AbsolutePath, RelativePathHead, RelativePath, Path, FileKind, FileKindResolutionPolicy, Filesystem, FileBody, file-system request/result/operation carriers. | ||
| // Consumes: Diagnostic, Outcome, Byte, FreeMonoid, List. | ||
| // Status: T-4.5 modeled 2026-05-16. | ||
|
|
||
| module v4.extdeps.file_system | ||
|
|
||
|
|
||
| import v4.std.algebra { FreeMonoid } | ||
| import v4.std.diagnostic { Outcome } | ||
| import v4.std.machine { Byte } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BLOCKING: Byte is imported from origin/main src/v4/std/machine.dag blob 489157... but that file has no Byte declaration, so PosixByteString/FileBody are not grounded in a declared v4 carrier (INVARIANTS P1/P2). |
||
|
|
||
|
|
||
| // Anchor: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html#tag_03_241 | ||
| // coincides: finite POSIX byte sequence. | ||
| type PosixByteString = FreeMonoid<Byte> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BLOCKING: PosixByteString is grounded in Byte, but origin/main has no v4 Byte declaration, so every byte-carried filesystem fact starts from an unresolved primitive instead of a declared std authority (INVARIANTS P1/P2). |
||
|
|
||
| // tag: named pathname component spelling. | ||
| // scaffold: POSIX byte refinements; trigger T-25-core/T-30. | ||
| type NamedPathComponent { | ||
| bytes: PosixByteString | ||
| } | ||
|
|
||
| // 🟡 coproduct dissolution — DECISIONS.md OS-1 | ||
| type PathComponent | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BLOCKING: PathComponent, RelativePath, and FileKindResolutionPolicy are new substrate coproducts without their own 🟢/🟡/🔴 dissolution classifications, so Practice 4/INVARIANTS P1 is incomplete. |
||
| = CurrentComponent | ||
| | ParentComponent | ||
| | NamedComponent { component: NamedPathComponent } | ||
|
|
||
|
|
||
| // Anchor: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html#tag_03_271 | ||
| type AbsolutePath { | ||
| components: List<PathComponent> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BLOCKING: AbsolutePath.components uses List, but origin/main src/v4/std/collection.dag blob 8d8b6... declares no List/Map carriers, so the path and operation surfaces depend on unresolved container authorities (INVARIANTS P1/P2).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BLOCKING: AbsolutePath.components uses List even though origin/main has no v4 List declaration, so path/list-dir carriers depend on an undeclared container authority (INVARIANTS P1/P2). |
||
| } | ||
|
|
||
| // 🟡 coproduct dissolution — DECISIONS.md OS-1 | ||
| type RelativePathHead | ||
| = ParentHead | ||
| | NamedHead { component: NamedPathComponent } | ||
|
|
||
| // 🟡 coproduct dissolution — DECISIONS.md OS-1 | ||
| type RelativePath | ||
| = CurrentDirectory | ||
| | CurrentDescendant { first: RelativePathHead, rest: List<PathComponent> } | ||
| | RelativeDescendant { first: RelativePathHead, rest: List<PathComponent> } | ||
|
|
||
| // 🟡 coproduct dissolution — DECISIONS.md OS-1 | ||
| type Path | ||
| = Absolute { path: AbsolutePath } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BLOCKING: RelativeDescendant cannot represent POSIX relative pathnames whose first component is . and then continue, for example ./foo, even though POSIX defines a relative pathname as any pathname not beginning with slash (https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html#tag_03_271), so the extdep path substrate violates INVARIANTS P1/MODELING M3. |
||
| | Relative { path: RelativePath } | ||
|
|
||
|
|
||
| // Anchor: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_stat.h.html | ||
| // 🟡 coproduct dissolution — DECISIONS.md OS-1 | ||
| type FileKind | ||
| = RegularFile | ||
| | Directory | ||
| | Symlink | ||
|
|
||
| // tag: stat/lstat symlink policy. | ||
| // 🟡 coproduct dissolution — DECISIONS.md OS-1 | ||
| type FileKindResolutionPolicy | ||
| = FollowSymlinks | ||
| | DoNotFollowSymlinks | ||
|
|
||
|
|
||
| // Anchor: https://pubs.opengroup.org/onlinepubs/9799919799/functions/read.html + https://pubs.opengroup.org/onlinepubs/9799919799/functions/write.html + https://pubs.opengroup.org/onlinepubs/9799919799/functions/readdir.html | ||
| type Filesystem | ||
|
|
||
| // coincides: finite POSIX byte sequence. | ||
| type FileBody = FreeMonoid<Byte> | ||
|
|
||
| type ReadFileRequest { | ||
| filesystem: Filesystem | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BLOCKING: ReadFileOutput returns Filesystem from a read-shaped operation, and ListDir/ObservedFileKind repeat that shape, so B3's signature lens cannot distinguish derived-value reads from returned-resource writes (THESIS unenumerated-effects / INVARIANTS P2). |
||
| path: AbsolutePath | ||
| } | ||
|
|
||
| type ReadFileResult = Outcome<FileBody> | ||
|
|
||
| type WriteFileRequest { | ||
| filesystem: Filesystem | ||
| path: AbsolutePath | ||
| body: FileBody | ||
| } | ||
|
|
||
| type WriteFileResult = Outcome<Filesystem> | ||
|
|
||
| type ListDirRequest { | ||
| filesystem: Filesystem | ||
| path: AbsolutePath | ||
| } | ||
|
|
||
| type ListDirResult = Outcome<List<PathComponent>> | ||
|
|
||
| type FileKindRequest { | ||
| filesystem: Filesystem | ||
| path: AbsolutePath | ||
| resolution: FileKindResolutionPolicy | ||
| } | ||
|
|
||
| type FileKindResult = Outcome<FileKind> | ||
|
|
||
| type FileSystemOperations { | ||
| read_file: fn(ReadFileRequest) -> ReadFileResult | ||
| write_file: fn(WriteFileRequest) -> WriteFileResult | ||
This comment was marked as resolved.
Sorry, something went wrong.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verified against current HEAD 6ad9493. The current code intentionally keeps I am not adding a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tracked in d24f512 per the split operator ruling. I did not add an ad-hoc
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Corrected in 9525358 per the superseding operator ruling.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Re-verified against current code. This finding is already addressed in current #3209: |
||
| list_dir: fn(ListDirRequest) -> ListDirResult | ||
| file_kind: fn(FileKindRequest) -> FileKindResult | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BLOCKING: file_kind does not declare whether it is stat-like or lstat-like, so a symlink path can structurally realize as Symlink or as the target kind under the same boundary (extdeps fidelity + INVARIANTS P2). |
||
| } | ||
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-verified on current pre-fix HEAD
13ac279ab206d53bb9738a829802d65094959974and currentorigin/main; this is the same false Outcome finding recurring again.git show origin/main:src/v4/std/diagnostic.dag | rg -n "type Outcome|Produced \\{ value|Rejected \\{ diagnostic"reports369:type Outcome<T>,370: = Produced { value: T }, and371: | Rejected { diagnostic: Diagnostic }. The local worktree has the same declaration, and the imports resolve tov4.std.diagnostic.Outcome. No code change is needed for Outcome. — sent from keen-wren-663