os: the user, User.current() (step 2 of #130, OS slice 6) #537
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
Step 2 of #130 (OS slice 6):
std/osanswers who the user is.UserandUser.current()as specified indocs/design/OS.mdsection 5.7, on Windows, Linux, macOS and FreeBSD; the browser answersOsError.Unsupported.Specification
Volumes(#128) andDirectories(#531) set for the OS arms, theOsErrormapping and theTaskshape ofcurrent().name,fullName(GECOS,Nonewhere empty),homefromPosix.account(exists,runtime/os/posix.c);identifieris the user id as text;isElevatedisPosix.effectiveUserIdentifier() == 0(geteuid).std/os/src/windows/native.trbandruntime/os/*.c: the login name without its domain, the display name (GetUserNameExW(NameDisplay),Nonewhere the account has none), the SID text (process token,GetTokenInformation(TokenUser)andConvertSidToStringSidW), the elevation of the token (TokenElevation);homefrom the existingWindows.knownFolder(FOLDERID_Profile).OsError.Unsupported.name,fullName,identifier,home,isElevated;Show,Equals); exportUserfromstd/os. Doc comments with examples;docs/standard-library/os.mdand the std index regenerated;skills/regenerated.Acceptance criteria
User.current()answers the account of the running process on the host system:namenon-empty,homeabsolute and equal toDirectories.home()where the environment does not override it,identifiernon-empty,fullNameNoneor non-empty.None, id to text, elevation from the effective id) is a pure function with unit tests on captured input that run on every machine; a host test per system checksidentifierequals the idPosix.effectiveUserIdentifier()/getuidreports.S-1-, the name carries no\domain part, andisElevatedis a plainBool; the SID-text and name-splitting helpers are pure and tested on captured input everywhere.Unsupported(test in the browser arm like the other modules); an account that cannot be read answers aFailed/MissingOsErrorwith the reason, never a panic.torb check --every-targetclean,docs checkclean,skills/regenerated.docs/design/OS.mdsection 5.7 stays the record; any difference found while implementing is noted there (the slice 6 "How slice 6 landed" note is written by the last step, #130 step 3).Seed impact
No. New Windows natives, but the compiler does not import
User(like volumes, #128): no seed refresh, no two-commit rule.Size
One PR, one or two Conventional Commits (for example
feat(os): the Windows natives for the userthenfeat(os): User and User.current).Part of #130. Depends on #531 (landed).
[loop:torbscript] claim implement by session:loop-torbscript-20261028 until 2026-10-28T11:30Z
[loop:torbscript] release implement: worker lost its execution context before pushing anything (no branch exists). Respawning.
[loop:torbscript] claim implement (respawn) by session:loop-torbscript-20261028 until 2026-10-28T11:40Z
[loop:torbscript] implement: PR #540 is open (2 commits,
std/osUser and User.current plus the Windows natives; local checks per the PR body). The worker lost its execution context after pushing and could not post its own result, so this comment releases the claim. CI on the PR is still running; next: waiting (CI and merge gate on PR #540)CI update for #540 (head
b2dc4e6): settled. Green: tier A, bootstrap linux-x64, every host emits the same C, playground, release-sync/registry, commit messages, pdisc. Red: tier B and the aggregate gates only. Tier B is red on main and fixed by #536, so this PR introduces no failure of its own.[loop:torbscript] claim implement (PR #540: drop the WIP prefix, carry it through CI) by session:loop-torbscript-20261028 until 2026-10-28T14:40Z
[loop:torbscript] review: dropped the WIP prefix, PR #540 is now
feat(os): User and User.currentand mergeable. CI on headb2dc4e6unchanged: everything green excepttier B (linux-x64)and the aggregategates, both red for the main-side resource conformance programs that #536 fixes. #536 has not landed (its own tier B is currently red as well, tier A still pending), so no rebase yet. next: waiting (#536 landing on main, then rebase #540 and re-read CI). Claim released. ~60k tokens.[loop:torbscript] claim implement (PR #540: #536 landed on main, rebase onto
403ee176and re-read CI) by session:loop-torbscript-20261028 until 2026-10-28T18:40Z[loop:torbscript] release implement: the rebase worker lost its execution context after pushing. PR #540 is rebased onto main
acf85102(head5e8e8da, linear history, 3 commits, mergeable); bootstrap (linux-x64) is green, tier A, tier B and gates are queued behind the single linux-x64 runner. Main's resource conformance programs are fixed by #536, so tier B is expected green. next: waiting (CI on PR #540 and merge gate)