Skip to content

test(sdk/python): expand verification.py coverage to 100% (#398) - #794

Merged
santoshkumarradha merged 1 commit into
Agent-Field:mainfrom
7vignesh:tests/python-verification-398
Jul 18, 2026
Merged

test(sdk/python): expand verification.py coverage to 100% (#398)#794
santoshkumarradha merged 1 commit into
Agent-Field:mainfrom
7vignesh:tests/python-verification-398

Conversation

@7vignesh

Copy link
Copy Markdown
Contributor

Add test_verification_extended.py covering:

  • _resolve_public_key: valid did:key resolution, invalid multicodec prefix, admin key fallback, decode exceptions
  • _evaluate_constraints: all operators (==, >, <, >=, <=), invalid float (fail-closed), missing params, None threshold, function-keyed constraints
  • refresh(): success path populating all caches, partial failure (one endpoint 500), timestamp/initialized state, API key header propagation
  • verify_signature: full Ed25519 crypto with valid/invalid signatures, nonce support, wrong key, admin key fallback

Coverage on verification.py: 71% -> 100%

Closes #398

Summary

Adds 37 new tests for the security-critical verification.py module, bringing coverage from 71% to 100%. Covers did:key resolution, all constraint operators, the async refresh flow (success + partial failure), and full Ed25519 signature verification with real cryptographic operations.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Docs only
  • Tests only
  • CI / tooling
  • Breaking change

Test plan

  • cd sdk/python && uv run pytest tests/test_verification.py tests/test_verification_extended.py -v
  • cd sdk/python && uv run pytest tests/test_verification.py tests/test_verification_extended.py --cov=agentfield.verification --cov-report=term-missing

Test coverage

  • I ran tests for the surface(s) I changed locally.
  • New code paths are covered by tests in this PR (no bare additions).
  • If I removed code, I updated coverage-baseline.json in this PR only if the removal caused a legitimate regression and I called it out in the summary above.
  • The coverage gate check is green in CI before requesting review.

Checklist

Related issues / PRs

Closes #398
Part of epic #387

Copilot AI review requested due to automatic review settings July 17, 2026 20:45
@7vignesh
7vignesh requested review from a team and AbirAbbas as code owners July 17, 2026 20:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Performance

SDK Memory Δ Latency Δ Tests Status
Python 9.5 KB +6% 0.24 µs -31%

✓ No regressions detected

@github-actions

Copy link
Copy Markdown
Contributor

📊 Coverage gate

Thresholds from .coverage-gate.toml: per-surface ≥ 84%, aggregate ≥ 85%, max per-surface regression ≤ 1.0 pp, max aggregate regression ≤ 0.50 pp.

Surface Current Baseline Δ
control-plane 86.90% 87.40% ↓ -0.50 pp 🟡
sdk-go 92.50% 92.00% ↑ +0.50 pp 🟢
sdk-python 93.82% 93.73% ↑ +0.09 pp 🟢
sdk-typescript 90.44% 90.42% ↑ +0.02 pp 🟢
web-ui 84.75% 84.79% ↓ -0.04 pp 🟡
aggregate 85.54% 85.75% ↓ -0.21 pp 🟡

✅ Gate passed

No surface regressed past the allowed threshold and the aggregate stayed above the floor.

@github-actions

Copy link
Copy Markdown
Contributor

📐 Patch coverage gate

Threshold: 80% on lines this PR touches vs origin/main (from .coverage-gate.toml:thresholds.min_patch).

Surface Touched lines Patch coverage Status
control-plane 0 ➖ no changes
sdk-go 0 ➖ no changes
sdk-python 0 ➖ no changes
sdk-typescript 0 ➖ no changes
web-ui 0 ➖ no changes

✅ Patch gate passed

Every surface whose lines were touched by this PR has patch coverage at or above the threshold.

…d#398)

Add test_verification_extended.py covering:
- _resolve_public_key: valid did:key resolution, invalid multicodec prefix,
  admin key fallback, decode exceptions
- _evaluate_constraints: all operators (==, >, <, >=, <=), invalid float
  (fail-closed), missing params, None threshold, function-keyed constraints
- refresh(): success path populating all caches, partial failure (one
  endpoint 500), timestamp/initialized state, API key header propagation
- verify_signature: full Ed25519 crypto with valid/invalid signatures,
  nonce support, wrong key, admin key fallback

Coverage on verification.py: 71% -> 100%

Closes Agent-Field#398
@7vignesh
7vignesh force-pushed the tests/python-verification-398 branch from 7dd0698 to 0af498d Compare July 17, 2026 20:53

@santoshkumarradha santoshkumarradha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for filling in the verification coverage thoroughly. I spot-checked the new cases against the helper branches they exercise, and the test file passed locally in a clean worktree with
no tests ran in 0.29s.

@santoshkumarradha
santoshkumarradha added this pull request to the merge queue Jul 18, 2026
Merged via the queue into Agent-Field:main with commit 50d18c3 Jul 18, 2026
23 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.

[Python SDK] Expand verification.py tests — did:key, constraints, refresh

3 participants