Repository navigation
Description
Original author: @github-actions[bot]
π€ Test Improver β automated AI assistant.
Goal and Rationale
Adds 40 unit tests covering two untested modules in packages/shared:
DependencyGraphβ the generic DAG used by both the criteria evaluation and prompt-feature systems. It contains non-trivial algorithmic logic (cycle detection, topological sort, transitive closure) that is core to correct run evaluation order and root-failure attribution.normalizeCriteriaβ the v1βv2 migration helper that converts legacy string arrays toCriteriaConfig[]. Small function, but part of the critical criteria loading pipeline and easy to mis-handle edge cases (whitespace, empty input).
Approach
normalize-criteria.test.ts (9 tests)
- Empty array input
- v1 string array β sequential IDs (
criterion-1,criterion-2, β¦) - Whitespace trimming on string prompts
dependsOninitialized to[]- v2
CriteriaConfig[]passthrough (identity, no copy) - Custom IDs and dependency relationships preserved in v2 format
dependency-graph.test.ts (31 tests)
- Construction: empty graph, single nodes, chained deps, diamond DAG
- Error cases: duplicate ID, unknown dependency reference, direct cycle, longer cycle
topologicalSort: single node, linear chain, diamond; parents always before childrengetAncestors: leaf, direct parent, transitive chain, diamondgetDescendants: root, direct child, transitive chaingetRootFailureswithCriterionResultformat (criterionId/passed)getRootFailureswithPromptFeatureResultformat (featureId/detected)getNode/getAllNodeslookups
Coverage Impact
| Metric | Before | After |
|---|---|---|
| Test files | 59 | 61 |
| Tests | 676 | 716 |
| New tests | β | +40 |
Trade-offs
Tests are pure unit tests with no external dependencies (no mocks, no DB). They cover the algorithmic core, not the MongoDB integration layer (that's a separate, harder-to-test concern).
Reproducibility
npm install -g pnpm --prefix $HOME
export PATH="$HOME/bin:$PATH"
pnpm install --frozen-lockfile
pnpm --filter shared --filter github-auth build
pnpm testTest Status
β All 716 tests pass (61 test files)
Generated by Daily Test Improver Β· β·
To install this agentic workflow, run
gh aw add githubnext/agentics/workflows/daily-test-improver.md@ee86d0ffcb1705d4ee4146e92125227bf9136aae
Warning
β οΈ Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
169.254.169.254
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "169.254.169.254"See Network Configuration for more information.
Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch test-assist/criteria-and-graph-tests-a09cda6a1104c771.
To fix the permissions issue, go to Settings β Actions β General and enable Allow GitHub Actions to create and approve pull requests.
Show patch preview (377 of 377 lines)
From 07a3c92a74d2f91a0b5836e7f6436623ceee4853 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 20 Mar 2026 06:38:07 +0000
Subject: [PATCH] test: add unit tests for DependencyGraph and
normalizeCriteria
- 31 tests for DependencyGraph covering construction, cycle detection,
topological sort, ancestor/descendant BFS, and getRootFailures with
both CriterionResult and PromptFeatureResult formats
- 9 tests for normalizeCriteria covering empty input, v1 string array
conversion (with ID generation and whitespace trimming), and v2
passthrough
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
.../src/criteria/normalize-criteria.test.ts | 77 +++++
.../shared/src/graph/dependency-graph.test.ts | 263 ++++++++++++++++++
2 files changed, 340 insertions(+)
create mode 100644 packages/shared/src/criteria/normalize-criteria.test.ts
create mode 100644 packages/shared/src/graph/dependency-graph.test.ts
diff --git a/packages/shared/src/criteria/normalize-criteria.test.ts b/packages/shared/src/criteria/normalize-criteria.test.ts
new file mode 100644
index 0000000..2c638de
--- /dev/null
+++ b/packages/shared/src/criteria/normalize-criteria.test.ts
@@ -0,0 +1,77 @@
+import { describe, it, expect } from "vitest";
+import { normalizeCriteria } from "./normalize-criteria.js";
+import type { CriteriaConfig } from "../types/types.js";
+
+describe("normalizeCriteria", () => {
+ it("returns empty array for empty input", () => {
+ expect(normalizeCriteria([])).toEqual([]);
+ });
+
+ describe("v1 format (string[])", () => {
+ it("converts a single string to CriteriaConfig with id 'criterion-1'", () => {
+ const result = normalizeCriteria(["Check code quality"]);
+ expect(result).toEqual([
+ { id: "criterion-1", prompt: "Check code quality", dependsOn: [] },
+ ]);
+ });
+
+ it("converts multiple strings with sequential ids", () => {
+ const result = norma
... (truncated)
Activity
cedricvidal commentedon Jul 29, 2026
Original author: Cedric Vidal (@cedricvidal)
Closing as not planned β superseded / obsolete.
Superseded by: #365, #367, #369
Why: 2nd of 5 identical bot Test-Improver requests; superseded by newer duplicates
Evidence: #365, #367, #369
Triaged during a stale-issue review. Please reopen if it's still relevant.