Skip to content

feat(interpreter): real $SECONDS and /proc/sys/kernel/random/uuid - #2543

Merged
chaliy merged 1 commit into
mainfrom
claude/fidelity-proc-seconds
Oct 7, 2026
Merged

chaliy merged 1 commit into
mainfrom
claude/fidelity-proc-seconds

Conversation

@chaliy

@chaliy chaliy commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Requested by Михайло · project thread

What changed

  • $SECONDS now counts whole seconds since the Bash instance was built. It used to always be 0. SECONDS=N restarts the count from N, and an assignment inside a subshell does not leak to the parent, as in bash.
  • The default rootfs serves /proc/sys/kernel/random/uuid, which returns a fresh v4 UUID on every read. It uses the OS CSPRNG, the same source as uuidgen, so scripts that read it as on Linux work.

Why

These are small fidelity gaps from the roadmap. Scripts time phases with $SECONDS (start=$SECONDS; ...; echo $((SECONDS-start))s). Containers and CI scripts read /proc/sys/kernel/random/uuid for IDs.

Before / After

$ bashkit -c 's=$SECONDS; sleep 1.1; echo $((SECONDS-s)); cat /proc/sys/kernel/random/uuid'

Before: 0 and cat: /proc/sys/kernel/random/uuid: No such file or directory
After: 1 and a v4 UUID (e.g. 3f6c...-4...-[89ab]...). This is the same as GNU bash on Linux.

The spec cases var_seconds, var_seconds_assign and rootfs_proc_random_uuid carry no bash_diff, so they run against real bash in CI.

Risk

  • Low. $SECONDS is now time-dependent, so a test that expected 0 could see 1 on a slow run. The old spec case only checked that it was set.
  • The snapshot differential test's filesystem listing now prunes /proc/sys/kernel/random, like it already prunes /dev.

Checklist

  • Tests added or updated
  • Backward compatibility considered

https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA


Generated by Claude Code

@chaliy chaliy self-assigned this Oct 7, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 53a26b0 Commit Preview URL

Branch Preview URL
Oct 07 2026, 07:11 AM

@chaliy
chaliy force-pushed the claude/fidelity-proc-seconds branch from afc2f17 to 9340c9b Compare October 7, 2026 06:02
$SECONDS counts whole seconds since the Bash instance was built and
SECONDS=N restarts the count; subshells keep their own. The rootfs serves
a fresh v4 UUID on every read of /proc/sys/kernel/random/uuid.

Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
@chaliy
chaliy force-pushed the claude/fidelity-proc-seconds branch from 9340c9b to 53a26b0 Compare October 7, 2026 07:10
@chaliy
chaliy merged commit 68d51e8 into main Oct 7, 2026
47 checks passed
@chaliy
chaliy deleted the claude/fidelity-proc-seconds branch October 7, 2026 07:43
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