073013bc61
- Backend: Send ping every 30s from WebSocket endpoint - Frontend: Respond to pings with pongs, detect missed pings (60s timeout) - Update type definitions to include 'resetting' status Refs: persistent-terminal-sessions task 6.4
119 lines
5.9 KiB
Markdown
119 lines
5.9 KiB
Markdown
## ADDED Requirements
|
|
|
|
### Requirement: Profile Ownership And Scope
|
|
The system SHALL manage config profiles as user-owned launch configuration records with optional project and tool type references that derive compatibility scope.
|
|
|
|
#### Scenario: Create portable profile
|
|
- **GIVEN** an authenticated user
|
|
- **WHEN** they create a config profile without a project or tool type
|
|
- **THEN** the profile is stored for that user
|
|
- **AND** the profile is compatible with any project and tool type owned or accessible by that user
|
|
|
|
#### Scenario: Create scoped profile
|
|
- **GIVEN** an authenticated user with access to a project and a tool type
|
|
- **WHEN** they create a config profile with `project_id`, `tool_type_id`, or both
|
|
- **THEN** the profile is stored with those references
|
|
- **AND** compatibility is derived from the non-null references
|
|
|
|
#### Scenario: Reject cross-user references
|
|
- **GIVEN** an authenticated user
|
|
- **WHEN** they create or update a profile with a project, tool type, include, or default reference they cannot access
|
|
- **THEN** the request is rejected
|
|
|
|
### Requirement: Profile Content
|
|
The system SHALL store profile content as plain environment variables, runtime hints, and one or more mount roots containing UTF-8 text files.
|
|
|
|
#### Scenario: Save env vars and runtime hints
|
|
- **GIVEN** an authenticated user editing a config profile
|
|
- **WHEN** they save plain-text environment variables and runtime hints such as start command, working directory, and port
|
|
- **THEN** the system persists those values on the profile
|
|
- **AND** returns them through the profile API
|
|
|
|
#### Scenario: Save mounted text files
|
|
- **GIVEN** an authenticated user editing a config profile
|
|
- **WHEN** they add a mount with an absolute `target_path`, mode `ro` or `rw`, and relative UTF-8 text file paths
|
|
- **THEN** the system persists the mount and files
|
|
- **AND** preserves file content exactly as UTF-8 text
|
|
|
|
#### Scenario: Reject unsafe file paths
|
|
- **GIVEN** an authenticated user editing a config profile mount
|
|
- **WHEN** they submit an absolute file path, an empty relative path, or a relative path containing `..`
|
|
- **THEN** the request is rejected
|
|
|
|
### Requirement: Ordered Profile Includes
|
|
The system SHALL allow a config profile to include other compatible profiles in a deterministic order.
|
|
|
|
#### Scenario: Add ordered includes
|
|
- **GIVEN** an authenticated user with multiple config profiles
|
|
- **WHEN** they configure profile A to include profile B then profile C
|
|
- **THEN** the include order is stored
|
|
- **AND** resolution processes B before C before A
|
|
|
|
#### Scenario: Reject include cycle on save
|
|
- **GIVEN** an authenticated user with profiles A and B where A already includes B
|
|
- **WHEN** they update B to include A
|
|
- **THEN** the request is rejected with a cycle error
|
|
|
|
#### Scenario: Guard against cycle during resolution
|
|
- **GIVEN** stored profile include data contains a cycle
|
|
- **WHEN** the system resolves a selected profile
|
|
- **THEN** resolution fails safely without launching a partially resolved configuration
|
|
|
|
### Requirement: Profile Resolution
|
|
The system SHALL resolve a selected profile by recursively applying included profiles in order and then applying the selected profile itself.
|
|
|
|
#### Scenario: Resolve layered env vars
|
|
- **GIVEN** profile A includes profile B then profile C
|
|
- **AND** B, C, and A define the same environment variable
|
|
- **WHEN** profile A is resolved
|
|
- **THEN** the value from A wins over C and B
|
|
- **AND** the value from C wins over B for keys not set by A
|
|
|
|
#### Scenario: Resolve mount file conflicts
|
|
- **GIVEN** multiple resolved layers define the same mount `target_path`
|
|
- **WHEN** they contain different files under that mount
|
|
- **THEN** their file trees are merged
|
|
- **AND** later layers replace earlier content for the same relative file path
|
|
|
|
#### Scenario: Resolve mount mode conflicts
|
|
- **GIVEN** multiple resolved layers define the same mount `target_path` with different modes
|
|
- **WHEN** the profile is resolved
|
|
- **THEN** the mode from the latest layer wins
|
|
|
|
### Requirement: Profile Defaults
|
|
The system SHALL select the default compatible profile by explicit default specificity, then by first created compatible profile, then no profile.
|
|
|
|
#### Scenario: Choose most specific explicit default
|
|
- **GIVEN** a user has explicit default profiles for global, tool, project, and project+tool scopes
|
|
- **WHEN** they start a matching project/tool combination
|
|
- **THEN** the project+tool default is selected
|
|
- **AND** project, tool, and global defaults are used only when no more-specific explicit default matches
|
|
|
|
#### Scenario: Fall back to first compatible profile
|
|
- **GIVEN** a user has compatible profiles but no explicit matching default
|
|
- **WHEN** they start a session for a project/tool combination
|
|
- **THEN** the oldest compatible profile is selected by default
|
|
|
|
#### Scenario: No compatible profile
|
|
- **GIVEN** a user has no compatible profile for a project/tool combination
|
|
- **WHEN** they start a session
|
|
- **THEN** the default profile selection is `None`
|
|
|
|
### Requirement: Profile Compatibility Filtering
|
|
The system SHALL list compatible config profiles for a selected project and tool type by default.
|
|
|
|
#### Scenario: List compatible profiles
|
|
- **GIVEN** an authenticated user has portable, project-specific, tool-specific, and unrelated profiles
|
|
- **WHEN** the launch UI requests profiles for a selected project and tool type
|
|
- **THEN** the response includes portable profiles and profiles matching that project, tool type, or both
|
|
- **AND** excludes unrelated project-specific or tool-specific profiles
|
|
|
|
### Requirement: Resolved Profile Preview
|
|
The system SHALL expose a resolved profile preview for a selected profile and project/tool context.
|
|
|
|
#### Scenario: Preview resolved output
|
|
- **GIVEN** an authenticated user selects a compatible config profile
|
|
- **WHEN** they request a resolved preview
|
|
- **THEN** the response includes the final environment variables, runtime hints, mount targets, mount modes, and relative file paths
|
|
- **AND** indicates overridden values where practical
|