Skip to content

[Test Improver] test(shared): add unit tests for DependencyGraph, normalizeCriteria, FileSystemCriteriaProvider #367

Closed

Description

Original author: @github-actions[bot]

🤖 Test Improver — automated AI assistant for test improvements.

Goal and rationale

Three core modules in packages/shared had no tests despite containing meaningful logic:

  • DependencyGraph — cycle detection, topological sort, BFS ancestor/descendant traversal, and root-failure filtering are complex enough to regress silently
  • normalizeCriteria — v1/v2 format dispatch and whitespace trimming; part of the evaluation pipeline
  • FileSystemCriteriaProvider — YAML file loading, field validation, depends_on/dependsOn normalisation, and transitive ancestor resolution via BFS

Approach

File Tests Strategy
graph/dependency-graph.test.ts 32 Pure unit; covers construction, cycles, topological sort, ancestor/descendant BFS, getRootFailures (both result formats), deprecated aliases
criteria/normalize-criteria.test.ts 6 Pure unit; v1 string array, v2 passthrough, trimming, sequential IDs
criteria/criteria-provider-fs.test.ts 18 Creates/destroys temp dirs per test; covers file loading, YAML variants (.yaml/.yml), snake/camelCase dependsOn, duplicate IDs, missing fields, resolveWithAncestors with diamond deduplication

Coverage impact

Metric Before After
Test files 59 62
Tests 678 734
New tests — +56

Test status

Test Files  62 passed (62)
     Tests  734 passed (734)

(2 pre-existing process.exit errors in apps/version-checkers/ are unrelated to these changes.)

Reproducibility

export PATH="$HOME/bin:$PATH"
pnpm --filter shared --filter github-auth build
pnpm test

Trade-offs

  • FileSystemCriteriaProvider tests use mkdtempSync + afterEach cleanup — reliable and fast
  • No mocking of fs module; tests exercise real I/O with temp dirs for higher fidelity

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/shared-unit-tests-d4ca7787f95db69e.

Click here to create the pull request

To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests.

Show patch preview (500 of 503 lines)
From 5032b02f52d3f7a6159f907219d44fe75a7de600 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Sun, 22 Mar 2026 06:36:24 +0000
Subject: [PATCH] test(shared): add unit tests for DependencyGraph,
 normalizeCriteria, FileSystemCriteriaProvider
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- DependencyGraph (32 tests): construction, cycle detection (direct/indirect/self-loop),
  topological sort, ancestor/descendant BFS, getRootFailures with both
  criterionId/passed and featureId/detected formats, deprecated aliases
- normalizeCriteria (6 tests): v1 string→CriteriaConfig conversion, v2 passthrough,
  whitespace trimming, sequential id generation
- FileSystemCriteriaProvider (18 tests): YAML loading (yaml/yml), depends_on/dependsOn
  normalisation, duplicate id detection, missing field validation, resolveWithAncestors
  with transitive parents and diamond deduplication

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 .../src/criteria/criteria-provider-fs.test.ts | 168 ++++++++++++
 .../src/criteria/normalize-criteria.test.ts   |  40 +++
 .../shared/src/graph/dependency-graph.test.ts | 245 ++++++++++++++++++
 3 files changed, 453 insertions(+)
 create mode 100644 packages/shared/src/criteria/criteria-provider-fs.test.ts
 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/criteria-provider-fs.test.ts b/packages/shared/src/criteria/criteria-provider-fs.test.ts
new file mode 100644
index 0000000..e78672a
--- /dev/null
+++ b/packages/shared/src/criteria/criteria-provider-fs.test.ts
@@ -0,0 +1,168 @@
+import { describe, it, expect, afterEach } from 'vitest';
+import { mkdtempSync, writeFileSync, mkdirSync, rmSync } from 'fs';
+import { join } from 'path';
+import { tmpdir } from 'os';
+import { FileSystemCriteriaPr
... (truncated)

Activity

  1. cedricvidal commented on Jul 29, 2026

    @cedricvidal
    CollaboratorAuthor

    Original author: Cedric Vidal (@cedricvidal)

    Closing as not planned — superseded / obsolete.

    Superseded by: #369

    Why: 4th of 5 identical bot Test-Improver requests; superseded by newest #369

    Evidence: #369

    Triaged during a stale-issue review. Please reopen if it's still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentic-workflowsgh aw driven workflows that automate repository tasks. DOT NOT RENAME.topic: testingTest coverage, test infrastructure, and validation quality.type: automationChanges that automate recurring tasks or workflows.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions