Skip to content

feat(clock): add time and sleep accessor module - #375

Merged
forketyfork merged 6 commits into
mainfrom
prep/clock-accessor
Sep 1, 2026
Merged

feat(clock): add time and sleep accessor module#375
forketyfork merged 6 commits into
mainfrom
prep/clock-accessor

Conversation

@forketyfork

@forketyfork forketyfork commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Issue

Complete Task 4 of the staged Zig 0.16 migration plan: centralize the 13 timestamp reads and 14 sleep calls while retaining Zig 0.15.2 compatibility.

Continue the same Prep 3 PR with Task 5: centralize subprocess execution while retaining Zig 0.15.2 compatibility.

Solution

  • Add src/clock.zig with wall-clock and sleep accessors plus focused tests.
  • Register the new test file in src/main.zig.
  • Route all specified timestamp and sleep call sites through clock.
  • Add the clock module to the standalone MCP control module in build.zig, required because src/app/control.zig imports ../clock.zig and is compiled as its own module.
  • Add src/proc.zig with run and spawnDetached wrappers, focused subprocess tests, and the lowercase proc.Term representation required by the Zig 0.16 migration.
  • Register proc.zig in the test registry and route URL opening, config-editor launch, PR listing, diff execution, and shell terminfo compilation through it.
  • Mark completed items under Steps 4 and 5 in the migration plan.

Context

This is the third prep commit sequence for the migration. The wrappers intentionally retain std.time and std.Thread.sleep internals until the later Zig 0.16 std.Io conversion. No behavior change is intended.

The subprocess wrapper intentionally sets stdin_behavior = .Ignore, matching the behavior hardcoded by Zig 0.16 std.process.run; neither gh pr list nor git diff reads stdin.

Test plan

  • zig build — passed with directly installed Zig 0.15.2.
  • zig build test — passed unpiped with directly installed Zig 0.15.2.
  • just lint — passed, including test registry validation.
  • zig fmt src/ and git diff --check — passed.
  • Timestamp/sleep inventory checks — no old call sites remain outside src/clock.zig.
  • Subprocess inventory checks — no std.process.Child call sites remain outside src/proc.zig, and no uppercase term tags remain at callers.
  • Nix is unavailable in this Linux sandbox, so the equivalent directly installed Zig/just commands were used; CI with the project Nix environment is authoritative for that environment.
  • The plan Step 11 manual/macOS-only verification was not performed: layout animation smoothness, ISO-8601 log output/rotation, and quit shimmer timing require a human on a supported graphical/macOS environment (or suitable CI coverage). These are explicitly left for follow-up verification and are not claimed here.
  • Step 5 Step 14 manual verification was not performed in this Linux sandbox: run zig build run in a repository with open pull requests and confirm ⌘P populates the PR dropdown; open the diff overlay and confirm the diff renders; click a terminal URL and confirm it opens in the browser; trigger open config and confirm the editor launches; and remove gh from PATH to confirm the PR dropdown shows its missing-gh state.

Zig 0.16 removes std.time's timestamp functions and std.Thread.sleep in
favor of std.Io clock operations that require an io context. Centralizing
the 27 sites now keeps that change out of every caller.
run() ignores stdin because 0.16's std.process.run hardcodes that; landing
it now means the change is tested under the current toolchain.
Zig 0.16 removes Child.init, spawn, spawnAndWait, and collectOutput,
replacing them with std.process.spawn/run, which need an io context.
proc.Term uses 0.16's lowercase tag names so caller switches are final.
@forketyfork
forketyfork merged commit 915c152 into main Sep 1, 2026
4 checks passed
@forketyfork
forketyfork deleted the prep/clock-accessor branch September 1, 2026 06:10
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