Skip to content

refactor: audit verifier boundary purity + _listWriterIds extraction - #33

Merged
flyingrobots merged 4 commits into
mainfrom
audit-verifier-refactor
Feb 15, 2026
Merged

refactor: audit verifier boundary purity + _listWriterIds extraction#33
flyingrobots merged 4 commits into
mainfrom
audit-verifier-refactor

Conversation

@flyingrobots

@flyingrobots flyingrobots commented Feb 15, 2026

Copy link
Copy Markdown
Member

Summary

  • Extract _listWriterIds() private helper from verifyAll() for reuse
  • Move detectTrustWarning() from src/domain/ to CLI boundary (verify-audit.js), eliminating process.env read in domain layer
  • verifyAll() now accepts trustWarning via options (CLI-injected)
  • Add domain purity boundary test: grep assertion that src/domain/ never references process.env
  • Add trustWarning pass-through tests

No new trust guarantees or claims — just architectural hygiene.

Test plan

  • npx eslint on modified files — clean
  • npx tsc --noEmit — clean
  • 174 test files, 3607 tests all passing
  • Domain purity boundary test enforces no process.env in src/domain/
  • Pre-push hooks pass (lint + typecheck + policy + full unit suite)

Summary by CodeRabbit

  • New Features

    • Added trust configuration warning detection during audit verification; warnings are now captured from environment and included in verification results.
  • Refactor

    • Reorganized verification service logic for improved code organization and separation of concerns.
  • Tests

    • Added test coverage for trust warning behavior and domain boundary integrity.

- Extract _listWriterIds() private helper from verifyAll() for reuse
- Move detectTrustWarning() from src/domain/ to CLI boundary
  (verify-audit.js), eliminating process.env read in domain layer
- verifyAll() now accepts trustWarning via options (CLI-injected)
- Add domain purity boundary test: grep assertion that src/domain/
  never references process.env
- Add trustWarning pass-through tests

Domain services are now genuinely pure — no ambient runtime state.
@coderabbitai

coderabbitai Bot commented Feb 15, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@flyingrobots has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

The changes relocate trust warning detection from the domain service layer to the CLI command layer, improving separation of concerns by removing environment-variable dependencies from the domain. A new private helper extracts writer IDs in the verification workflow.

Changes

Cohort / File(s) Summary
CLI Command
bin/cli/commands/verify-audit.js
Introduces detectTrustWarning() function to extract TRUST configuration from process.env.WARP_TRUSTED_ROOT and pass it to verifyAll() via options.
Domain Service Refactoring
src/domain/services/AuditVerifierService.js
Removes detectTrustWarning() static function; adds private _listWriterIds(graphName) helper; updates verifyAll() to accept trustWarning from options instead of calling environment-aware detection internally.
Service Tests
test/unit/domain/services/AuditVerifierService.test.js
Adds test suite for trustWarning propagation, domain purity boundary check to ensure src/domain/ does not reference process.env.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 The CLI catches secrets from the air,
While domain stays pure, serene and fair,
Writer IDs grouped with private care,
Trust warnings passed with gentle flair,
Boundaries drawn, concerns laid bare!

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (22 files):

⚔️ Dockerfile (content)
⚔️ Dockerfile~HEAD (content)
⚔️ README.md (content)
⚔️ bin/cli/commands/verify-audit.js (content)
⚔️ bin/cli/shared.js (content)
⚔️ docker-compose.yml (content)
⚔️ examples/WALKTHROUGH.md (content)
⚔️ examples/html/event-sourcing.html (content)
⚔️ examples/html/explore.html (content)
⚔️ examples/html/inspect-index.html (content)
⚔️ examples/html/lagrangian-path.html (content)
⚔️ examples/html/multi-writer.html (content)
⚔️ examples/html/setup.html (content)
⚔️ examples/html/streaming-benchmark.html (content)
⚔️ examples/html/traversal-benchmark.html (content)
⚔️ jsr.json (content)
⚔️ package.json (content)
⚔️ src/domain/services/AuditVerifierService.js (content)
⚔️ test/unit/domain/services/AuditVerifierService.test.js (content)
⚔️ test/unit/domain/services/HookInstaller.test.js (content)
⚔️ tsconfig.json (content)
⚔️ tsconfig.src.json (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main refactoring changes: moving _listWriterIds extraction and establishing domain/CLI boundary purity by relocating detectTrustWarning.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch audit-verifier-refactor

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 and usage tips.

@github-actions

Copy link
Copy Markdown

Release Preflight

  • package version: 11.0.0
  • prerelease: false
  • npm dist-tag on release: latest
  • npm pack dry-run: passed
  • jsr publish dry-run: passed

If you tag this commit as v11.0.0, release workflow will publish.

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
bin/cli/commands/verify-audit.js (1)

55-69: ⚠️ Potential issue | 🟡 Minor

Single-writer path suppresses trustWarning.

When --writer is specified (line 55–69), trustWarning is hardcoded to null (line 68), so users won't see the trust configuration warning even if WARP_TRUSTED_ROOT is set. If this is intentional, a brief comment explaining why would help future readers. If not, consider calling detectTrustWarning() here too.

🧹 Nitpick comments (2)
test/unit/domain/services/AuditVerifierService.test.js (1)

787-791: Duplicate of existing test at lines 619–624.

The test 'trustWarning is null when no trust config is present' (line 619) already asserts the same thing — verifyAll without a trustWarning option returns null. Consider removing one of them.

src/domain/services/AuditVerifierService.js (1)

227-234: trustWarning leaks into verifyChain options.

verifyAll passes the full options object (including trustWarning) to verifyChain, which only expects { since?: string }. It's harmless since verifyChain ignores unknown properties, but for type-safety it would be cleaner to destructure:

Proposed fix
   async verifyAll(graphName, options = {}) {
     const writerIds = await this._listWriterIds(graphName);
 
     const chains = [];
     for (const writerId of writerIds.sort()) {
-      const result = await this.verifyChain(graphName, writerId, options);
+      const result = await this.verifyChain(graphName, writerId, { since: options.since });
       chains.push(result);
     }

- Single-writer path now includes trustWarning (was hardcoded null)
- verifyAll passes only { since } to verifyChain, not the full options
- Remove duplicate trustWarning-null test (already covered at line 619)
@github-actions

Copy link
Copy Markdown

Release Preflight

  • package version: 11.0.0
  • prerelease: false
  • npm dist-tag on release: latest
  • npm pack dry-run: passed
  • jsr publish dry-run: passed

If you tag this commit as v11.0.0, release workflow will publish.

1 similar comment
@github-actions

Copy link
Copy Markdown

Release Preflight

  • package version: 11.0.0
  • prerelease: false
  • npm dist-tag on release: latest
  • npm pack dry-run: passed
  • jsr publish dry-run: passed

If you tag this commit as v11.0.0, release workflow will publish.

@flyingrobots
flyingrobots merged commit 96365d9 into main Feb 15, 2026
7 checks passed
@flyingrobots
flyingrobots deleted the audit-verifier-refactor branch February 15, 2026 15:40
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.

1 participant