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();
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