fix(googlechat): enable config-only startup#1390
Conversation
56d0af1 to
a467747
Compare
chaodu-agent
left a comment
There was a problem hiding this comment.
Maintainer review — Approving ✅ (with a maintainer rebase pushed, a467747)
Same root-cause family as #1389, and honestly the better fix shape: instead of adding a per-platform side helper, this makes the shared predicate itself config-aware (has_unified_platform_env() → has_unified_platform(cfg)) — exactly the generalization direction we want for the remaining platforms. The 6-case regression test is thorough, and case 6 (config enabled = false beating env true) pins the config-authority semantics nicely.
What the rebase did (this PR raced #1389, which merged first and touched the same three regions of main.rs):
- Absorbed the WeCom arm into your predicate:
has_unified_wecom_config()(from #1389) is now called fromhas_unified_platform's wecom arm —WECOM_CORP_IDenv or credential-complete[wecom]section. The separateunified_wecom_configuredbinding is gone; your singleunified_platform_enabledflag covers both platforms. - Restored the
#[cfg(any(...))]gate on the binding — under default features (no gateway platforms compiled) the unified block that consumes the flag doesn't exist, so the ungated binding failed-D warnings(unused variable). #1389 had gated it for the same reason. - Kept both regression tests (your 6-case predicate test + #1389's wecom-section test), added
[googlechat]to the bail message, and updated the predicate doc comment to note which platforms are config-aware vs still env-signaled (line/feishu/teams — tracked on #1356).
Verified on the rebased head: default + unified clippy clean (-D warnings), 16/16 bin tests pass under both feature sets, changed file rustfmt-clean.
With this, config-only activation parity stands at 2/6 platforms (wecom, googlechat) — line/feishu/teams remain env-signaled and are tracked as the #1356 follow-up. Thanks for the quick follow-through from the #1389 review thread, @canyugs!
|
Self-review of the maintainer rebase (
Evidence: default + unified clippy clean, 16/16 bin tests under both feature sets, changed-file rustfmt zero drift, CI 34 pass (the lone |
What problem does this solve?
[googlechat] enabled = truecould not activate a config-only deployment. Both startup gates used an env-only helper, so OpenAB exited withno adapter configuredunless operators duplicated the setting asGOOGLE_CHAT_ENABLED=true.This made the resolved Google Chat config correct but unreachable, and contradicted the config-first contract from #1383.
How it works
GoogleChatConfig::resolve().enabled = falsestill overridesGOOGLE_CHAT_ENABLED=true.Regression coverage
The startup predicate test now covers:
[googlechat] enabled = true;enabled = falseoverriding envtrue;Local smoke test
Built the all-features binary and launched it with
GOOGLE_CHAT_ENABLEDunset and only:The unified server started successfully;
/healthand the configured Google Chat webhook route both returned HTTP 200.Validation
cargo clippy --all-features -- -D warningscargo test --all-features(root package: 15 passed)cargo test --all-features has_unified_platform_checks_config_and_envcargo test -p openab-core googlechat(4 passed)cargo test -p openab-gateway --all-features googlechat(67 passed; media tests run with writableHOME=/tmp)cargo test -p openab-gateway --test config_first_conformance --all-features(2 passed)cargo diff --checkcargo fmt --checkremains blocked by existing repository-wide rustfmt drift across unrelated core and gateway files; this PR does not reformat those files.Discussion
https://discord.com/channels/1491295327620169908/1491365158868619404/1526200802824421486