mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-26 23:50:17 +00:00
Refactor owner scope across channels and fix default routing fallback (#1151)
* refactor: add explicit owner scope across channels * fix: tighten routine owner target routing * fix: address owner scope review feedback * Fix owner-scope onboarding and event trigger isolation * Tighten routing fallback and wizard owner validation * fix: address owner-scope follow-up review * fix: tighten owner-scope follow-up details * fix: import Channel trait in telegram test * fix: normalize http webhook sender ids * fix: address remaining owner-scope review issues * fix: reconcile config rebase fallout * fix: reconcile extension manager rebase drift * fix: address current copilot review regressions * fix: restore clippy matrix after rebase
This commit is contained in:
+5
-4
@@ -405,10 +405,11 @@ fn check_routines_config() -> CheckResult {
|
||||
fn check_gateway_config(settings: &Settings) -> CheckResult {
|
||||
// Use the same resolve() path as runtime so invalid env values
|
||||
// (e.g. GATEWAY_PORT=abc) are caught here too.
|
||||
let tunnel_enabled = crate::config::TunnelConfig::resolve(settings)
|
||||
.map(|t| t.is_enabled())
|
||||
.unwrap_or(false);
|
||||
match crate::config::ChannelsConfig::resolve(settings, tunnel_enabled) {
|
||||
let owner_id = match crate::config::resolve_owner_id(settings) {
|
||||
Ok(owner_id) => owner_id,
|
||||
Err(e) => return CheckResult::Fail(format!("config error: {e}")),
|
||||
};
|
||||
match crate::config::ChannelsConfig::resolve(settings, &owner_id) {
|
||||
Ok(channels) => match channels.gateway {
|
||||
Some(gw) => {
|
||||
if gw.auth_token.is_some() {
|
||||
|
||||
+21
-7
@@ -292,6 +292,16 @@ async fn list(
|
||||
|
||||
// ── Create ──────────────────────────────────────────────────
|
||||
|
||||
fn cli_notify_config(notify_channel: Option<String>) -> NotifyConfig {
|
||||
NotifyConfig {
|
||||
channel: notify_channel,
|
||||
user: None,
|
||||
on_attention: true,
|
||||
on_failure: true,
|
||||
on_success: false,
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn create(
|
||||
db: &Arc<dyn Database>,
|
||||
@@ -338,13 +348,7 @@ async fn create(
|
||||
max_concurrent: 1,
|
||||
dedup_window: None,
|
||||
},
|
||||
notify: NotifyConfig {
|
||||
channel: notify_channel,
|
||||
user: user_id.to_string(),
|
||||
on_attention: true,
|
||||
on_failure: true,
|
||||
on_success: false,
|
||||
},
|
||||
notify: cli_notify_config(notify_channel),
|
||||
last_run_at: None,
|
||||
next_fire_at: next_fire,
|
||||
run_count: 0,
|
||||
@@ -729,4 +733,14 @@ mod tests {
|
||||
// Must be valid UTF-8 (would have panicked otherwise).
|
||||
assert!(result.is_char_boundary(result.len()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cli_notify_config_defaults_to_runtime_target_resolution() {
|
||||
let notify = cli_notify_config(Some("telegram".to_string()));
|
||||
assert_eq!(notify.channel.as_deref(), Some("telegram")); // safety: test-only assertion
|
||||
assert_eq!(notify.user, None); // safety: test-only assertion
|
||||
assert!(notify.on_attention); // safety: test-only assertion
|
||||
assert!(notify.on_failure); // safety: test-only assertion
|
||||
assert!(!notify.on_success); // safety: test-only assertion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user