Epic: os: the user, user folders, a child's environment (OS slice 6) #130
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Goal
Slice 6 of
docs/design/OS.md(section 10; signatures in sections 5.6 to 5.8):std/osanswers who the user is and where the user's folders are, and a program can hand a child process an environment as a value. Windows, Linux, macOS and FreeBSD; the browser answersOsError.Unsupportedwhere it has no user.Specification
std/os"the rest of their slices" (#126 to #131); this issue is slice 6.Posix.account(getpwuid_r) andWindows.knownFolderalready exist.Steps (an epic: three PRs, each its own issue when it starts)
Directories.documents/downloads/desktop/pictures/music/videos, theuser-dirs.dirsparser, Known Folders, macOS (#531, landed). Pure TorbScript, no seed.UserandUser.current()(OS.md 5.7). POSIX overPosix.accountandgeteuid; Windows overGetUserNameExWand the process token (SID, elevation). New Windows natives; the compiler does not importUser, so no seed refresh (like volumes, #128).Process.run,runBlocking,runPassingThroughandstartgainenvironment: EnvironmentVariables? = None;Noneinherits. Both halves oftorb_platform_run_processandtorb_platform_child_startinruntime/platform.ctake an environment block (POSIXenviron/execveenvp, WindowsCREATE_UNICODE_ENVIRONMENT). The compiler itself callsProcess.runBlocking, so this is the two-commit rule: commit 1 adds the natives (environment passed as aNAME=valueArrayList<String>) without using them, the seed is refreshed (Torben's), commit 2 gives theProcessfunctions the parameter. Also: OS.md slice 6 marked done,docs/standard-library/os.mdanddocs/standard-library/process.mdupdated,skills/regenerated.Order: 1, 2, 3. Step 3 goes last because it waits for the seed refresh between its two commits. The step issues are filed just in time, one at a time.
Acceptance criteria (of the epic)
Directoriesfunction,UserandUser.current(), andenvironment:on theProcessfunctions, on Windows, Linux, macOS and FreeBSD (FreeBSD's C stays uncompiled here, as OS.md slice 7 says); the browser answersUnsupported.Environment.getof a variable set only throughenvironment:, one that sees a removed variable gone, and one withNonethat sees the inherited environment).torb check --every-targetclean,docs checkclean,skills/regenerated.Seed impact
Step 1 and 2: no. Step 3: yes, a new native the compiler reaches through
Process: two commits, the seed refresh in between is Torben's.Size
Three PRs of one or two Conventional Commits each. One PR for all of it would touch
std/os,std/process,runtime/platform.c,runtime/os/*.cand the seed in one go.Moved from the planning lists of the docs; the design record stays the specification.
[loop:torbscript] intake: in scope (author orion, label loop), source OS.md slice 6, not a duplicate. Depends on #126. next: waiting (dependency #126) until 2026-10-10T04:00:00Z
[loop:torbscript] claim refine by session:loop-torbscript-20261027 until 2026-10-27T05:45Z
os: the user, user folders, a child's environment (OS slice 6)to Epic: os: the user, user folders, a child's environment (OS slice 6)[loop:torbscript] decided by the loop: slice 6 is an epic of three steps (folders, user, child environment), not one PR. Why: it touches
std/os,std/process,runtime/platform.c(both halves) and, for the environment, the two-commit seed rule, because the compiler itself callsProcess.runBlocking; the folders are pure TorbScript and need no seed. Order folders, user, environment: the step that waits for the seed refresh goes last.[loop:torbscript] decided by the loop: the environment crosses the native boundary as a
NAME=valueArrayList<String>(the manifest has no map shape),Nonemeans inherit, andenvironment:goes onrun,runBlocking,runPassingThroughandstart, not only on the two OS.md names, because one shared native body builds the block. The program name is looked up with this process'sPATHon every system (Windows cannot do otherwise), and a doc comment says so.[loop:torbscript] decided by the loop:
Directories.videos()is~/Movieson macOS (the Finder's name); auser-dirs.dirskey set to"$HOME/"means "this folder does not exist" in the XDG convention and falls back to the default instead of answering the home directory.[loop:torbscript] refine: made this an epic with three steps (checklist in the body, acceptance criteria, design record OS.md 5.6 to 5.8, seed impact, size) and filed step 1 as #531 (labels
loop,ready; open issues searched for duplicates by "Process.run environment", "user-dirs", "User.current", "Known Folder", "documents downloads", "EnvironmentVariables": none; #128, #129, #131 are other slices). Steps 2 and 3 are filed just in time. Worker usage: one Sonnet RE worker, about 25 tool calls, no builds. next: waiting (epic: step 1 is #531, implement)[loop:torbscript] claim refine (step 1 #531 landed, cut step 2) by session:loop-torbscript-20261028 until 2026-10-28T07:05Z
[loop:torbscript] refine: verified step 1 on
main(all sixDirectoriesfunctions, theuser-dirs.dirsreading, host tests instd/os/tests/host.test.trb), ticked it in the body, and cut step 2 as #537 (labelsloop,ready; goal, acceptance criteria, design record OS.md 5.7, seed impact none, size one PR of one or two commits). Duplicate search of open issues by "User.current", "User", "SID", "GetUserNameExW", "geteuid", "elevation": none. Step 3 is not filed yet (waits for #537 to land). Claim released. Worker usage: one Sonnet RE worker, about 8 tool calls, no builds. next: waiting (epic; step 2 is #537, implement)