Skip to content

feat(koinon): signal model, GeoSignal, and Entity types#13

Merged
forkwright merged 2 commits intomainfrom
p0-02/signal-model
Mar 14, 2026
Merged

feat(koinon): signal model, GeoSignal, and Entity types#13
forkwright merged 2 commits intomainfrom
p0-02/signal-model

Conversation

@forkwright
Copy link
Owner

Summary

  • SignalKind enum with 7 domain variants (RF, Mesh, Network, Proximity, GPS, Environmental, OSINT), each backed by a #[non_exhaustive] detail enum with its own typed fields
  • GeoSignal struct with builder pattern (with_device, with_confidence, with_metadata), auto-generated SignalId, confidence scoring, and serde_json metadata map
  • Confidence newtype over f32 clamped to [0.0, 1.0] with Display as percentage (e.g. "85%")
  • Entity struct with EntityKind, temporal tracking (first_seen / last_seen), and arbitrary attribute map
  • All types: serde roundtrip, Display, #[non_exhaustive] for forward compatibility, full doc comments
  • Moved serde_json from dev-dependencies to main dependencies (required for BTreeMap<CompactString, serde_json::Value> fields)
  • 46 unit tests covering construction, serialization, validation, and Display

Test plan

  • cargo test --workspace — all 97 tests pass (46 new signal/entity tests + 51 pre-existing)
  • cargo clippy --workspace --all-targets -- -D warnings — zero warnings
  • cargo fmt --all -- --check — clean
  • Serde roundtrip verified for every SignalKind variant
  • GeoSignal serde roundtrip with all optional fields populated and with none
  • Entity serde roundtrip with attributes
  • Confidence clamping: below 0.0 → 0.0, above 1.0 → 1.0, no panics
  • Confidence::new(0.85).to_string() == "85%"
  • No .unwrap() or .expect() outside #[cfg(test)] modules

Observations

None noted outside scope.

🤖 Generated with Claude Code

Adds the core domain types that every collector and analysis crate
will produce and consume.

- SignalKind enum with 7 domain variants (Rf, Mesh, Network,
  Proximity, Gps, Environmental, Osint), each backed by a
  non_exhaustive detail enum
- GeoSignal struct with builder pattern (with_device, with_confidence,
  with_metadata), auto-generated SignalId, and serde_json metadata map
- Confidence newtype over f32 clamped to [0.0, 1.0]; Display as "%"
- Entity struct with EntityKind, temporal tracking (first_seen /
  last_seen), and arbitrary attribute map
- All types: serde roundtrip, Display, #[non_exhaustive] for forward
  compatibility, full doc comments
- 46 unit tests covering construction, serde, validation, and Display

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

⚠️ Large PR detected — 4 files, 973 lines changed.

Consider splitting into smaller PRs for easier review. Not a blocker, just a signal.

Replace test strings containing "example" (matched by the pii-scan
pattern \b[Ee]xample\b) with neutral alternatives such as "test.local",
"corp-net", "threatfeed.test", "evil.test.invalid", and "https://corp.test".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@forkwright forkwright merged commit d4e0480 into main Mar 14, 2026
13 checks passed
@forkwright forkwright deleted the p0-02/signal-model branch March 14, 2026 08:44
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