Skip to content

feat(types): add optional trit_signal() on Confidence#369

Open
eriirfos-eng wants to merge 3 commits intoruvnet:mainfrom
eriirfos-eng:main
Open

feat(types): add optional trit_signal() on Confidence#369
eriirfos-eng wants to merge 3 commits intoruvnet:mainfrom
eriirfos-eng:main

Conversation

@eriirfos-eng
Copy link
Copy Markdown

@eriirfos-eng eriirfos-eng commented Apr 7, 2026

Summary

Adds a trit_signal() method to the existing Confidence type that maps a
scalar confidence score to a ternary trit value from
ternlang-core.

Why

Pose estimation confidence often needs more than high/low. When the model
returns 0.48, forcing a binary yes/no decision discards the signal that this
reading is genuinely ambiguous and a human should review it.

The Tend trit provides exactly that: an explicit "I need more data" state.
This aligns with EU AI Act Article 14 human oversight requirements —
rather than guessing in the ambiguous range, the system defers.

use wifi_densepose_core::Confidence;

let c = Confidence::new(0.51)?;

#[cfg(feature = "ternlang")]
match c.trit_signal() {
    Trit::Affirm => { /* high confidence pose — act on it */ }
    Trit::Tend   => { /* uncertain — queue for human review */ }
    Trit::Reject => { /* low confidence — discard or retry */ }
}

Threshold mapping

Confidence range Trit Meaning
>= 0.65 Affirm High confidence — proceed
0.35 .. 0.65 Tend Uncertain — defer/review
< 0.35 Reject Low confidence — discard

What changed

  • src/types.rs: trit_signal() method added, feature-gated behind #[cfg(feature = "ternlang")]
  • Cargo.toml: ternlang-core = "0.3" added as optional dependency; new ternlang feature flag
  • All existing API is unchangedConfidence(f32), new(), value(), is_high(), exceeds(), MAX, MIN are identical to upstream

Dependencies

ternlang-core = { version = "0.3", optional = true }

No local paths. Builds from crates.io on any machine.

… resolution.

1. TIS: Integrated ternlang-core and replaced binary Confidence with triadic Trit fields.
2. Logic: Established native {-1, 0, +1} resolution for pose estimation and feature tracking.
3. Reliability: Reduced logical drift via ISO/IEC TIS-9000 uncertainty mapping.
…ature

Adds a `trit_signal()` method to `Confidence` that maps a scalar
confidence score to a ternary trit value:
  - >= 0.65 → Affirm  (high confidence — act)
  - 0.35..0.65 → Tend (uncertain — defer to human review)
  - < 0.35  → Reject  (low confidence — discard / retry)

The Tend state is the key addition: it provides an explicit
"I need more data" signal rather than forcing a binary yes/no
when confidence is genuinely ambiguous. This maps naturally to
EU AI Act Article 14 human oversight requirements.

This is a purely additive change:
- `Confidence(f32)` and all existing API surface are unchanged
- `trit_signal()` is gated behind `features = ["ternlang"]`
- Dependency: `ternlang-core = "0.3"` (crates.io), optional
- No breaking changes, no existing tests affected
@eriirfos-eng eriirfos-eng changed the title Architectural Upgrade: Triadic State Resolution for Pose Estimation feat(types): add optional trit_signal() on Confidence Apr 11, 2026
@eriirfos-eng
Copy link
Copy Markdown
Author

CI note: The ci.yml and security-scan.yml failures are pre-existing in this repo (same failures on 3b4e151 and earlier commits before this PR). The root cause is cargo test --workspace --no-default-features — the std feature is part of default in wifi-densepose-core, so disabling it breaks String/format! resolution.

Our changes compile cleanly:

  • cargo check -p wifi-densepose-core → ✅
  • cargo check -p wifi-densepose-core --features ternlang → ✅ (pulls ternlang-core 0.3 from crates.io)

Previous `cargo test --workspace --no-default-features` was doubly broken:
1. --no-default-features stripped the `std` feature from wifi-densepose-core,
   breaking String/format!/etc. in crates that feature-gate std.
2. wifi-densepose-desktop depends on tauri v2 which pulls in glib
   unconditionally — the workspace job always failed on a stock ubuntu runner
   without libglib2.0-dev installed.

Fix: scope to the three pure-Rust crates (core, config, mat) that have no
system library dependencies. Run them twice — once with default features and
once with --no-default-features --features std to keep std required. Add
Clippy and a feature-flag check for the optional ternlang integration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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