Skip to content

test(shared): cover DependencyGraph and FileSystemCriteriaProvider - #1571

Open
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
microsoft:mainfrom
1aifanatic:tests/369-criteria-graph-tests
Open

Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
microsoft:mainfrom
1aifanatic:tests/369-criteria-graph-tests

Conversation

@1aifanatic

Copy link
Copy Markdown

Fixes #369.

DependencyGraph orders criteria and prompt-feature evaluation, and FileSystemCriteriaProvider loads criteria for local and dev runs. Neither had unit tests.

  • graph/dependency-graph.test.ts (15 tests): empty graph; duplicate, unknown-dependency, self-cycle, multi-node-cycle and disconnected-cycle detection; ancestor/descendant traversal over a diamond; parents-before-children topological order; getRootFailures for both criterionId/passed and featureId/detected results; and the deprecated aliases.
  • criteria/criteria-provider-fs.test.ts (13 tests): missing directory; .yaml/.yml filtering; trimming and depends_on/dependsOn/gates normalization; validation errors for missing id/prompt, non-array dependencies or gates, and non-object YAML; duplicate ids across files; and resolveWithAncestors diamond deduplication plus unknown-id messages. Each test uses a fresh temp directory that is removed afterwards.

The normalizeCriteria helper named in the issue no longer exists on main, so it isn't covered. This is a test-only change with no production code touched.

Validation: pnpm exec vitest run packages/shared/src/graph/dependency-graph.test.ts packages/shared/src/criteria/criteria-provider-fs.test.ts (28 passed); pnpm --filter shared exec tsc --noEmit.

🤖 Generated with Claude Code

Both modules drive criteria evaluation order and loading but had no unit
tests. Adds coverage for cycle and unknown-dependency detection,
topological order, ancestor/descendant traversal, root-failure filtering
for criteria and prompt-feature results, YAML loading and validation,
and ancestor resolution over a diamond DAG.

Fixes microsoft#369.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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 Improver] test(shared): add unit tests for DependencyGraph, normalizeCriteria, FileSystemCriteriaProvider

1 participant