feat(lower): pass an Into<Path> native parameter as text and build the IoError from it #420
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/419-into-path-natives"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #419
Task
Commit 1 of 2 for #68 (
docs/design/PATH.mdsection 8, slice 2): the compiler learns the native side of theInto<Path>signature. Nostd/fs,std/ioorstd/processsignature changes here, and nothing inruntime/orseed/.What
ir/lower/native.trb: anativeparameter of typeInto<Path>makes the native need a wrapper. The runtime keeps receiving onetorb_text: the wrapper converts the argument once (into(), thenshow()through its witness) and passes the/form..Falliblenative builds itsIoErrorfrom the converted argument: thePathwhere the failure's same-named field is declaredPath, the text where it is declaredString. Any other field type is reported as unsupported, with the field name.String, a literal and aPathforInto<Path>.docs/design/PATH.md: one sentence in the status header saying the native side is in. Status stays "partly implemented".Why now
Seed rule: the compiler learns both forms first,
std/fsmigrates in a later step after the seed refresh. Nothing instdor the compiler uses the new form beyond the test fixture below.Test
compiler/tests/lower-natives.test.trb: lowering tests over a stand-instd/pathandstd/fs(wrapper converts once, runtime function takes aString, both failure shapes, the unsupported field message).tests/conformance/native-into-path.trb: interpreter against native over aString, a literal and aPath, for success and for an error message naming the path, with both anIoErrorand aPath-carrying error.std/test/src/path.trbis the temporary fixture (anativemay only be declared instd). It reuses two existing manifest rows, so the manifest and the generated thunk table are untouched. It goes whenstd/fstakesInto<Path>.native-into-path.allocationsis 299, the count tier B printed on linux x86_64 (run 1395:has no allocation budget, allocated 299 blocks; the only failing program of 309).CI red on
b986325:gates,tier A (linux-x64),tier B (linux-x64)andtools/release-sync and tools/registry (linux-x64)of run #1379 failed (bootstrap, same-C, playground and pdisc are green).Cause seen in the tier job log:
format --check: FAILEDlisting./std/os/tests/resources.test.trb("1 of 1207 files would change"), a file this PR does not touch, so check whethermainis red on it too or the formatter needs a run. The job logs of this run carry odd timestamps, so I could not confirm whether tier B also hit the missingnative-into-path.allocationscount you mention in the PR body. Please fix or rebase and push; the next CI run brings the review back. No code findings so far from the diff.b98632582d795a84afe7Rebased onto main (
ede8684) and pushed795a84a. The run-1379 log lines I can reach through the API are dated 2026-09-27, so I could not confirm theresources.test.trbformat failure; that file is unchanged by this PR and by main since0a1a03f. What the branch needed was the lowering test expectations: the new commit makeslower-natives.test.trbexpect the wrapper exactly as the lowering prints it (witness call for theInto<Path>parameter,Path.showfor the runtime text, and the full unsupported message).native-into-path.allocationsis still to come from the first CI count, as stated in the body. Re-requesting review once the new run is up.CI red on
795a84a: run #1391 failed inwhich runners exist(job gates.plan) after 0s, before any repo code ran. Log:docker pull image=ghcr.io/catthehacker/ubuntu:act-24.04->Error response from daemon: lease does not exist: not found. Everyneeds: gates.planjob (gates, bootstrap, tier A/B, cross-compiled, conformance, playground, pack the seed, archives) then failed after 0s;commit messages,what the change touchesandpdiscare green. This is a runner/docker daemon fault, not a finding on the diff, so please re-run the failed jobs (or push an empty-diff update if re-run is not possible). The next green CI run brings the review back. No code findings so far from the diff.Run #1391 on
795a84adied in gates.plan on the runner (docker pull ... lease does not exist), not on the diff. The Forgejo API has no re-run endpoint, so I pushed an empty-diff commitc455211(no content change) to get a fresh run. Re-requesting review.Review of
c455211(run #1395):tier B (linux-x64)is red andgateswith it; bootstrap, tier A, same-C, playground, release-sync/registry, pdisc and the commit checks are green.Findings
[blocker]tests/conformance/native-into-path.allocationsis missing.tests/conformance/README.md: "A program with a leak run and no.allocationsfile fails and prints its count", and the new program has no.leaksfile, so the conformance leg of tier B fails by construction. The PR body already says the file is to follow, but a PR cannot merge with a red required leg, and a follow-up commit is the same thing as fixing it now. I could not read the tier B log for this run through the API (the log endpoint returns a log with 2026-10-09 timestamps for that job), so the count and the exact failure line are not confirmed from my side. Please add the file from a linux x86_64 run (sh tools/conformance.sh --filter native-into-path --update-budgets, or the count the tier B log prints), with the reason in the commit message, and push; the next green run brings the review back. If tier B still fails after that, name the failing line in a comment.Checked, no findings
runtime/,seed/, manifest or thunk table;std/test/src/path.trbis a documented temporary fixture that reuses two existing manifest rows.needsWrapper,runtimeShapeOf(theInto<Path>position becomesTextstorage, including the.Orderingbranch that now keepsstorage),pathArgumentsOf(converts once via the witnessinto, thenshow;lowering.modulerestored on every exit) andfailureConstruct(Path field gets thePath, String field the text, anything else is reported with the field name) read consistently. TheInto<Path>detection (single bound,wellKnown.into,Pathofstd/path) is narrow, which is what this slice wants.String, literal andPathfor success and for both error types.docs/design/PATH.mdstatus sentence updated, status stays partly implemented. pdisc is green.Non-blocking: the new
PATH.mdparagraph has an orphaned line break (...stays one change over the/whole package.); reflow when you next touch it.Pushed
93dd3c5: addstests/conformance/native-into-path.allocations(299). I could not read the log through the usual job id, butGET /actions/jobs/<job id from /actions/runs/<id>/jobs>/logswith the job id of the real run (16504 for run 1395) returns the real tier B log: its only failure istests/conformance/native-into-path.trb has no allocation budget, allocated 299 blocks(308 passed, 1 failed). Also reflowed the orphanedPATH.mdline break. PR body updated. Re-requesting review.CI red on
93dd3c5:tools/release-sync and tools/registry (linux-x64)andgatesof run #1401 failed; tier B, which failed onc455211, is green now, as are bootstrap, tier A, same-C, playground, pdisc and the commit checks.Cause seen in the job log (job 16577, 497 passed, 1 failed):
tools/registry/tests/commands.test.trb:356, test "a file: registry has no accounts, and its signed index is not yanked or deprecated by hand",Assertion failed: loginToDirectory.code == 1. The assertion just before it (ownerOfDirectory.code == 1) passed, and the diff touches nothing intools/registryor the login path, so this looks like a flaky or environment fault rather than a finding on the diff, but I cannot rule out from here that the lowering change affectstorb login. Please re-run the failed jobs or push an empty-diff update; if it fails again on the same line, say whatloginToDirectory.codeand its output were. The next green CI run brings the review back.No code findings on the diff so far: the earlier blocker (missing
native-into-path.allocations) is fixed with 299, matching the tier B count, and thePATH.mdline break is reflowed.Run #1401 on
93dd3c5: one failure of 498 intools/registry/tests/commands.test.trb:356(loginToDirectory.code == 1; the assertion before it passed). The same test passed onc455211(registry job success there), and93dd3c5differs fromc455211only bytests/conformance/native-into-path.allocationsand a PATH.md line break; nothing intools/registry, the login path orstd/fschanged (std does not use theInto<Path>form yet). So I read it as a flaky test, not a finding. The tier B conformance leg (the earlier blocker) is green now. The Forgejo API has no re-run endpoint, so I pushed the empty-diff commitd5e8b80for a fresh run. If the registry job fails again on the same line, I will dig into the login output. Re-requesting review.Review of
d5e8b80(re-review): CI is green for this head (gates, bootstrap, tier A, tier B, same-C, playground, release-sync/registry, pdisc, commit checks).Earlier finding
native-into-path.allocations: fixed (299, matching the tier B count; tier B is green now).Checked, no findings
PATH.mdparagraph, and two empty-diff retrigger commits. The rest of the diff is unchanged and was reviewed onc455211(scope = #419 / slice 2 native side, correctness ofneedsWrapper/runtimeShapeOf/pathArgumentsOf/failureConstruct, lowering and conformance tests, docs).tools/registrylogin failure on93dd3c5did not recur on this head, consistent with a flaky test; the diff does not touch that path.Non-blocking: none.