|
| 1 | +## ADDED Requirements |
| 2 | + |
| 3 | +### Requirement: Declare an environment setup script |
| 4 | +The system SHALL accept an optional inline `config.setup_script` string for an Environment and SHALL reject scripts whose UTF-8 representation exceeds 65,536 bytes. |
| 5 | + |
| 6 | +#### Scenario: Valid multiline script |
| 7 | +- **WHEN** a cloud or self-hosted Environment declares a multiline setup script within the byte limit |
| 8 | +- **THEN** configuration parsing succeeds and preserves the script exactly |
| 9 | + |
| 10 | +#### Scenario: Oversized Unicode script |
| 11 | +- **WHEN** an Environment setup script exceeds 65,536 UTF-8 bytes |
| 12 | +- **THEN** validation fails locally before any provider request is made |
| 13 | + |
| 14 | +### Requirement: Enforce provider setup-script support |
| 15 | +The system SHALL send setup scripts only to providers that support them and SHALL report an actionable validation error for managed environments targeting an unsupported provider. |
| 16 | + |
| 17 | +#### Scenario: Qoder managed environment |
| 18 | +- **WHEN** a managed Qoder cloud or self-hosted Environment declares a setup script |
| 19 | +- **THEN** the script is included in the provider Environment config |
| 20 | + |
| 21 | +#### Scenario: Unsupported provider |
| 22 | +- **WHEN** a managed Environment targeting another provider declares a setup script |
| 23 | +- **THEN** validation reports that the provider does not support environment setup scripts |
| 24 | + |
| 25 | +#### Scenario: External environment reference |
| 26 | +- **WHEN** an externally managed Environment declaration contains a provider ID |
| 27 | +- **THEN** OpenAgentPack does not attempt to mutate that Environment |
| 28 | + |
| 29 | +### Requirement: Reconcile Qoder setup scripts |
| 30 | +The system SHALL preserve Qoder setup scripts through create, update, remote readback, sync/export, and drift comparison. |
| 31 | + |
| 32 | +#### Scenario: Script changes |
| 33 | +- **WHEN** a declared setup script differs from the current Qoder Environment |
| 34 | +- **THEN** planning reports an Environment update and applying it sends the complete desired config |
| 35 | + |
| 36 | +#### Scenario: Script converges |
| 37 | +- **WHEN** the remote Qoder Environment contains the declared setup script |
| 38 | +- **THEN** subsequent planning reports no setup-script drift |
| 39 | + |
| 40 | +#### Scenario: Script removal |
| 41 | +- **WHEN** a previously configured setup script is removed from the declaration |
| 42 | +- **THEN** the Qoder Environment is updated so future Sessions no longer execute it |
| 43 | + |
| 44 | +### Requirement: Follow the Qoder Environment API contract |
| 45 | +The system SHALL update Qoder Environments with the documented POST operation, SHALL converge metadata deletions, and SHALL reject writable package declarations not accepted by Qoder. |
| 46 | + |
| 47 | +#### Scenario: Environment update |
| 48 | +- **WHEN** an owned Qoder Environment changes |
| 49 | +- **THEN** OpenAgentPack sends POST to the Environment resource with a complete config |
| 50 | + |
| 51 | +#### Scenario: Metadata key removed |
| 52 | +- **WHEN** a user metadata key previously present remotely is removed from the declaration |
| 53 | +- **THEN** the update sends a null tombstone for that key and preserves management metadata |
| 54 | + |
| 55 | +#### Scenario: Unsupported Qoder package manager |
| 56 | +- **WHEN** a Qoder Environment declares a non-empty `cargo`, `gem`, or `go` package list |
| 57 | +- **THEN** validation fails before apply with an actionable diagnostic |
| 58 | + |
| 59 | +#### Scenario: Response defaults |
| 60 | +- **WHEN** Qoder returns response-only package type fields, reserved package arrays, or empty writable arrays |
| 61 | +- **THEN** normalization omits them from comparison unless they correspond to a declared writable package value |
0 commit comments