fix(talk_bot): remove the dead appconfig_ex bot-secret fallback#435
fix(talk_bot): remove the dead appconfig_ex bot-secret fallback#435oleksandr-nc wants to merge 1 commit into
Conversation
Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughSync and async bot secret retrieval functions in ChangesBot secret environment-only lookup
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
get_bot_secret()/aget_bot_secret()resolve a Talk bot's secret in two steps: first from the environment variableos.environ[sha1(APP_ID + "_" + callback_url)], and — if that is missing — by reading it from server-side app config viaNextcloudApp().appconfig_ex.get_value(secret_key).That second step is dead code. AppAPI's TalkBot rework (nextcloud/app_api#866) moved bot secrets into a dedicated
ex_apps_talk_botstable and removed them fromappconfig_ex, so a bot-secret lookup against the config store can never find anything — it always returnsNone.It is also unnecessary, not merely dead.
register_talk_bot()returns the secret on every call (AppAPI returns the existing secret for an already-registered bot, not only when minting a new one), and nc_py_api caches it intoos.environ[bot_id]right after registering. ExApps re-register their bots on enable/startup, so the environment variable is always (re)populated — and that is what actually serves the secret inget_bot_secret(). The existingreset_bot_secrettest flow confirms this: it pops the env var, thenenabled_handler(True)re-registers and repopulates it.This removes the fallback from both functions. It is behavior-preserving (the fallback returns
Nonetoday regardless), removes a pointless OCS round-trip on the rare env-miss path, and drops the last staleappconfig_exreference in the Talk path.Surfaced while reviewing the AppAPI config-storage migration (
appconfig_ex/preferences_ex→IAppConfig/IUserConfig); this is the nc_py_api-side follow-up to nextcloud/app_api#866.Summary by CodeRabbit