Restart-gated Decoy Fast-Track

Co-Authored-By: brekotis <93345790+brekotis@users.noreply.github.com>
This commit is contained in:
Alexey
2026-09-06 18:51:13 +03:00
parent 106b26a5b7
commit 20a4d50524
19 changed files with 343 additions and 171 deletions
+6 -1
View File
@@ -24,12 +24,17 @@ pub(super) fn match_profile(
vhost: &WebRuntimeVhost,
candidate: &[u8; 32],
) -> Option<Arc<WebRuntimeProfile>> {
debug_assert_eq!(vhost.capabilities.len(), vhost.profiles.len());
// Runtime construction owns alignment; any future constructor drift must fail closed.
if vhost.capabilities.len() != vhost.profiles.len() {
return None;
}
let scan = scan_capabilities(&vhost.capabilities, candidate);
if bool::from(scan.matched) {
usize::try_from(scan.matched_index)
.ok()
.and_then(|index| vhost.profiles.get(index))
// Revalidate the selected identity after the index-only complete scan.
.filter(|profile| bool::from(profile.capability.ct_eq(candidate)))
.map(Arc::clone)
} else {
None