Skip to content

test(edda-serve): add 21 endpoint tests for coverage gaps (GH-374)#386

Merged
fagemx merged 2 commits intomainfrom
feat/374-serve-endpoint-tests
Mar 27, 2026
Merged

test(edda-serve): add 21 endpoint tests for coverage gaps (GH-374)#386
fagemx merged 2 commits intomainfrom
feat/374-serve-endpoint-tests

Conversation

@fagemx
Copy link
Copy Markdown
Owner

@fagemx fagemx commented Mar 27, 2026

Summary

  • Add 21 new tests covering all previously untested endpoint groups in edda-serve
  • Auth pairing flow: create, complete (full flow), list, revoke, revoke-all (8 tests)
  • Briefs endpoints: empty list, 404, with seeded task_intake data (3 tests)
  • Village stats: happy path with seeded decisions, invalid ISO 8601 param (2 tests)
  • Approval check: inline bundle evaluation, nonexistent bundle 404 (2 tests)
  • Controls patches: empty list, invalid status validation (2 tests)
  • Decisions ISO validation: invalid after param returns 400 (1 test)
  • Log filters: filter by event type, filter by keyword (2 tests)
  • Telemetry source filter: filter by source param (1 test)
  • Total tests: 112 -> 133 (all passing, zero clippy warnings)

Test plan

  • cargo test -p edda-serve — 133 passed
  • cargo clippy -p edda-serve --all-targets — zero warnings
  • cargo fmt -p edda-serve -- --check — clean

Closes #374

🤖 Generated with Claude Code

Add tests for previously untested endpoint groups:
- Auth pairing: create, complete, list, revoke, revoke-all (8 tests)
- Briefs: empty list, not-found, with task_intake seed (3 tests)
- Village stats: happy path with seeded data, invalid ISO param (2 tests)
- Approval check: inline bundle, nonexistent bundle 404 (2 tests)
- Controls patches: empty list, invalid status 400 (2 tests)
- Decisions: invalid after param returns 400 (1 test)
- Log filters: filter by type, filter by keyword (2 tests)
- Telemetry: source filter (1 test)

Total: 112 -> 133 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fagemx
Copy link
Copy Markdown
Owner Author

fagemx commented Mar 27, 2026

Code Review: PR #386 (Round 1)

Summary

Adds 21 endpoint tests covering auth pairing, briefs, village stats, approval check, controls patches, decisions validation, log filters, and telemetry source filtering. Test isolation is solid (each test uses tempfile::tempdir()), assertions are meaningful, and error paths are well-covered. All 133 tests pass, clippy clean.

Key Findings

Critical Issues (P0)

None.

High Priority (P1)

  1. Naming inconsistency in STORE_LOCK guards (lib.rs:5308,5336): The two controls_patches_* tests use _guard for STORE_LOCK.lock() and _sg for StoreRootGuard. All 7+ existing tests consistently use _lock for STORE_LOCK and _guard for StoreRootGuard. This swapped naming is confusing for code maintenance. Should follow the established convention.

Testing Review

Coverage

  • Auth pairing: 8 tests covering create, reject empty name, invalid token, list empty, revoke not-found, revoke success, revoke-all, and full pair+list flow
  • Briefs: 3 tests covering empty list, 404 not found, and task_intake materialization
  • Village stats: 2 tests covering valid counts and invalid after param
  • Approval check: 2 tests covering inline check and nonexistent bundle
  • Controls patches: 2 tests covering empty list and invalid status filter
  • Decisions: 1 test for invalid ISO date param
  • Log filters: 2 tests for type filter and keyword filter
  • Telemetry: 1 test for source filter

Convention Compliance

  • All tests follow project patterns: tempfile::tempdir(), real SQLite, oneshot(), no mocking
  • STORE_LOCK usage is correct for env-var-dependent tests
  • Minor: naming inconsistency on STORE_LOCK guard variables (P1 above)

Testing Verdict: Adequate Coverage

Verdict: Changes Requested

Fixing P1 issue (naming inconsistency) and will re-review.


Round 1 of automated review-fix loop

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fagemx
Copy link
Copy Markdown
Owner Author

fagemx commented Mar 27, 2026

Code Review: PR #386 (Round 2) — LGTM 🎉

All P0 and P1 issues have been resolved.

Summary

21 endpoint tests added covering 8 endpoint groups: auth pairing (8 tests), briefs (3), village stats (2), approval check (2), controls patches (2), decisions validation (1), log filters (2), and telemetry source filtering (1). All tests use tempfile::tempdir() for isolation, follow established project patterns (oneshot(), real SQLite, no mocking), and cover both happy paths and error paths (400, 404 status codes).

Fixed in round 1: STORE_LOCK guard variable naming aligned with project convention (_lock / _guard).

Verdict: LGTM ✅

No critical or high-priority issues remaining. This PR is ready for merge.


Completed after 2 round(s) of automated review-fix loop

@fagemx fagemx merged commit bd3ea1b into main Mar 27, 2026
7 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.

test(serve): add endpoint tests for edda-serve HTTP handlers

1 participant