KeiSeiKit-1.0/_primitives/_rust/kei-agent-runtime/tests
Parfii-bot f9bfcc23b7 fix(agent-runtime/b1): PatternGate hardening — RwLock, Result, UTF-8, explicit deny
H1 lock contention: Mutex<HashMap> → RwLock<HashMap>. Hot path cheap
read-lock, write-lock only on first compile per pattern.

H2 panic removed: compile_checked() returns Result<Regex, regex::Error>;
all call sites propagate as GateDecision::Deny{reason:"misconfigured
regex..."}. No .expect()/.unwrap() on compile anywhere.

H3 dead branch: AllowIfMatch + TaskWhitelist/TaskDenylist combo was
silently NotApplicable (allow-everything). Now explicit Deny with
"misconfigured" + "AllowIfMatch" in reason. Fail-closed.

S4 UTF-8 panic: &s[..60] byte-slice → s.chars().take(60). Cyrillic/
emoji safe. 60-char budget by code point.

L2 render chain: String::replace chain → single-pass render_template()
that scans {token} markers once. Substituted text cannot bleed into
later tokens.

Tests: 70/70 (was 66, +4). pattern_gate_smoke 10 → 14.
Follow-up (out of file-boundary scope): per-pattern Lazy<Regex> variant
would eliminate the RwLock entirely but requires editing sibling gate
consts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 05:27:59 +08:00
..
capability_trait_smoke.rs feat(convergence/u2): capability renames + back-compat aliases 2026-04-23 03:43:40 +08:00
command_verify_smoke.rs feat(convergence/p2): PatternGate + CommandVerify unified traits 2026-04-23 04:46:47 +08:00
compose_smoke.rs feat(agent-substrate/phase-3): kei-agent-runtime + kei-capability binaries 2026-04-23 02:35:53 +08:00
dna_smoke.rs feat(convergence/p3): Role expression (extends/relaxes) + DNA identity 2026-04-23 04:46:48 +08:00
gate_smoke.rs feat(convergence/u2): capability renames + back-compat aliases 2026-04-23 03:43:40 +08:00
pattern_gate_smoke.rs fix(agent-runtime/b1): PatternGate hardening — RwLock, Result, UTF-8, explicit deny 2026-04-23 05:27:59 +08:00
prepare_smoke.rs feat(agent-substrate/wrapper): kei-agent-runtime prepare — orchestrator ergonomics 2026-04-23 03:25:14 +08:00
role_expression_smoke.rs feat(convergence/p3): Role expression (extends/relaxes) + DNA identity 2026-04-23 04:46:48 +08:00
simulated_merge_smoke.rs feat(agent-substrate/phase-3): kei-agent-runtime + kei-capability binaries 2026-04-23 02:35:53 +08:00
verify_smoke.rs feat(agent-substrate/phase-3): kei-agent-runtime + kei-capability binaries 2026-04-23 02:35:53 +08:00