Skip to content

t27os: GODMODE host effects spec, append_line and worktree add/status/remove (Refs #12945) - #13246

Merged
gHashTag merged 3 commits into
masterfrom
t27os-godmode-host
Nov 7, 2026
Merged

gHashTag merged 3 commits into
masterfrom
t27os-godmode-host

Conversation

@gHashTag

@gHashTag gHashTag commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Host effects for GODMODE v1, the second vehicle after the spec layer (#13224, merged as
8f1e1ad). One new file, specs/t27os/godmode_host.t27 (module T27osGodmodeHost),
spec only: no Rust, no CLI glue, no PTY host change.

What it does

  • gm_append_line: appends one journal row. Opens with O_WRONLY|O_APPEND|O_NOFOLLOW;
    a link at the path is ELOOP and gives HR_OPEN. creat(0644) runs only right after
    an open that saw ENOENT, then the file is reopened. One write(2) per row. Row shape
    is checked: 2..4096 bytes, one trailing newline, no NUL.
  • gm_wt_add / gm_wt_status / gm_wt_check / gm_wt_remove: run /usr/bin/git
    through posix_spawn with fixed word lists (at most 7 words, no --, no -c), no
    shell. The environment is exactly PATH=/usr/bin:/bin, LC_ALL=C,
    HOME=/var/empty. stdin is /dev/null, stdout a pipe, stderr appended to a log the
    runner names (O_WRONLY|O_APPEND|O_CREAT|O_NOFOLLOW, 0644), outside the worktree.
    CLOEXEC_DEFAULT, silence timeout with SIGKILL.
  • add refuses a path failing gm_path_syntax_ok (reused, not repeated), a path, branch
    or base starting with -, and less than 5.4 GiB free. The contract default base
    current maps to HEAD.
  • status runs status --porcelain=v1 --untracked-files=all and judges it with
    gm_changes_verdict; quoted paths fail closed. A dirty worktree gives HR_EXIT.
  • remove never passes --force, then proves the worktree is gone from disk (an
    O_RDONLY|O_NOFOLLOW probe sees ENOENT) and from git worktree list --porcelain.
  • gm_validate E006 and gm_row checks are not repeated here.

Known limitations (accepted in review)

  • creat(2) takes no flags: a 3-argument open is variadic and the extern ABI passes no
    variadic mode. So a link planted between the ENOENT open and creat is followed, and
    creat truncates, so racing writers can lose a row. One writer at a time closes both.
  • O_NOFOLLOW guards the last path component only.
  • git still reads its system config.
  • The branch is left behind after remove.
  • Process-wide state: cwd is the repository root (no chdir); the SIGCHLD swap is seen
    by every thread, so gh_run is called from one thread at a time.

Build and tests

  • The build backend is t27b. t27c lowers @extern to a stub, so under t27c the tests
    reach only the pure fns.
  • 32 tests, each with a negative control; the 8 that rest on hand-written host output are
    named faked_. Not run yet (no test runs on the Mac).
  • Run locally after the rebase onto 8f1e1ad: t27c typecheck (0 errors),
    t27c check-calls (no finding in this file, total 51 unchanged), duplicate-name check
    against the imported specs (22 intended imports). Before the rebase: dupe_scan (no new
    group) and lefthook pre-commit (foreign-budget, own-language, gitleaks, commit-msg).
  • CI: duplicate-bodies, scan and Documented t27c subcommands exist are red on master
    at 8f1e1ad; expect the same here.

Not proof of host behaviour

Real effects (git worktree, PTY, command execution, the post-checkout lefthook hook) are
checked only in a live T27 OS pane run, on the owner's word.

Not here: fsync (split off), CLI glue, PTY host changes, Rust.

Refs #12945

🤖 Generated with Claude Code

gHashTag and others added 2 commits November 7, 2026 17:33
…/remove (Refs #12945)

specs/t27os/godmode_host.t27 (module T27osGodmodeHost), spec only, not pushed:

- gm_append_line: open(O_WRONLY|O_APPEND); creat(0644) only on ENOENT,
  then close and reopen; one write(2) per row; close. Row shape checked
  (2..4096 bytes, one trailing newline, no NUL). One writer at a time.
- gm_wt_add / gm_wt_status / gm_wt_check / gm_wt_remove: /usr/bin/git
  through posix_spawn with fixed word lists, no shell, a fixed minimal
  env (PATH=/usr/bin:/bin, LC_ALL=C), stdin/stderr on /dev/null,
  CLOEXEC_DEFAULT, silence timeout with SIGKILL, SIGCHLD default for
  the run and restored after.
- add refuses a path failing gm_path_syntax_ok (reused, no second
  check) or starting with "-", a branch or base starting with "-", and
  less than 5.4 GiB free (statfs of the working directory).
- status runs status --porcelain=v1 --untracked-files=all and judges
  it with gm_changes_verdict; quoted paths fail closed.
- remove never passes --force, then proves the worktree is gone from
  disk (open fails with ENOENT) and from git worktree list --porcelain.

Not here: fsync, CLI glue, PTY host changes, Rust. C imports stay
private because pty_sys.t27 is sealed. 28 tests (8 faked_), each with a negative
control; tests resting on hand-written host output are named faked_.
t27c typecheck: 0 errors. check-calls: no finding in this file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…efs #12945)

Owner review rulings applied to specs/t27os/godmode_host.t27, spec only:

- O_NOFOLLOW on both journal opens (GH_APPEND_FLAGS 9 -> 265); a link at
  the path is ELOOP, HR_OPEN, never a create. creat(2) takes no flags, so
  it runs only right after an O_NOFOLLOW open saw ENOENT; the window
  between the two calls is documented, as is last-component-only.
- The remove probe opens with O_RDONLY|O_NOFOLLOW (GH_PROBE_FLAGS), so a
  link left at the worktree path is HR_LEFT, not "gone".
- git stderr is appended to a log the runner names
  (O_WRONLY|O_APPEND|O_CREAT|O_NOFOLLOW, 0644), not /dev/null; the
  gm_wt_* fns take logp, checked with gm_path_syntax_ok.
- Environment set explicitly: PATH, LC_ALL=C, HOME=/var/empty.
- gh_base_ref maps the contract default `current` to HEAD.
- One flag check, gh_open_flags_ok(f, creat), replaces
  gh_flags_append_only.
- Header documents: process-wide SIGCHLD swap, cwd = repository root,
  the branch left behind after remove (known limitation), dirty worktree
  = HR_EXIT, 7 argv words without -- or -c, t27b as the build backend,
  the post-checkout hook checked only in a T27 OS pane, and that
  gm_validate E006 and gm_row are not repeated here.

32 tests (8 faked_), each with a negative control. t27c typecheck: 0
errors. check-calls: no finding in this file. dupe_scan: 690 groups,
unchanged. Not proof of host behaviour: real effects only in a live
pane run on the owner's word.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-11-07 10:41:37 UTC

Summary

Status Count
Total Open PRs 43
PRs with Failing Checks 40
PRs with All Checks Green 3
READY 2
FAILING 40
PENDING 0
NO CHECKS YET 0

These columns do not partition: 2 + 40 + 0 + 0 = 42, and there are 43 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=e75b498e5e79 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

#12945)

t27c lowers `_ = f(x)` inside a test block to `var _ = f(x)`, which Zig
rejects ("'_' used as an identifier"), so `t27c test-report` reported the
spec BLOCKED and spec-guards failed. faked_statfs_bytes now asserts the
offset put_u64 returns (at + 8). Found with zig ast-check on t27c gen.

Refs #12945

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-11-07 10:53:48 UTC

Summary

Status Count
Total Open PRs 43
PRs with Failing Checks 41
PRs with All Checks Green 2
READY 2
FAILING 41
PENDING 0
NO CHECKS YET 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=e75b498e5e79 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant