You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tools/gen_init_templates.w documented invocation broken: bare extern calls outside unsafe #1070
At 450733e, the header comment's documented command with run tools/gen_init_templates.w fails:
error: manual extern function call requires unsafe context
--> tools/gen_init_templates.w:28:11
28 | let doc = with_fs_read_file("docs/with_for_ai.md")
error: manual extern function call requires unsafe context
--> tools/gen_init_templates.w:52:4
52 | if with_fs_write_file("src/InitTemplates.w", out) != 0:
error: run failed
Same drift signature as #1068/#1069 (predates the unsafe-extern rule). Sibling tools/nightly_release_metadata.w (:9, :60) shows the required shape (unsafe { with_fs_... }). Per the audit, the generation logic itself is byte-verified (a fixed copy regenerates the checked-in file byte-exact), so the fix is two unsafe wraps. Risk if unfixed: the next docs/with_for_ai.md edit cannot regenerate templates, and the cli-selfhost-project-tests lane (byte-exact doc comparison) has no working producer.
Verdict. Reproduced: with run tools/gen_init_templates.w (the command in the file's own header comment) fails with two manual extern function call requires unsafe context errors on the bare with_fs_read_file/with_fs_write_file calls. Same drift as #1068/#1069 — the tool predates the rule that a manual extern call needs unsafe.
Source / fix template. The tool declares extern fn with_fs_read_file/with_fs_write_file (tools/gen_init_templates.w:6-7) and calls them at :28/:52 without unsafe. The sibling tools/nightly_release_metadata.w shows the required shape: if unsafe { with_fs_write_file(path, data) } != 0: (:9). Established by the run above; no compiler defect (the checker correctly requires unsafe for a manual extern call).
Severity. Low: the tool that regenerates src/InitTemplates.w from docs/with_for_ai.md cannot run, so the next guide edit cannot regenerate the templates and the byte-exact doc-comparison lane (cli-selfhost-project-tests) has no working producer. No user-facing impact.
Related.#1068/#1069/#1073 — same stale-tool wave. No open PR.
Recommendation — champion, two unsafe wraps. Wrap the with_fs_read_file/with_fs_write_file calls in unsafe { ... } (or switch to std.fs, noting read_file now returns Result). The report states a fixed copy regenerates the checked-in file byte-exact, so the generation logic is sound. Acceptance criteria: with run tools/gen_init_templates.w runs and reproduces src/InitTemplates.w byte-for-byte.
Not tested. I did not run a fixed copy to confirm byte-exact regeneration (read-only); the report did. Linux/Windows not exercised.
Triage 2026-10-25, with v0.15.3.0 (main a261b65): does not reproduce; the documented tool (with run tools/gen_init_templates.w) compiles. It was checked rather than run because running it rewrites generated files in the tree.
Activity
ehartford commentedon Sep 16, 2026
Review: reproduced
Verdict. Reproduced:
with run tools/gen_init_templates.w(the command in the file's own header comment) fails with twomanual extern function call requires unsafe contexterrors on the barewith_fs_read_file/with_fs_write_filecalls. Same drift as #1068/#1069 — the tool predates the rule that a manual extern call needsunsafe.Tested.
main@ 5809ac1 (2026-09-14); the tool predates 450733ewith v0.15.2.1built from 5809ac1 (staging worktree); a compiler built from 450733e with the nightly-20260903 seed (2 errors)with run tools/gen_init_templates.w, both compilers:Source / fix template. The tool declares
extern fn with_fs_read_file/with_fs_write_file(tools/gen_init_templates.w:6-7) and calls them at:28/:52withoutunsafe. The siblingtools/nightly_release_metadata.wshows the required shape:if unsafe { with_fs_write_file(path, data) } != 0:(:9). Established by the run above; no compiler defect (the checker correctly requiresunsafefor a manual extern call).Severity. Low: the tool that regenerates
src/InitTemplates.wfromdocs/with_for_ai.mdcannot run, so the next guide edit cannot regenerate the templates and the byte-exact doc-comparison lane (cli-selfhost-project-tests) has no working producer. No user-facing impact.Related. #1068/#1069/#1073 — same stale-tool wave. No open PR.
Recommendation — champion, two
unsafewraps. Wrap thewith_fs_read_file/with_fs_write_filecalls inunsafe { ... }(or switch tostd.fs, notingread_filenow returnsResult). The report states a fixed copy regenerates the checked-in file byte-exact, so the generation logic is sound. Acceptance criteria:with run tools/gen_init_templates.wruns and reproducessrc/InitTemplates.wbyte-for-byte.Not tested. I did not run a fixed copy to confirm byte-exact regeneration (read-only); the report did. Linux/Windows not exercised.
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): does not reproduce; the documented tool (with run tools/gen_init_templates.w) compiles. It was checked rather than run because running it rewrites generated files in the tree.