Skip to content

test(agent): add unit tests for copyDagSchedulePlan (#500) - #516

Open
aryankalantri wants to merge 1 commit into
dmae97:mainfrom
aryankalantri:test/500-dag-plan-copy-tests
Open

aryankalantri wants to merge 1 commit into
dmae97:mainfrom
aryankalantri:test/500-dag-plan-copy-tests

Conversation

@aryankalantri

Copy link
Copy Markdown
Contributor

Fixes #500.

Adds packages/agent/test/tool-dag-plan-copy.test.ts (vitest, same style as the other tool-dag-*.test.ts files). No source files changed.

Cases pinned, all built by hand from the issue:

  • the copy is toEqual to the original and keeps the same planKey (new array/object identities)
  • pushing into copy.levels[0] does not change plan.levels[0]
  • changing copy.entries[1].resolution.claims[0].key does not change the original claim
  • changing a claim in copy.entries[0].canonicalClaims does not change the original
  • an exclusive resolution stays exactly { kind: "exclusive" }
  • copyDagClaimEntries([]) returns []

Tests run:

  • node ../../node_modules/vitest/dist/cli.js --run test/tool-dag-plan-copy.test.ts from packages/agent: 6 passed, 6 total
  • biome check on the new file: clean (one formatting fix applied)
  • tsgo --noEmit for the agent package: clean

Full npm run check from the repo root was not run locally; CI is arbiter for it.

dmae97 commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

One fixture change before merge: the production scheduler gives an exclusive entry canonicalClaims: [] (scheduler, #500 context). On 8d26f5f, the canonical-claims test fills and mutates those claims on the exclusive entry at index 0. Please keep that array empty (and assert it stays empty in the copy), and move the canonical-claim mutation and original-value assertion to the claims entry at index 1. No runtime change needed. The checked CI run is green for the current synthetic fixture; the requested change makes the test cover the scheduler's actual plan shape.

Please also use valid levels for this two-entry fixture, e.g. [[0], [1]], and adjust the level-copy assertions. [[0, 1], [2]] puts another entry in an exclusive level and references a missing index; the scheduler emits exclusive entries alone.

This branch has not been deployed

No deployments
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.

test: add unit tests for copyDagSchedulePlan / copyDagClaimEntries in agent/src/tool-dag-plan-copy.ts

2 participants