4 Commits
Author SHA1 Message Date
Krasimir Kralev afb198a96b test(commands): cover the where filter command (#121)
Adds characterization tests for src/commands/stdlib/where.ts, which shipped
with no direct coverage. Exercises the real command through parsePipeline +
runPipeline: literal coercion (number/boolean/null), the = to == normalization,
dotted-path resolution with non-object safety, all six comparison operators,
the loose-equality/missing-path quirk, and both throw paths (missing expression,
operator-less expression). No production code changes.
2026-08-13 12:29:32 -07:00
Krasimir KralevandKrasimir Kralev 1679bed1a4 fix(state): write state atomically
Fixes #108 and #109.

- Replace direct state writes with same-directory atomic temp-file writes.
- Preserve existing file modes and create new state files as 0600.
- Clean up temp files on failed replacement paths.
- Add state/SDK regression coverage plus changelog entry.

Proof:
- pnpm run typecheck
- node --test dist/test/state.test.js dist/test/resume.test.js dist/test/multi_approval_resume.test.js dist/test/approve_preview.test.js
- pnpm run lint
- pnpm run test
- built SDK write/read proof preserved 0600 across replacement
- autoreview clean: no accepted/actionable findings

Co-authored-by: Krasimir Kralev <krasi@idrobots.com>
2026-06-03 14:05:28 -07:00
930930a02c fix: retry timed-out workflow steps
* fix(retry): only propagate AbortError on external cancellation, not per-attempt timeout

Fixes #105.

withRetry unconditionally re-threw AbortErrors before calling shouldRetry,
causing timeout_ms + retry.max combinations to always result in a single
attempt regardless of retry configuration. Fix: check options?.signal?.aborted
before short-circuiting — external workflow cancellation still propagates
immediately, but per-attempt timeout AbortErrors now flow through shouldRetry.

* test(retry): update abort-error test to use aborted external signal; add timeout-retry unit test

Update withRetry test to properly simulate external cancellation (aborted
signal) rather than a bare AbortError without signal context.

Add unit test proving per-attempt timeout AbortErrors (no external signal)
are now retried as documented when timeout_ms + retry are combined.

* fix(retry): revert quote style to single-quote (match fork base)

* fix(retry): revert test quote style to single-quote (match fork base)

* test: add workflow-level proof that timeout_ms + retry retries on timeout

Integration test that runs a real step with timeout_ms=1500 + retry.max=3
where the command hangs past the timeout on attempts 1-2 (SIGKILLed) then
succeeds on attempt 3. Asserts status ok + attempt 3 + [RETRY] logs.

Verified the test fails against the pre-fix withRetry (short-circuit on
any AbortError) and passes with the fix. Addresses the review request for
real behavior proof at the workflow level, complementing the existing
withRetry unit tests.

* docs: credit timeout retry fix

* test: harden timeout retry workflow proof

* style: format timeout retry patch

---------

Co-authored-by: KrasimirKralev <krasi@idrobots.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-05-28 16:35:04 +01:00
Krasimir Kralev 042e833e62 fix(validation): memoize Ajv compile cache (#98)
Memoize repeated Ajv schema compilation across validation paths and add regression coverage for structurally equivalent schema cache hits.

Closes #96.

Co-authored-by: Krasimir Kralev <263465593+KrasimirKralev@users.noreply.github.com>
2026-05-22 13:09:07 +01:00