{"record":{"id":"7812710d71466a22","repo":"tinyhumansai/openhuman","slug":"meetings-store-set-event-policy-unknown-policy","errorCode":null,"errorMessage":"[meetings::store] set_event_policy: unknown policy {:?} (valid: auto, ask, skip)","messagePattern":"\\[meetings::store\\] set_event_policy: unknown policy (.+?) \\(valid: auto, ask, skip\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/meet/backend_bot/store.rs","lineNumber":256,"sourceCode":"\n/// Flag that a summary was generated for this session.\npub fn mark_summary_generated(config: &Config, id: &str, now_ms: u64) -> Result<()> {\n    with_connection(config, |conn| {\n        conn.execute(\n            \"UPDATE meeting_sessions SET summary_generated = 1, updated_at_ms = ?1 WHERE id = ?2\",\n            params![now_ms as i64, id],\n        )?;\n        Ok(())\n    })\n}\n\n/// Persist or replace the join-policy override for a specific calendar event.\n///\n/// The `policy` must be one of \"auto\" | \"ask\" | \"skip\" — anything else is\n/// rejected with an error so the table cannot accumulate invalid values.\npub fn set_event_policy(config: &Config, calendar_event_id: &str, policy: &str) -> Result<()> {\n    if !matches!(policy, \"auto\" | \"ask\" | \"skip\") {\n        anyhow::bail!(\n            \"[meetings::store] set_event_policy: unknown policy {:?} (valid: auto, ask, skip)\",\n            policy\n        );\n    }\n    with_connection(config, |conn| {\n        let now_ms = std::time::SystemTime::now()\n            .duration_since(std::time::UNIX_EPOCH)\n            .unwrap_or_default()\n            .as_millis() as i64;\n        conn.execute(\n            \"INSERT OR REPLACE INTO meeting_event_policies (calendar_event_id, policy, updated_at_ms) VALUES (?1, ?2, ?3)\",\n            rusqlite::params![calendar_event_id, policy, now_ms],\n        )?;\n        Ok(())\n    })\n}\n\n/// Retrieve the join-policy override for a specific calendar event. Returns","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/meet/backend_bot/store.rs#L238-L274","documentation":"set_event_policy persists per-calendar-event join-policy overrides into the meeting_event_policies table and deliberately validates the value before writing: anything outside the literal set auto | ask | skip is rejected so the table cannot accumulate invalid rows. This is pure input validation — nothing is written when it fires.","triggerScenarios":"Calling set_event_policy (or the RPC/agent surface that wraps it) with values like \"always\", \"never\", \"yes\", an empty string, or a capitalized form such as \"Ask\" — the vocabulary is lowercase and closed.","commonSituations":"UI dropdown out of sync with the accepted set; hand-crafted RPC calls guessing the enum; LLM-driven agents inventing values; newer client vocabulary against an older accepted set.","solutions":["Send exactly one of \"auto\", \"ask\", \"skip\" (lowercase).","Map user-facing vocabulary at the edge (always→auto, never→skip) before calling the store.","Confirm the accepted set for your version in the store's validator before adding new UI options."],"exampleFix":"// before\nstore::set_event_policy(&config, \"evt_123\", \"always\")?; // rejected: unknown policy\n\n// after — the accepted vocabulary\nstore::set_event_policy(&config, \"evt_123\", \"auto\")?;   // auto | ask | skip","handlingStrategy":"validation","validationCode":"const EVENT_POLICIES: &[&str] = &[\"auto\", \"ask\", \"skip\"];\nif !EVENT_POLICIES.contains(&policy.trim()) {\n    anyhow::bail!(\"policy must be one of {EVENT_POLICIES:?}, got {:?}\", policy);\n}","typeGuard":"fn is_valid_event_policy(p: &str) -> bool {\n    matches!(p, \"auto\" | \"ask\" | \"skip\")\n}","tryCatchPattern":"Catch the bail and re-surface it as an inline form error next to the policy selector — nothing was written, so the fix is purely client-side.","preventionTips":["Drive the UI dropdown from the same literal list the store validates.","Validate before the RPC so users get immediate feedback.","Trim and lowercase user/agent input at the boundary before it reaches the store."],"tags":["meetings","policy","validation","backend-bot"],"backgroundTag":"invalid-enum-value","analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}