Skip to content

fix(tools): propagate ClaimSource and ErrorDomain to AuditEntry#2319

Merged
bug-ops merged 1 commit intomainfrom
fix/2308-claimsource-audit-propagation
Mar 28, 2026
Merged

fix(tools): propagate ClaimSource and ErrorDomain to AuditEntry#2319
bug-ops merged 1 commit intomainfrom
fix/2308-claimsource-audit-propagation

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 28, 2026

Summary

Changes

crates/zeph-tools/src/shell/mod.rs

  • log_audit() now takes Option<&ToolError>; claim_source is always Some(ClaimSource::Shell)
  • Blocked/permission-denied sites pass Some(&err), success/timeout paths pass None
  • error_category and error_domain derived via ToolErrorCategory::domain()

crates/zeph-tools/src/scrape.rs

  • Same pattern; claim_source is always Some(ClaimSource::WebScrape)

crates/zeph-tools/src/audit.rs

  • claim_source_serde_roundtrip: all 8 ClaimSource variants serialize to snake_case JSON and deserialize back
  • audit_entry_claim_source_none_omitted: None → field absent from JSON output
  • audit_entry_claim_source_some_present: Some(ClaimSource::Shell)"claim_source":"shell"

policy_gate.rs retains claim_source: None — policy checks are not tool execution results.

Test plan

  • cargo +nightly fmt --check — pass
  • cargo clippy --all-targets --all-features --workspace -- -D warnings — pass (0 warnings)
  • cargo nextest run --workspace --all-features --lib --bins — 6913 passed (+3 new tests)

Closes #2308
Closes #2299

@github-actions github-actions bot added rust Rust code changes bug Something isn't working size/M Medium PR (51-200 lines) labels Mar 28, 2026
#2299)

All AuditEntry construction sites in ShellExecutor and WebScrapeExecutor
previously hardcoded claim_source/error_domain as None, making the audit
trail always null for both fields despite ToolOutput setting them correctly.

- log_audit() in shell/mod.rs and scrape.rs now takes Option<&ToolError>
- Blocked/error call sites pass Some(&err); success paths pass None
- error_category and error_domain are derived via ToolErrorCategory::domain()
- claim_source is now Some(ClaimSource::Shell) / Some(ClaimSource::WebScrape)
- policy_gate.rs retains claim_source: None (not a tool execution result)
- Add ClaimSource serde roundtrip test (all 8 variants)
- Add AuditEntry.claim_source JSON serialization tests (None omitted, Some present)

Closes #2308, closes #2299
@bug-ops bug-ops force-pushed the fix/2308-claimsource-audit-propagation branch from be2ca12 to 56d46b9 Compare March 28, 2026 07:56
@bug-ops bug-ops enabled auto-merge (squash) March 28, 2026 07:56
@bug-ops bug-ops merged commit ba0ca13 into main Mar 28, 2026
25 checks passed
@bug-ops bug-ops deleted the fix/2308-claimsource-audit-propagation branch March 28, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

1 participant