fix: add SAFETY comments to all unsafe blocks in vm/mod.rs#1
Merged
Conversation
Documents the invariants required at every unsafe site: - as_heap_ref: lifetime and RC liveness requirements - clone_rc/drop_rc: Rc::into_raw pairing contract - get_unchecked calls: bounds guaranteed by compiler-emitted indices - unwrap_unchecked calls: frames non-empty while execute() runs - raw stack pointer writes: register slots pre-allocated by setup_call
danieljohnmorris
pushed a commit
that referenced
this pull request
Mar 1, 2026
Phase I — what AI agents actually need daily: - I1: JSON parsing (jp, jparse, jdump — the #1 gap) - I2: Shell/command execution (sh builtin + backtick syntax option) - I3: Environment variables (env/env!) - I4: String interpolation (fmt with %s placeholders) - I5: Logging/debug output (log, dbg) - I6: Time and timestamps (now, sleep) - I7: Encoding (urlencode, b64enc/dec, htmlesc) - I8: Regex (match, matchall, sub, suball) - I9: Hashing (hash, hmac for API auth) - I10: Standard output (print, input) - I11: Sleep/delay/retry helpers Non-REST API protocols (G1b-G1d): - G1b: GraphQL (gql builtin or post+jp pattern) - G1c: gRPC (tool server approach — too complex for builtin) - G1d: Server-Sent Events / SSE (streaming LLM responses) https://claude.ai/code/session_01RY1CvsjoNPCwPt3eWQP1WT
5 tasks
danieljohnmorris
added a commit
that referenced
this pull request
May 17, 2026
Multi-fn file dispatch had a silent mis-routing edge: when the leading positional was not ident-shaped (a path like top200.csv, a digit-prefixed string, a sigil) it fell through to 'first declared function' even when the file defined main. ilo main_v5.ilo top200.csv ran the first-declared fn (e.g. hav) with top200.csv as arg #1, producing a confusing type/arity error far from the user's intent. When main is defined and the user didn't pick a different fn name, main is the strong intent signal. Route the positionals to main with type-aware arg parsing (parse_cli_args_typed) so they match main's declared signature. Companion to the helper-extension commit. Files with no main keep the legacy first-fn passthrough so unwrap_*_inline and the existing multi-fn-data-arg tests (numeric / quoted / bracketed leading args on a no-main file) continue to work unchanged. gis-analyst rerun6 and devops-sre rerun6 surfaced this independently - the persona workloads differ but both wrote main + helpers with a non-ident positional, hit the same dispatch bug.
danieljohnmorris
added a commit
that referenced
this pull request
May 17, 2026
Multi-fn file dispatch had a silent mis-routing edge: when the leading positional was not ident-shaped (a path like top200.csv, a digit-prefixed string, a sigil) it fell through to 'first declared function' even when the file defined main. ilo main_v5.ilo top200.csv ran the first-declared fn (e.g. hav) with top200.csv as arg #1, producing a confusing type/arity error far from the user's intent. When main is defined and the user didn't pick a different fn name, main is the strong intent signal. Route the positionals to main with type-aware arg parsing (parse_cli_args_typed) so they match main's declared signature. Companion to the helper-extension commit. Files with no main keep the legacy first-fn passthrough so unwrap_*_inline and the existing multi-fn-data-arg tests (numeric / quoted / bracketed leading args on a no-main file) continue to work unchanged. gis-analyst rerun6 and devops-sre rerun6 surfaced this independently - the persona workloads differ but both wrote main + helpers with a non-ident positional, hit the same dispatch bug.
This was referenced May 17, 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.
Summary
// SAFETY:comments to all 35+ unsafe sites invm/mod.rs/// # Safetydoc section toNanVal::as_heap_refexplaining caller requirementsget_uncheckedbounds,unwrap_uncheckedframe liveness, and raw stack writesMotivation
The file had ~35 unsafe blocks with only 1 SAFETY comment. This makes it impossible to audit soundness — a reviewer cannot tell whether an unsafe operation is intentional or accidental.
Test plan
cargo buildpasses with no new warningscargo testpasses