Skip to content

Add Runs resource and runs.test.ts#43

Closed
luke-lombardi wants to merge 1 commit intomainfrom
add-runs-resource
Closed

Add Runs resource and runs.test.ts#43
luke-lombardi wants to merge 1 commit intomainfrom
add-runs-resource

Conversation

@luke-lombardi
Copy link
Copy Markdown

@luke-lombardi luke-lombardi commented Mar 4, 2026

Summary

  • Adds lib/types/run.tsRunData type (alias for TaskData) for pod/run tasks
  • Adds lib/resources/run.tsRun and Runs classes mirroring the Task/Tasks pattern; Runs.list() automatically filters by pod/run stub type
  • Adds tests/runs.test.ts — 14 unit tests covering Run construction, cancel, refresh, and Runs._constructResource, object, list, and cancel
  • Updates lib/index.ts to export Run, Runs, and run types

Test plan

  • All 14 tests in tests/runs.test.ts pass (npx jest tests/runs.test.ts)
  • Verify Runs.list() filters correctly against a live workspace
  • Verify Runs.cancel() cancels pod/run tasks as expected

🤖 Generated with Claude Code


Summary by cubic

Adds a Runs resource to manage pod/run tasks, mirroring the Task/Tasks pattern. Supports list (auto-filters to pod/run), cancel, and refresh; exports Run, Runs, and RunData, with 14 unit tests.

  • New Features
    • New Run and Runs classes (API object: task).
    • Runs.list auto-filters by pod/run (EStubType.PodRun) and merges caller options.
    • Runs.cancel accepts run IDs or Run instances.
    • Run.refresh pulls the latest data via manager.get.
    • Export Run, Runs, and RunData (alias of TaskData) from lib/index.ts.

Written for commit a63b4cc. Summary will update on new commits.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="lib/resources/run.ts">

<violation number="1" location="lib/resources/run.ts:15">
P2: Runs.list allows opts.stubType to override the intended PodRun filter because the spread comes after stubType. This can return non-run tasks. Spread opts first, then set stubType to enforce the filter.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.


public async list(opts?: any): Promise<Run[]> {
return super.list({
stubType: EStubType.PodRun,
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Mar 4, 2026

Choose a reason for hiding this comment

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

P2: Runs.list allows opts.stubType to override the intended PodRun filter because the spread comes after stubType. This can return non-run tasks. Spread opts first, then set stubType to enforce the filter.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At lib/resources/run.ts, line 15:

<comment>Runs.list allows opts.stubType to override the intended PodRun filter because the spread comes after stubType. This can return non-run tasks. Spread opts first, then set stubType to enforce the filter.</comment>

<file context>
@@ -0,0 +1,53 @@
+
+  public async list(opts?: any): Promise<Run[]> {
+    return super.list({
+      stubType: EStubType.PodRun,
+      ...opts,
+    });
</file context>
Fix with Cubic

- Add lib/types/run.ts: RunData type (alias for TaskData) for pod/run tasks
- Add lib/resources/run.ts: Run and Runs classes mirroring Task/Tasks pattern; Runs.list() auto-filters by pod/run stub type
- Add tests/runs.test.ts: 14 unit tests covering Run construction, cancel, refresh, and Runs._constructResource, object, list, and cancel
- Update lib/index.ts to export Run, Runs, and run types

Co-Authored-By: Claude Sonnet 4.6 <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