chore(simulation): address review suggestions — comments and minor fixes
- monologue.rs: tracing::warn on unrecognized trigger in fallback arm - disclosure.rs: borrow-sequencing comment, first() simplification note - trait_modifiers.rs: delegate parse_confidence to KnowledgeConfidence::try_from - npc_knowledge_transfer.rs: fix misleading "draw randomly" comment, document one-directional transfer behavior - graph.rs: document intentional no-retrigger after contradiction - dialogue.rs: explain entity grant guardrail asymmetry (D-079) - knowledge/mod.rs: document one-tick monologue lag from system ordering - poi_discovery.rs: document D-079 carve-out for direct KG write Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -293,6 +293,9 @@ pub fn process_unprompted_disclosure(
|
||||
let npc_sid = sid_opt?.0;
|
||||
|
||||
// Gate 2: candidate pool non-empty.
|
||||
// Takes highest-priority candidate (sorted by confidence desc,
|
||||
// then recency desc in derive_disclosure_candidates). Full Layer 4
|
||||
// line selection with variety tracking is deferred to #172.
|
||||
let fact_id = candidates.candidates.first()?.clone();
|
||||
|
||||
// Gate 3: NPC→player trust >= Surface.
|
||||
@@ -404,6 +407,10 @@ pub fn process_unprompted_disclosure(
|
||||
}
|
||||
|
||||
// 3. Update NPC cooldown state.
|
||||
// Note: re-queries npc_query mutably after the read pass above. This is
|
||||
// safe because the read pass only borrows shared refs and completes before
|
||||
// this point. The two-phase pattern (read → select winner → write) avoids
|
||||
// holding a mutable borrow during iteration.
|
||||
if let Ok((_, _, _, _, _, _, _, mut cooldown)) = npc_query.get_mut(winner.entity) {
|
||||
cooldown.per_fact_history.insert(winner.fact_id.clone());
|
||||
cooldown.npc_cooldown_until = current_tick + NPC_COOLDOWN_TICKS;
|
||||
|
||||
Reference in New Issue
Block a user