Skip to content

test(#19): unit tests for pure logic (config merge/validate, manifest diff, disk math, VRage signing) - #59

Merged
Cadacious merged 2 commits into
mainfrom
test/19-pure-logic-units
Jun 25, 2026
Merged

Cadacious merged 2 commits into
mainfrom
test/19-pure-logic-units

Conversation

@Cadacious

Copy link
Copy Markdown
Contributor

Implements #19 — unit tests for pure/deterministic logic. 91 new tests; full suite 900 → 988; build.ps1 BUILD OK.

Coverage before → after

Area Before After
ConfigManager (Test-SEBConfig + Merge-ConfigOverrides) 36% 88%
VRageAPI (auth-header signing) 38% 89%
ManifestManager (New-SEBManifest + Compare-SEBManifest diff) 0% 69%
MetricsCollector (Get-SEBDiskSpace) 0% 48%

What's tested (pure in/out where possible; only true boundaries mocked)

  • ConfigManager: deep merge semantics (deeper key wins, siblings survive, array/null/empty handling, non-destructive) + a 43-case validation matrix (bad types, out-of-range ports/percentages, missing required keys at global/node/instance).
  • ManifestManager: the incremental diff (unchanged/modified-by-hash/added/deleted, empty-previous, identical, missing files) + full/incremental metadata (chain_id continuity, seq, parent_manifest from _source_filename).
  • MetricsCollector: free-space math, -1 sentinels, node-failure isolation (mocked remote query).
  • VRageAPI: auth-header assembly with an independently re-derived known-answer HMAC, resource-bound signature, nonce/date wiring, graceful $null on bad key / HTTP failure.

The live-Torch field-order verification is left as a -Tag 'Integration' -Skip placeholder (issue #29) — no live calls attempted; that lands with the Torch harness.

Closes #19.

🤖 Generated with Claude Code

…space math, VRage signing

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Cadacious
Cadacious requested a review from Copilot June 25, 2026 21:16
@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@Cadacious, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 58 minutes and 32 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7f0e00bc-ccbd-440b-a0ae-7591d9e05409

📥 Commits

Reviewing files that changed from the base of the PR and between f0a71d1 and 689499f.

📒 Files selected for processing (9)
  • Tests/ConfigManager/Merge-ConfigOverrides.Tests.ps1
  • Tests/ConfigManager/Test-SEBConfig.Validation.Tests.ps1
  • Tests/ManifestManager/Compare-SEBManifest.Tests.ps1
  • Tests/ManifestManager/New-SEBManifest.Tests.ps1
  • Tests/ManifestManager/_ManifestTestHelpers.ps1
  • Tests/MetricsCollector/Get-SEBDiskSpace.Tests.ps1
  • Tests/MetricsCollector/Get-SEBHealthSummary.Tests.ps1
  • Tests/MetricsCollector/Get-SEBTrendIndicator.Tests.ps1
  • Tests/VRageAPI/Invoke-SEBVRageRequest.Signing.Tests.ps1
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/19-pure-logic-units

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds Pester unit coverage for several deterministic/pure-logic components in SEBackup (config validation + deep-merge semantics, manifest build/diff logic, disk-space accounting, and VRage request signing/wiring) while keeping network/remoting boundaries mocked.

Changes:

  • Adds request-signing and request-wiring unit tests for Invoke-SEBVRageRequest (with HTTP mocked) and additional deterministic checks for New-SEBVRageAuthHeaders.
  • Adds unit tests for Get-SEBDiskSpace covering sentinel -1 behavior, local-drive math, and remote-query failure isolation (remote mocked).
  • Adds unit tests for manifest build/diff (New-SEBManifest, Compare-SEBManifest) and config merge/validation (Merge-ConfigOverrides, Test-SEBConfig).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Tests/VRageAPI/Invoke-SEBVRageRequest.Signing.Tests.ps1 Auth-header/signature binding and HTTP wiring tests for VRage request path normalization + failure behavior (mocked).
Tests/MetricsCollector/Get-SEBDiskSpace.Tests.ps1 Disk free/total accounting tests, including -1 sentinel handling and remote-failure isolation (remote mocked).
Tests/ManifestManager/New-SEBManifest.Tests.ps1 Manifest metadata + deleted-file detection tests with the remote scan mocked.
Tests/ManifestManager/Compare-SEBManifest.Tests.ps1 Pure diff classification/counting tests for current vs previous manifests.
Tests/ConfigManager/Test-SEBConfig.Validation.Tests.ps1 Global/node/instance validation matrix coverage for types/ranges/missing keys and clean file-not-found handling.
Tests/ConfigManager/Merge-ConfigOverrides.Tests.ps1 Deep-merge semantics tests (recursive merge, type mismatches, null/array behavior, non-destructive inputs).

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

Comment on lines +3 to +8
# Issue #19 -- unit coverage for the request-signing / auth-header ASSEMBLY in Invoke-SEBVRageRequest.
# New-SEBVRageAuthHeaders.Tests.ps1 already pins the HMAC math (Base64-decoded key, canonical
# message, pinned known-answer signature, URI binding). This file pins how the CALLER wires that
# signature into an HTTP request, with the network boundary (Invoke-RestMethod) mocked so no live
# Torch server is touched:
# * the endpoint is normalized to the canonical '/vrageremote/v1/...' path WITHOUT double-prefixing;
…ill vacuous [long]/port assertions; share New-FileEntry (review)

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment on lines +3 to +7
# Issue #19 -- edge-case validation coverage for Test-SEBConfig beyond the Issue #14 instance-schema
# tests in Get-SEBInstanceConfig.Tests.ps1. Those pin the instance contract; this file pins the
# GLOBAL and NODE validators and a handful of cross-cutting type/range checks:
# * missing required sections/keys at each level produce ERRORS (IsValid = $false);
# * wrong scalar TYPES (string where int expected, etc.) produce ERRORS;
@Cadacious

Copy link
Copy Markdown
Contributor Author

Note on #19 acceptance: New-SEBDiscordEmbed is covered in the companion PR #60 (NotificationManager suite, via InModuleScope). #19's named functions were split across this PR (ConfigManager / ManifestManager / MetricsCollector incl. Get-SEBTrendIndicator + Get-SEBHealthSummary / VRageAPI) and #60 (embed). Together #59 + #60 satisfy #19's acceptance; not duplicating the embed suite here.

@Cadacious
Cadacious merged commit 0e26f9c into main Jun 25, 2026
3 checks passed
@Cadacious
Cadacious deleted the test/19-pure-logic-units branch June 25, 2026 22:18
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.

Unit tests for pure logic (trend, embed, config merge/validate, manifest diff)

2 participants