Skip to content

feat(coven): page one automation's run history - #333

Merged
BunsDev merged 1 commit into
mainfrom
feat/coven-run-history
Sep 28, 2026
Merged

BunsDev merged 1 commit into
mainfrom
feat/coven-run-history

Conversation

@BunsDev

@BunsDev BunsDev commented Sep 28, 2026

Copy link
Copy Markdown
Member

Part of #80. This is the SDK consumer of the producer's new run.history.v1 (OpenCoven/coven#1160, part of coven#1054).

What

  • automations.runHistory(automationId, { limit?, cursor?, occurrenceId? }) over the capability-gated coven.automations.run.history.v1.
    • Returns an sdk-core Page: { automationId, occurrenceId?, data, cursor }.
    • Runs come newest first by start instant then id, each with attempts and any cancellation, validated exactly like runs().
  • automations.iterateRunHistory(automationId, BoundedPageOptions, { occurrenceId? }), built on iteratePages.
  • Allowlist: the transport now allows ten actions. The request is exactly { action, automationId, limit, occurrenceId?, cursor? }, with trimmed ids of at most 4096 bytes, well-formed Unicode, and a canonical cursor of at most 256 characters (the spec bound).
  • Refused pages:
    • another automation;
    • an unrequested or missing occurrenceId echo, or a run of another occurrence;
    • broken newest-first instant order (compared by bytes, with millisecond and nanosecond start times normalized as the producer does);
    • hasMore or next inconsistencies, or no current echo.
  • Byte cap: responses share the 256 KiB history cap on both Unix and Windows transports.
  • Refactor: the cursor check, instant-order check, page-cursor validation and byte cap move into a shared automations-history.ts, used by both history reads. Occurrence history's behavior is unchanged, and its page cursor type is now the named, structurally identical CovenAutomationHistoryCursor.
  • README, API baseline and a minor Changeset are included.

Verification

  • pnpm verify passed: 3054 tests, contracts, package, coverage, stress and lint.
  • Mutation checks: disabling the occurrence-match check or the ordering check fails the matching tests.
  • Platform parity: a history page over 16 KiB reads on Unix and Windows, and Content-Length: 262145 yields body_limit.

🤖 Generated with Claude Code

Add automations.runHistory(automationId, { limit, cursor, occurrenceId })
over coven.automations.run.history.v1 as an sdk-core Page, and
iterateRunHistory() on iteratePages. Cursors are validated to the spec's
256-character bound before transport I/O; pages that cross automations or
occurrences, break newest-first instant order, or misreport the cursor are
refused. The cursor, instant-order and byte-cap helpers move to a shared
automations-history module used by both history reads.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 28, 2026 08:59
@BunsDev
BunsDev merged commit 4c0294f into main Sep 28, 2026
9 checks passed
@BunsDev
BunsDev deleted the feat/coven-run-history branch September 28, 2026 09:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Address the trimmed-ID byte validation and malformed iterator-filter validation issues.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds capability-gated, paginated automation run-history APIs with occurrence filtering, shared validation, transport limits, tests, and documentation.

Changes:

  • Adds runHistory() and iterateRunHistory().
  • Shares cursor, ordering, and response-size validation.
  • Updates transports, types, tests, README, API baseline, and changeset.
File Summary
tests/​coven-automations.spec.ts Run-history behavior and validation tests
tests/​coven-automations-platforms.spec.ts Unix/Windows size-cap tests
packages/​coven/​src/​index.ts Public type exports
packages/​coven/​src/​automations.ts Client history APIs
packages/​coven/​src/​automations-socket.ts History response limits
packages/​coven/​src/​automations-runs.ts Run-history types and decoding
packages/​coven/​src/​automations-occurrences.ts Shared validation integration
packages/​coven/​src/​automations-history.ts Shared history validation
packages/​coven/​src/​automations-definitions.ts Request and response handling
packages/​coven/​README.md Consumer documentation
api-baselines/​coven.d.ts Public API baseline
.changeset/​coven-run-history.md Release notes

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +182 to +183
const identifier = (value: unknown): value is string => typeof value === 'string' &&
value.trim().length > 0 && Buffer.byteLength(value) <= 4_096 && value.isWellFormed();
BunsDev added a commit that referenced this pull request Oct 3, 2026
The README still called the lock the unchanged historical pin that does
not certify coven#991/#999; it now names the v0.4.7 release producer,
whose contract includes them. The roadmap records the rebinding and
corrects two statements this program has since overtaken: individual
run lookup and per-automation history landed in SDK #330, #331 and
#333, and Coven persists rich definitions (coven#1185) that SDK #336
sends.

Refs #80

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
BunsDev added a commit that referenced this pull request Oct 3, 2026
…ucer (#337)

* test(coven): pin the Automations v1 canary to the v0.4.7 release producer

The exact-artifact canary was still bound to Coven 8a796807, a
pre-release CI artifact with the 17-file contract (content 3c145eb9),
while every release since v0.4.4 ships content ef266d16 (19 files).
Coven's release runbook requires the SDK canary to consume the released
archive and its recorded SHA-256.

The lock, the exact-runtime CI reproduction and the pinned test values
now name the producer of the released v0.4.7 bundle: source c93a8a93,
CI run 37077748408 job 111071346442, artifact 11257472104, bundle
fcb084bd (byte-identical to the GitHub release asset and to a local
reproduction from the tag), manifest 976c9b70, content ef266d16. The
canary already supports the 19-file contract, so no SDK source changes.

Refs #80

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs: describe the rebound Automations pin instead of the historical one

The README still called the lock the unchanged historical pin that does
not certify coven#991/#999; it now names the v0.4.7 release producer,
whose contract includes them. The roadmap records the rebinding and
corrects two statements this program has since overtaken: individual
run lookup and per-automation history landed in SDK #330, #331 and
#333, and Coven persists rich definitions (coven#1185) that SDK #336
sends.

Refs #80

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

2 participants