Repository navigation
Harden lock takeover, killGroup and JSON extraction - #1
Merged
Merged
Conversation
Audit pass over every module.
- build: add unrun so tsdown can load its TypeScript config on Node
versions without native type stripping.
- json: lastJsonObject retries from an earlier `}` when a stray one in
later prose ends no object, and a guard that rejects the last object
now falls back to an earlier one. The total try cap is unchanged.
- proc: killGroup sends SIGTERM to every detached descendant group, not
only the target, and waits the grace period for all of them before
SIGKILL. isAlive rejects 0, negative and non-integer pids, which
kill(2) reads as process groups. cwdOf reads /proc on Linux. The
spawnGroup options are optional.
- lock: a stale lock is renamed aside and checked by inode and pid
before removal, so two runs clearing the same stale lock cannot both
take it.
- ansi: strip short escapes such as ESC ( B, ESC 7 and ESC =, and never
treat `[` or `{` as an escape's final byte.
- watchdog: default to a monotonic clock.
- Require Node 22 and test on Node 22 and 24.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Audit pass over every module.
unrunso tsdown can loadtsdown.config.tson Node versions without native type stripping.pnpm buildfailed on Node 22.13.lastJsonObjectretries from an earlier}when a stray one in later prose ends no object, and a guard that rejects the last object now falls back to an earlier one. The total try cap is unchanged, and hostile input still finishes in under a second.killGroupsends SIGTERM to every detached descendant group and waits the grace period for all of them before SIGKILL; before this, they only got SIGKILL.isAliverejects 0, negative and non-integer pids.cwdOfreads/procon Linux. ThespawnGroupoptions are optional.ESC ( B(fromtput sgr0),ESC 7/ESC 8andESC =/ESC >, and never treat[or{as an escape's final byte, so the JSON after a truncated escape stays intact.performance.now(). An NTP step no longer fires it, and time the machine spends asleep does not count as a stall.Behaviour changes
lastJsonObject(text, guard)can now return an earlier object when the guard rejects the last one.Test plan
pnpm typecheck,pnpm lint,pnpm test(70 tests) andpnpm buildwith publint pass locally on macOSproc.ts