Repository navigation
Integrate durable I/O and checked interpreter globals for Goetic - #43
Merged
bytetroll merged 16 commits intoNov 21, 2026
Merged
Conversation
Matrix-authored Enigma exposed a general library gap: a checked atomic write synchronized the candidate inode and published its name, but left the parent directory undurable, a stream flush was not a filesystem barrier, and no supported advisory-lock API existed. Applications had to supply their own platform host. Add write_bytes_durable, sync_directory, acquire_file_lock, and release_file_lock to nil.std.io as an additive POSIX profile. Durable writes reuse the atomic publication helper and synchronize the same anchored directory descriptor used to publish; a post-publication sync failure returns an explicitly uncertain outcome rather than implying the old destination survived. Existing write_bytes_atomic and File.flush contracts are unchanged. Locks are nonblocking exclusive advisory locks on private 0600 regular files. A runtime-owned registry holds the descriptors and hands out process-monotonic tokens that are never recycled, never expose a host descriptor, are checked against their owning execution context, and are closed at invocation termination and context teardown. Execution checkpoints reject open locks. Unsupported platforms fail closed before any filesystem mutation. Tests cover the shared OS helpers, embedded VM invocation/reset/destructor cleanup, static and shared native context lifetimes, paired Ny/Matrix textual and binary VM plus AOT and JIT routes, malformed ABI declarations, private file modes, contention, and Linux file and directory sync fault injection including uncertain publication. This is a Linux-tested POSIX mechanism, not a production database protocol, power-loss certification, pathname containment service, or rollback defense. Private-directory creation, owner/mode inspection, standalone SHA-256, and a complete storage host remain separate APIs. Source declarations alone do not give an installed SDK the new provider; release qualification is independent work. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
NIL-0028 left private-directory creation, owner/mode inspection, and a standalone SHA-256 as separate APIs, so a storage application still had to supply a platform host for them. Each mechanism already existed and was exercised inside the framework: owner-only directory creation for toolchain scratch space, the private-regular predicate used when acquiring a lock, and SHA-256 for module fingerprints. The gap was a supported language surface, not an algorithm. Add create_private_directory, is_private_regular_file, is_private_directory, and sha256_hex. Directory creation applies its mode at creation rather than through a later chmod, which would expose a writable directory in between, and an existing entry is reported rather than adopted. The predicates return Result<bool, text> so three outcomes stay distinct: inspected and matching, inspected and not, or not inspectable. Collapsing absence into a false verdict would let a caller read missing as unsafe or the reverse. Inspection does not follow a final symlink, so a link is judged as itself. A path predicate describes an entry at inspection time and is not a safe substitute for opening it under O_NOFOLLOW; publication and lock acquisition keep their own checked opens. A digest detects accidental corruption and identifies content, and authenticates nothing: whoever can replace the bytes can replace the digest beside them. Tests cover creation mode and exclusivity, cross-kind verdicts, loosened file and directory modes, symlinks to private targets, multiply-linked files, FIFOs, uninspectable entries, unsupported-platform behavior before mutation, and RFC 6234 vectors including embedded NUL bytes. The paired Ny and Matrix fixtures exercise every surface across textual and binary VM, AOT, and JIT, with the host oracle checking directory modes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
read_line faults at end of input, which suits a program that requires input but not a service that reads requests until its caller closes the stream: a clean shutdown became a fault. The Matrix durable host needs this. Its Python predecessor exits zero when standard input closes, and the recovery suite closes the stream to end a session, so a host that faulted there would report failure for an ordinary shutdown. Add read_line_option, which reads a line exactly as read_line does but answers None at end of input. read_line keeps its contract. A genuine input error still faults, and that is the decision rather than a detail: a reader that must fail closed cannot be handed "no more input" when the truth is "cannot read". Distinguishing the two is not free. A C++ stream reports a genuine end of input and a host read error identically, with eofbit and failbit set and badbit clear, so reading a directory descriptor as standard input is indistinguishable from an empty pipe by stream state alone. Only errno separates them, so both providers clear errno immediately before the read and inspect it only when nothing was extracted. The ambiguous case is a failure: a reader that stops early on a healthy stream is a visible bug, while one that reports success after an unread request is a silent one. The surface rides the existing checked ordinary-I/O bridge, so it is lowered once and reaches the interpreter, AOT and JIT routes without separate codegen. Paired Ny and Matrix fixtures cover several lines then a clean stop, a final line without a terminator, and empty input. A separate case feeds a directory descriptor as standard input and requires a fault with no clean-stop output, which is the check that fails if the implementation reads stream state instead of errno. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A Matrix application that draws a fresh identifier per session or per recovery could not be built natively: random.hex was interpreter-only, so native code generation refused the reachable declaration. The Enigma durable host draws a new incarnation on every recovery and hit exactly that. Route the intrinsic through the checked ordinary-I/O bridge and provide it from the same entropy helper and hex encoding the interpreter uses, so a draw does not depend on which route asked for it. Riding the bridge means the interpreter, AOT and JIT routes are all covered without separate codegen. random_bytes stays interpreter-only on purpose. It returns arbitrary bytes, which can include NUL, and native text is a NUL-terminated ABI, so that form cannot cross it. Callers that need raw bytes on a native route can draw hex and decode. Paired Ny and Matrix fixtures check the encoding, the lengths for one, 16 and 32 bytes, that independent draws differ, and that a zero, negative or oversized count is an error rather than a short draw, across every route. The existing secure-random fixtures stay interpreter-only because they also exercise random_bytes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Nov 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goetic needs the current compiler/editor fixes together with Enigma's durable I/O APIs. This integration combines those lineages and preserves imported Matrix class values through typed interpreter globals, record wrappers and concrete enum payloads, including explicit
Option<Class>factories.The loader requires exact declared schemas and proven payload types; runtime extraction checks the live variant and payload layout. Code generation now resolves generic enum identities consistently in functions and field metadata. Per-admission immutable indexes and bounded caches remove repeated schema scans while retaining parser and VM-load validation for mutable embedding inputs. The same sealed Goetic bytecode improves from 45.58 seconds to 0.451 seconds for admission alone; actual HTTP readiness is 0.56 seconds under the unchanged ten-second deadline.
Validation for clean source
167ae3aand Linux development SDK5931094a:The README, format/class references and notebook describe the tested boundaries and exact qualification identities. Durable filesystem APIs remain POSIX-only; Windows checked rejection is not parity. Native aggregate globals and the Matrix local
resultnaming issue remain unsupported/open respectively. No stable-release qualification is claimed.Goetic has adopted the immutable Linux development SDK at its safe build boundary and successfully rebuilt its application and maintenance tooling. The shared SDK default is unchanged. This PR is stacked on #41; independent review and base/main gates remain required before merging.