Files
cleveragents-core/features/sandbox_factory_coverage.feature
T
CoreRasurae f2f7aa5dc9 feat(core): add v3 lifecycle models, automation levels, subplan support, and security hardening
Implement multiple Stage A/B/E/SEC milestones for the v3 lifecycle system:
- Stage A5.3+A5.4: Add LifecycleActionModel and LifecyclePlanModel SQLAlchemy
  models with to_domain()/from_domain() conversion methods
- Stage A5.6: Implement ActionRepository with full CRUD, namespace/state
  queries, referential integrity checks, and retry decorator
- Stage E1: Add subplan domain models (ExecutionMode, SubplanMergeStrategy,
  SubplanConfig, SubplanStatus, SubplanAttempt, SubplanFailureHandler) with
  computed properties on Plan (is_subplan, is_root_plan, depth, has_subplans)
- Stage A6: Add AutomationLevel enum (MANUAL, REVIEW_BEFORE_APPLY,
  FULL_AUTOMATION), settings integration, PlanLifecycleService auto-progression,
  pause/resume, and CLI commands (--automation-level, set-automation-level)
- Stage SEC1: Remove eval()/exec() from stream_router.py, replace with named
  operation and transform registries; code blocks and unregistered transforms
  now raise StreamRoutingError
- Add langchain-anthropic dependency
- Update BDD tests for security changes and relax ADR directory requirement
2026-02-12 20:19:42 +00:00

119 lines
5.8 KiB
Gherkin

@phase1 @infrastructure @sandbox @factory
Feature: Sandbox factory strategy routing
As a system that creates isolated environments for different resource types
I want a factory that routes strategy requests to the correct sandbox implementation
So that each resource gets the appropriate isolation mechanism or a clear rejection
# --- Input validation ---
Scenario: The factory rejects an empty resource identifier
Given the sandbox factory is available
When a sandbox is requested with an empty resource identifier
Then the factory should reject the request due to a missing resource identifier
Scenario: The factory rejects an empty resource path
Given the sandbox factory is available
When a sandbox is requested with an empty resource path
Then the factory should reject the request due to a missing resource path
# --- None strategy (passthrough) ---
Scenario: The none strategy produces a passthrough sandbox
Given the sandbox factory is available
When a sandbox is requested for resource "web-api" at "/srv/api" using the none strategy
Then the factory should produce a passthrough sandbox
And the produced sandbox should be in the pending state
# --- Unimplemented strategies ---
Scenario: The git worktree strategy is not yet available
Given the sandbox factory is available
When a sandbox is requested for resource "repo-1" at "/src/repo" using the git worktree strategy
Then the factory should indicate the strategy is not yet implemented
Scenario: The copy-on-write strategy is not yet available
Given the sandbox factory is available
When a sandbox is requested for resource "docs" at "/srv/docs" using the copy-on-write strategy
Then the factory should indicate the strategy is not yet implemented
Scenario: The overlay strategy is not yet available
Given the sandbox factory is available
When a sandbox is requested for resource "fs-root" at "/mnt/data" using the overlay strategy
Then the factory should indicate the strategy is not yet implemented
Scenario: The transaction rollback strategy is not yet available
Given the sandbox factory is available
When a sandbox is requested for resource "db-main" at "postgres://db/main" using the transaction rollback strategy
Then the factory should indicate the strategy is not yet implemented
Scenario: The versioning strategy is not yet available
Given the sandbox factory is available
When a sandbox is requested for resource "corpus" at "/srv/corpus" using the versioning strategy
Then the factory should indicate the strategy is not yet implemented
# --- Unknown strategy ---
Scenario: An unrecognised strategy name is rejected
Given the sandbox factory is available
When a sandbox is requested for resource "misc" at "/tmp/misc" using an unrecognised strategy
Then the factory should reject the request due to an unknown strategy
# --- Support checks ---
Scenario: The none strategy is reported as supported
Given the sandbox factory is available
When the factory is asked whether the none strategy is supported
Then the factory should confirm the strategy is supported
Scenario: The git worktree strategy is reported as unsupported
Given the sandbox factory is available
When the factory is asked whether the git worktree strategy is supported
Then the factory should indicate the strategy is not supported
Scenario: The copy-on-write strategy is reported as unsupported
Given the sandbox factory is available
When the factory is asked whether the copy-on-write strategy is supported
Then the factory should indicate the strategy is not supported
Scenario: An unrecognised strategy is reported as unsupported
Given the sandbox factory is available
When the factory is asked whether an unrecognised strategy is supported
Then the factory should indicate the strategy is not supported
# --- Resource type strategy lookup ---
Scenario: A git repository supports worktree, copy-on-write, and none strategies
Given the sandbox factory is available
When the compatible strategies for a "git_repository" resource are queried
Then the factory should return git worktree, copy-on-write, and none as compatible
Scenario: A filesystem resource supports copy-on-write, overlay, and none strategies
Given the sandbox factory is available
When the compatible strategies for a "filesystem" resource are queried
Then the factory should return copy-on-write, overlay, and none as compatible
Scenario: A database resource supports transaction rollback and none strategies
Given the sandbox factory is available
When the compatible strategies for a "database" resource are queried
Then the factory should return transaction rollback and none as compatible
Scenario: An API endpoint only supports the none strategy
Given the sandbox factory is available
When the compatible strategies for an "api_endpoint" resource are queried
Then the factory should return only the none strategy as compatible
Scenario: A document corpus supports copy-on-write and none strategies
Given the sandbox factory is available
When the compatible strategies for a "document_corpus" resource are queried
Then the factory should return copy-on-write and none as compatible
Scenario: Cloud infrastructure only supports the none strategy
Given the sandbox factory is available
When the compatible strategies for a "cloud_infrastructure" resource are queried
Then the factory should return only the none strategy as compatible
Scenario: An unknown resource type falls back to the none strategy
Given the sandbox factory is available
When the compatible strategies for an unknown resource type are queried
Then the factory should return only the none strategy as compatible