Closed
Conversation
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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>
- 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>
66628d4 to
a63b4cc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lib/types/run.ts—RunDatatype (alias forTaskData) for pod/run taskslib/resources/run.ts—RunandRunsclasses mirroring theTask/Taskspattern;Runs.list()automatically filters bypod/runstub typetests/runs.test.ts— 14 unit tests coveringRunconstruction,cancel,refresh, andRuns._constructResource,object,list, andcancellib/index.tsto exportRun,Runs, and run typesTest plan
tests/runs.test.tspass (npx jest tests/runs.test.ts)Runs.list()filters correctly against a live workspaceRuns.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.
Written for commit a63b4cc. Summary will update on new commits.