Repository navigation
fix(server): t3 connect status reports a link made in the app as on #39471
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 all commits
48ff543
9199ef7
bc4450a
5094f7b
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 |
|---|---|---|
|
|
@@ -36,10 +36,12 @@ import * as CliTokenManager from "../cloud/CliTokenManager.ts"; | |
| import { formatReachabilityFailure } from "../cloud/ConnectReachability.ts"; | ||
| import { filterRelayResponse } from "../cloud/relayResponse.ts"; | ||
| import { | ||
| CLOUD_ENDPOINT_RUNTIME_CONFIG, | ||
| CLOUD_LINK_REVOKED, | ||
| CLOUD_LINKED_USER_ID, | ||
| isAgentActivityPublishingEnabledValue, | ||
| PUBLISH_AGENT_ACTIVITY_SECRET, | ||
| RELAY_ENVIRONMENT_CREDENTIAL_SECRET, | ||
| RELAY_URL_SECRET, | ||
| } from "../cloud/config.ts"; | ||
| import { relayUrlConfig } from "../cloud/publicConfig.ts"; | ||
|
|
@@ -199,17 +201,19 @@ function formatCloudStatus( | |
| ? "pending server startup" | ||
| : "not provisioned"; | ||
| const publishOnly = status.desired && status.linkMode === "publish_only"; | ||
| const nextStep = !status.authenticated | ||
| ? `Run \`${commands.link}\` to authorize and enable T3 Connect.` | ||
| : status.revoked | ||
| ? `Run \`${commands.link}\` to link this environment again.` | ||
| : !status.desired | ||
| ? `Run \`${commands.link}\` to enable T3 Connect.` | ||
| : !status.linked | ||
| ? publishOnly | ||
| ? "Start T3 to provision the environment link." | ||
| : "Start T3 to provision the environment link and launch its managed tunnel." | ||
| : undefined; | ||
| // An app-made link needs no CLI credential once provisioned. | ||
| const nextStep = | ||
| status.desired && status.linked && !status.revoked | ||
| ? undefined | ||
| : !status.authenticated | ||
| ? `Run \`${commands.link}\` to authorize and enable T3 Connect.` | ||
| : status.revoked | ||
| ? `Run \`${commands.link}\` to link this environment again.` | ||
| : !status.desired | ||
| ? `Run \`${commands.link}\` to enable T3 Connect.` | ||
| : publishOnly | ||
| ? "Start T3 to provision the environment link." | ||
| : "Start T3 to provision the environment link and launch its managed tunnel."; | ||
|
|
||
| return [ | ||
| "T3 Connect", | ||
|
|
@@ -672,8 +676,10 @@ const connectStatusCommand = Command.make("status", { | |
| const relayClient = yield* RelayClient.RelayClient; | ||
| const tokens = yield* CliTokenManager.CloudCliTokenManager; | ||
| const [ | ||
| desired, | ||
| authenticated, | ||
| cliDesired, | ||
| managedTunnel, | ||
| cliAuthenticated, | ||
| relayCredential, | ||
| cloudUserId, | ||
| relayUrl, | ||
| publishAgentActivity, | ||
|
|
@@ -683,7 +689,9 @@ const connectStatusCommand = Command.make("status", { | |
| ] = yield* Effect.all( | ||
| [ | ||
| CliState.readCliDesiredCloudLink, | ||
| secrets.get(CLOUD_ENDPOINT_RUNTIME_CONFIG), | ||
| tokens.hasCredential, | ||
| secrets.get(RELAY_ENVIRONMENT_CREDENTIAL_SECRET), | ||
| secrets.get(CLOUD_LINKED_USER_ID), | ||
| secrets.get(RELAY_URL_SECRET), | ||
| secrets.get(PUBLISH_AGENT_ACTIVITY_SECRET), | ||
|
|
@@ -693,6 +701,10 @@ const connectStatusCommand = Command.make("status", { | |
| ], | ||
| { concurrency: "unbounded" }, | ||
| ); | ||
| // A link made in the desktop, web, or mobile app saves the tunnel config but no CLI marker. | ||
| const desired = cliDesired || Option.isSome(managedTunnel); | ||
|
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. Treat a revoked link as off when deriving A revoked link keeps its stored tunnel config. Only a new link clears that config. Status therefore sets Suggested fix
|
||
| // Such a link authorizes the environment with its relay credential, not a CLI sign-in. | ||
| const authenticated = cliAuthenticated || Option.isSome(relayCredential); | ||
| // A publish-only link has no tunnel for other devices to reach. | ||
| const reachability = | ||
| desired && linkMode === "managed" ? yield* checkLiveReachability() : null; | ||
|
|
||
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.
Move status collection into the owning service.
This adds another persistence operation to the CLI handler. The handler also combines persisted state, selects the reachability check, and constructs the status result. Move that pipeline into one domain-service operation. Keep command decoding and output formatting in the CLI. This gives other transports the same status and lifecycle rules.
As per coding guidelines, “Server features are services; transports stay thin.” As per path instructions, “Put capability logic in its owning domain service rather than a transport handler.”
Sources: Coding guidelines, Path instructions