fix(kyberforge): bound the SessionStart hook portably and sharpen its notices
Review round 1 of #270. - Resolve `timeout`, else `gtimeout`, once after choosing apm, and call it through "$to" at all three sites. Stock macOS has neither `timeout` nor a GNU coreutils default, so the `--version` call failed there and every session printed a false too-old notice. With neither binary the hook exits 0 silently. The budget test now parses `"$to" N` too. - Check that the project environment ($UV_PROJECT_ENVIRONMENT, else <root>/.venv) exists before taking the uv path. If it is missing, print a fixed not-synced notice and never call uv, because `uv run --no-sync` would create an empty .venv in the consumer repo. - Separate "version too old" from "version unreadable or timed out", with a fixed literal for each on each path, so a timeout no longer blames an unsynced environment. - Raise the hooks.json timeout from 380 to 400 for the 375s script budget, refresh the outdated-timing comment, and note the budget in ADR-0019. - Tests: no timeout binary, gtimeout only, missing and relocated project environment, a failing `uv run`, `--offline` required on every uv call, and the hostile-output notice compared to its exact literal. - ADR-0034: until the #271 cutover, this repo prints the too-old notice and auto-refresh is paused. Refs: #270 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
1 parent
1fb8cc797b
commit
367cc1c259
6 files changed
+169
-40
No files matched your search
@@ -140,6 +140,11 @@ was below the 360 s the script can legitimately take. A test asserts the invaria
|
||||
literal — it parses every `timeout N` out of the script, sums them, and requires the `hooks.json`
|
||||
value to be larger — so changing either side without the other fails the suite.
|
||||
|
||||
> **Amendment (2026-12-02, holocron#270) — the budget is now 375 s and the host timeout 400 s.** The
|
||||
> hook also reads `apm --version` under a 15 s bound before the outdated check (ADR-0034), and calls
|
||||
> `timeout` or `gtimeout` through a variable, which the budget test parses too. The current numbers
|
||||
> and their breakdown live in `plugins/kyberforge/docs/hooks.md`.
|
||||
|
||||
> **Amendment (2026-09-16) — the refresh is slower than first measured, still inside the budget.**
|
||||
> Re-measured: ~24–26 s for the same six-behind refresh, warm, on a LAN remote — well inside the
|
||||
> 380 s above.
|
||||
|
||||
@@ -43,6 +43,9 @@ Issue #265. apm is installed once per machine with pipx, at 0.28.0, and every re
|
||||
scripts and their tests) follows as one PR. The order matters because the deployed hook comes from
|
||||
the `main` commit that `apm.lock.yaml` records. If the v4 lock landed first, the old hook would run
|
||||
`PATH` apm 0.28.0, which refuses the lock, and staleness detection would be lost with no error.
|
||||
The cost of this order: between the hook landing and the cutover, this repo has no pin, so the hook
|
||||
runs `PATH` apm 0.28.0 and prints the fixed too-old notice at every session start. Auto-refresh
|
||||
is paused here until the #271 cutover adds the pin.
|
||||
- **The cutover PR commits a lock rewrite (v1 to v4) on purpose.** It is the one sanctioned exception
|
||||
to the rule that `apm.lock.yaml` churn is discarded on feature branches (ADR-0019).
|
||||
- **Consumer hook contract.** The shipped hook (`check-apm-current.sh`) resolves apm in this order:
|
||||
|
||||
Reference in new issue
Block a user