Skip to content

test: raise coverage from 0% to 99.24% (target 80%)#71

Merged
kayodebristol merged 2 commits intomainfrom
copilot/adr-0009-increase-test-coverage-again
Mar 27, 2026
Merged

test: raise coverage from 0% to 99.24% (target 80%)#71
kayodebristol merged 2 commits intomainfrom
copilot/adr-0009-increase-test-coverage-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

The praxis health system flagged test-coverage at 0% — enforcement infrastructure (vitest thresholds, deno task test → npm run test:coverage) was already wired, but several meaningful code paths had no tests.

New tests

tests/chronicle.test.js

  • Persistent writer forwarding — exercises if (writer) writeBatch(...) in _flush()
  • Idempotent start() — verifies double-subscribe guard
  • maxDepth cutoff in trace() — triggers the depth > maxDepth early-exit branch

tests/persistent.test.js

  • queryEdges with a mixed (node + edge) store — hits the _type !== chronicle_edge guard
  • stats() on a mixed store — exercises the edge-counting else if branch
  • trace() with two edges sharing the same to node — covers the "key already exists" path in the backward edge index

tests/praxis.test.js

  • Direct impl({}, []) calls for every rule that has an unreachable skip guard: the Praxis engine's eventTypes filter silently skips impl when no matching event is present, so the if (!event) return RuleResult.skip(...) lines inside each rule body were dead to the engine.
    Affected rules: burstDetectionRule, criticalSpikeRule, impactAnomalyRule, agePruningRule, quotaEnforcementRule, archivalGateRule, scoreImpactRule, gapDetectionRule, replayValidationRule
  • Replay validation with nodes that carry no diff property — covers the if (node.diff && node.diff.after !== undefined) branch

Coverage delta

Metric Before After
Statements 97.59% 99.24%
Branches 92.51% 95.00%
Lines 99.85% 100%
Tests 257 273

alerting.js, retention-policy.js → 100%; chronicle.js → 100% statements.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.deno.land
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

@github-actions github-actions bot marked this pull request as ready for review March 27, 2026 00:18
Copilot AI review requested due to automatic review settings March 27, 2026 00:18
Copilot AI review requested due to automatic review settings March 27, 2026 00:18
@kayodebristol kayodebristol requested a review from Copilot March 27, 2026 00:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI changed the title [WIP] Add tests to increase coverage from 0% to 80% test: raise coverage from 0% to 99.24% (target 80%) Mar 27, 2026
Copilot AI requested a review from kayodebristol March 27, 2026 01:26
Copy link
Copy Markdown
Contributor

@kayodebristol kayodebristol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: CI green + Copilot code review complete.

@kayodebristol kayodebristol merged commit 282a324 into main Mar 27, 2026
3 checks passed
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.

3 participants