Skip to content

Commit 0d7607f

Browse files
committed
fix(app): document terminal attach and bound browser e2e curl
1 parent adc62dd commit 0d7607f

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

packages/app/src/web/actions-project-terminal.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,33 @@ export const connectProjectById = (
322322
startTerminalSession(context, runtime)
323323
}
324324

325+
/**
326+
* Attaches an existing project SSH terminal session to the browser terminal list.
327+
*
328+
* @param projectId - Project identifier whose session should become selected.
329+
* @param projectKey - Project key used to resolve the terminal session API route.
330+
* @param projectDisplayName - Human-readable project name used in the attached-session message.
331+
* @param sessionId - Existing backend terminal session identifier to load and attach.
332+
* @param context - Browser action context used for selection, busy state, and terminal tab updates.
333+
* @returns Nothing; state changes are emitted through `context`.
334+
* @pure false
335+
* @effect BrowserActionContext and `loadProjectTerminalSession` Effect.
336+
* @invariant A terminal tab is added only after `loadProjectTerminalSession` succeeds.
337+
* @precondition `sessionId` names an existing terminal session for the resolved project key.
338+
* @postcondition On success, the project is selected and the loaded session is added to terminal tabs.
339+
* @complexity O(1) setup plus O(1) backend session load.
340+
* @throws Never
341+
*/
342+
// CHANGE: document the existing-session attach shell contract
343+
// WHY: CodeRabbit review requires explicit side-effect and invariant metadata for exported TS functions
344+
// QUOTE(ТЗ): "Add a TSDoc comment block above the exported function attachProjectTerminalById"
345+
// REF: PR #342 CodeRabbit review
346+
// SOURCE: n/a
347+
// FORMAT THEOREM: resolvedProjectKey != null && load(sessionId) succeeds -> terminalTab(sessionId) is added
348+
// PURITY: SHELL
349+
// EFFECT: Effect<TerminalSession, string> via loadProjectTerminalSession plus BrowserActionContext mutations
350+
// INVARIANT: no terminal tab is added when project key resolution fails or session load fails
351+
// COMPLEXITY: O(1) setup plus O(1) backend session load
325352
export const attachProjectTerminalById = (
326353
projectId: string,
327354
projectKey: string,

scripts/e2e/browser-command.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ wait_for_http_contains() {
116116
local body=""
117117

118118
for _ in $(seq 1 "$attempts"); do
119-
if body="$(curl -fsS "$url" 2>/dev/null)" && grep -Fq -- "$needle" <<<"$body"; then
119+
if body="$(curl -fsS --connect-timeout 2 --max-time 5 "$url" 2>/dev/null)" \
120+
&& grep -Fq -- "$needle" <<<"$body"; then
120121
return 0
121122
fi
122123
if ! browser_alive; then

0 commit comments

Comments
 (0)