Repository navigation
test(reborn): channel-lifecycle transition coverage — delivery honesty, re-auth, exit edges, OAuth retry, restart survival (#6105) #6113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
9031981
a585057
1980250
f9252b6
58d8237
058c476
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,6 +61,7 @@ pub struct SlackChannelConnectionTestConfig { | |
| /// See the module doc for the production call sites each method mirrors. | ||
| pub struct SlackChannelConnectionTestBundle { | ||
| tenant_id: TenantId, | ||
| host_user_id: UserId, | ||
| agent_id: AgentId, | ||
| installation_id: ironclaw_product_adapters::AdapterInstallationId, | ||
| team_id: SlackTeamId, | ||
|
|
@@ -106,7 +107,7 @@ pub fn build_slack_channel_connection_for_test( | |
| let state = Arc::new(FilesystemSlackHostState::new( | ||
| Arc::clone(&local_runtime.host_state_filesystem), | ||
| tenant_id.clone(), | ||
| host_user_id, | ||
| host_user_id.clone(), | ||
| agent_id.clone(), | ||
| None, | ||
| )); | ||
|
|
@@ -160,6 +161,7 @@ pub fn build_slack_channel_connection_for_test( | |
| } | ||
| Ok(SlackChannelConnectionTestBundle { | ||
| tenant_id, | ||
| host_user_id, | ||
| agent_id, | ||
| installation_id, | ||
| team_id, | ||
|
|
@@ -223,6 +225,44 @@ impl SlackChannelConnectionTestBundle { | |
| Arc::clone(&self.facade) | ||
| } | ||
|
|
||
| /// Restart-survival probe (T5 of issue #6105): read the SAME active-state | ||
| /// identity-binding predicate as | ||
| /// [`Self::has_any_active_identity_binding`], but through a FRESH | ||
| /// `FilesystemSlackHostState` over a FRESH local-dev root filesystem | ||
| /// reopened at `storage_root` — fully independent of the live runtime's | ||
| /// in-memory handles. This is the integration-tier approximation of a | ||
| /// process restart: it proves the durable binding is reconstructible the | ||
| /// way production reconstructs it on boot (`build_reborn_services` → | ||
| /// `local_dev_slack_host_state_filesystem` → Slack host-state mounts). | ||
| /// Tests only. | ||
| #[cfg(any(feature = "libsql", feature = "postgres"))] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The helper #[cfg(all(
feature = "slack-v2-host-beta",
any(feature = "libsql", feature = "postgres")
))]
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a real compile hole — the enclosing module is already feature-gated. |
||
| pub async fn has_active_identity_binding_after_reopen( | ||
| &self, | ||
| storage_root: &std::path::Path, | ||
| user_id: &UserId, | ||
| ) -> Result<bool, String> { | ||
| let host_state_filesystem = | ||
| crate::factory::open_local_dev_slack_host_state_filesystem_for_test(storage_root) | ||
| .await | ||
| .map_err(|error| error.to_string())?; | ||
| let state = Arc::new(FilesystemSlackHostState::new( | ||
| host_state_filesystem, | ||
| self.tenant_id.clone(), | ||
| self.host_user_id.clone(), | ||
| self.agent_id.clone(), | ||
| None, | ||
| )); | ||
| let lookup: Arc<dyn RebornUserIdentityLookup> = state; | ||
| lookup | ||
| .user_has_provider_binding_with_provider_user_id_prefix( | ||
| SLACK_IDENTITY_PROVIDER, | ||
| user_id, | ||
| None, | ||
| ) | ||
| .await | ||
| .map_err(|error| error.to_string()) | ||
| } | ||
|
|
||
| /// Surface (a) of the extensions page: what | ||
| /// `list_extensions` merges via | ||
| /// `ChannelConnectionFacade::caller_channel_connections` | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,10 +20,13 @@ mod support; | |||||||||||||||||||
| // Modules are alphabetical (rustfmt reorders `mod` decls); execution order is | ||||||||||||||||||||
| // set by the `report.record(...)` sequence below, not declaration order. | ||||||||||||||||||||
| mod scenario_activate_then_active_cross_thread; | ||||||||||||||||||||
| mod scenario_credential_extension_lifecycle_state_machine; | ||||||||||||||||||||
| mod scenario_extension_activation_reauth_gate; | ||||||||||||||||||||
| mod scenario_install_then_visible_cross_thread; | ||||||||||||||||||||
| mod scenario_install_unknown_extension_id_fails_safely; | ||||||||||||||||||||
| mod scenario_remove_then_absent_cross_thread; | ||||||||||||||||||||
| mod scenario_slack_channel_lifecycle_state_machine; | ||||||||||||||||||||
| mod scenario_slack_state_survives_reopen; | ||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The module
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These symbols come from the root crate's dev-dependency on |
||||||||||||||||||||
| mod scenario_uninstalled_tool_call_denied_until_activated; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| use reborn_support::group::{RebornIntegrationGroup, ScenarioReport}; | ||||||||||||||||||||
|
|
@@ -83,5 +86,35 @@ async fn extensions_group_e2e() { | |||||||||||||||||||
| scenario_slack_channel_lifecycle_state_machine::run(&g).await, | ||||||||||||||||||||
| ); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // Scenario 7 (issue #6105, T3): exit edges for a credential-injection | ||||||||||||||||||||
| // extension — activate → use → remove (#6029's wedged edge) → surfaces | ||||||||||||||||||||
| // flip → reconfigure + reactivate → use again. Reuses "github" AFTER | ||||||||||||||||||||
| // every other scenario that reads it has run (scenario 1 leaves it | ||||||||||||||||||||
| // installed), so its install exercises the idempotent-reinstall arm. | ||||||||||||||||||||
| report.record( | ||||||||||||||||||||
| "credential_extension_lifecycle_state_machine", | ||||||||||||||||||||
| scenario_credential_extension_lifecycle_state_machine::run(&g).await, | ||||||||||||||||||||
| ); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // Scenario 8 (issue #6105, T5): restart survival — the connected/installed | ||||||||||||||||||||
| // Slack state scenario 6 left behind reads back through FRESH store | ||||||||||||||||||||
| // handles reopened at the same on-disk storage_root (what a process | ||||||||||||||||||||
| // restart reconstructs). Depends on scenario 6's end state. | ||||||||||||||||||||
| report.record( | ||||||||||||||||||||
| "slack_state_survives_reopen", | ||||||||||||||||||||
| scenario_slack_state_survives_reopen::run(&g).await, | ||||||||||||||||||||
| ); | ||||||||||||||||||||
|
Comment on lines
+109
to
+112
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gate the registration of
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the module-declaration thread above: the dev-dependency enables |
||||||||||||||||||||
|
|
||||||||||||||||||||
| // Scenario 9 (issue #6105 bucket-3 arms): activation-time re-auth gate — | ||||||||||||||||||||
| // activate over a REVOKED credential parks BlockedAuth with a renderable | ||||||||||||||||||||
| // provider requirement (#6043 shape), persists no misleading Failed error | ||||||||||||||||||||
| // (#5878's reported extension_activate surface), and a reconfigure | ||||||||||||||||||||
| // unwedges it. Uses "notion" (removed by scenario 2; credentials | ||||||||||||||||||||
| // untouched by every other scenario). | ||||||||||||||||||||
| report.record( | ||||||||||||||||||||
| "extension_activation_reauth_gate", | ||||||||||||||||||||
| scenario_extension_activation_reauth_gate::run(&g).await, | ||||||||||||||||||||
| ); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| report.assert_all_passed(); | ||||||||||||||||||||
| } | ||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asserting on the serialized JSON string using
containsis fragile and can lead to false positives or unexpected failures if the JSON formatting, spacing, or key order changes. It is more robust to parse the body as a JSON value and assert on the specific field.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 58d8237 — the body is now parsed with
serde_json::from_sliceand thechannelfield is asserted equal to"D456".