a05f4c69a7
CI / lint (pull_request) Failing after 19s
CI / typecheck (pull_request) Successful in 46s
CI / quality (pull_request) Successful in 34s
CI / security (pull_request) Successful in 1m0s
CI / coverage (pull_request) Has been skipped
CI / build (pull_request) Successful in 17s
CI / helm (pull_request) Successful in 22s
CI / unit_tests (pull_request) Successful in 7m9s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 17m9s
CI / integration_tests (pull_request) Failing after 23m2s
CI / status-check (pull_request) Failing after 2s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
Extend DevcontainerDiscoveryResult and discover_devcontainers() to scan .devcontainer/<name>/devcontainer.json patterns (one subdirectory level) in addition to the existing fixed paths. Each named configuration produces a distinct result with config_name set to the subdirectory name (e.g. 'api', 'frontend'). Root-level configs retain config_name=None. - Replace _SCAN_PATHS with _FIXED_SCAN_PATHS for root-level configs - Add glob-based scan of .devcontainer/<name>/devcontainer.json - Add config_name: str | None attribute to DevcontainerDiscoveryResult - Validate config_name (must be non-empty str or None) - Add 8 new Behave scenarios covering named, multiple, mixed, empty cases - Add 4 new Robot Framework integration tests for named config discovery - All existing tests continue to pass (no regression) ISSUES CLOSED: #2615
165 lines
7.9 KiB
Gherkin
165 lines
7.9 KiB
Gherkin
Feature: Devcontainer Resource Handler
|
|
As a CleverAgents developer
|
|
I want devcontainer resources to be auto-discovered and manually registered
|
|
So that devcontainer environments integrate into the resource model
|
|
|
|
# ── Manual registration ────────────────────────────────────
|
|
|
|
Scenario: Register devcontainer-instance manually
|
|
Given a temporary directory with a valid devcontainer.json
|
|
When I create a devcontainer-instance resource at that path
|
|
Then the resource should have type "devcontainer-instance"
|
|
And the resource should have a non-empty resource_id
|
|
|
|
Scenario: Register container-instance manually
|
|
When I create a container-instance resource with image "ubuntu:latest"
|
|
Then the container resource should have type "container-instance"
|
|
|
|
# ── Auto-discovery from git resource ───────────────────────
|
|
|
|
Scenario: Auto-discover devcontainer from git-checkout resource
|
|
Given a temporary directory simulating a git checkout
|
|
And the directory has a .devcontainer/devcontainer.json file
|
|
When I run devcontainer discovery on the directory as "git-checkout"
|
|
Then discovery should return 1 result
|
|
And the discovered config path should end with "devcontainer.json"
|
|
|
|
Scenario: Auto-discover root devcontainer.json from git-checkout
|
|
Given a temporary directory simulating a git checkout
|
|
And the directory has a root .devcontainer.json file
|
|
When I run devcontainer discovery on the directory as "git-checkout"
|
|
Then discovery should return 1 result
|
|
|
|
Scenario: Auto-discover both devcontainer locations
|
|
Given a temporary directory simulating a git checkout
|
|
And the directory has a .devcontainer/devcontainer.json file
|
|
And the directory has a root .devcontainer.json file
|
|
When I run devcontainer discovery on the directory as "git-checkout"
|
|
Then discovery should return 2 results
|
|
|
|
# ── Auto-discovery from filesystem resource ─────────────────
|
|
|
|
Scenario: Auto-discover devcontainer from fs-directory resource
|
|
Given a temporary directory simulating a filesystem mount
|
|
And the directory has a .devcontainer/devcontainer.json file
|
|
When I run devcontainer discovery on the directory as "fs-directory"
|
|
Then discovery should return 1 result
|
|
|
|
Scenario: No discovery for non-trigger resource types
|
|
Given a temporary directory simulating a filesystem mount
|
|
And the directory has a .devcontainer/devcontainer.json file
|
|
When I run devcontainer discovery on the directory as "fs-file"
|
|
Then discovery should return 0 results
|
|
|
|
# ── Invalid devcontainer.json handling ──────────────────────
|
|
|
|
Scenario: Skip invalid JSON in devcontainer.json
|
|
Given a temporary directory with an invalid devcontainer.json
|
|
When I run devcontainer discovery on the directory as "git-checkout"
|
|
Then discovery should return 0 results
|
|
|
|
Scenario: Skip non-object JSON in devcontainer.json
|
|
Given a temporary directory with a non-object devcontainer.json
|
|
When I run devcontainer discovery on the directory as "git-checkout"
|
|
Then discovery should return 0 results
|
|
|
|
Scenario: Handle missing devcontainer directory gracefully
|
|
Given a temporary directory with no devcontainer configuration
|
|
When I run devcontainer discovery on the directory as "git-checkout"
|
|
Then discovery should return 0 results
|
|
|
|
# ── Resource tree display ──────────────────────────────────
|
|
|
|
Scenario: Devcontainer types appear in resource type list
|
|
Given the built-in resource type registry
|
|
When I list all built-in type names
|
|
Then the type list should contain "devcontainer-instance"
|
|
And the type list should contain "devcontainer-file"
|
|
And the type list should contain "container-instance"
|
|
|
|
# ── Handler protocol conformance ───────────────────────────
|
|
|
|
Scenario: DevcontainerHandler satisfies ResourceHandler protocol
|
|
When I instantiate DevcontainerHandler
|
|
Then it should satisfy the ResourceHandler protocol
|
|
|
|
Scenario: DevcontainerHandler has correct default strategy
|
|
When I instantiate DevcontainerHandler
|
|
Then its default strategy should be "none"
|
|
|
|
Scenario: DevcontainerHandler has correct type label
|
|
When I instantiate DevcontainerHandler
|
|
Then its type label should be "devcontainer"
|
|
|
|
# ── Discovery result validation ────────────────────────────
|
|
|
|
Scenario: Discovery result requires valid config_path
|
|
When I create a discovery result with valid parameters
|
|
Then the result should have a config_path attribute
|
|
|
|
Scenario: Discovery result rejects empty parent_location
|
|
When I create a discovery result with empty parent_location
|
|
Then it should raise a ValueError
|
|
|
|
# ── Named configuration discovery (monorepo support) ──────
|
|
|
|
Scenario: Auto-discover named devcontainer configuration
|
|
Given a temporary directory simulating a git checkout
|
|
And the directory has a named devcontainer configuration "api"
|
|
When I run devcontainer discovery on the directory as "git-checkout"
|
|
Then discovery should return 1 result
|
|
And the first result should have config name "api"
|
|
|
|
Scenario: Auto-discover multiple named devcontainer configurations
|
|
Given a temporary directory simulating a git checkout
|
|
And the directory has a named devcontainer configuration "api"
|
|
And the directory has a named devcontainer configuration "frontend"
|
|
When I run devcontainer discovery on the directory as "git-checkout"
|
|
Then discovery should return 2 results
|
|
And the result config names should include "api"
|
|
And the result config names should include "frontend"
|
|
|
|
Scenario: Auto-discover mixed root and named devcontainer configurations
|
|
Given a temporary directory simulating a git checkout
|
|
And the directory has a .devcontainer/devcontainer.json file
|
|
And the directory has a named devcontainer configuration "api"
|
|
When I run devcontainer discovery on the directory as "git-checkout"
|
|
Then discovery should return 2 results
|
|
|
|
Scenario: Root devcontainer.json has no config name
|
|
Given a temporary directory simulating a git checkout
|
|
And the directory has a .devcontainer/devcontainer.json file
|
|
When I run devcontainer discovery on the directory as "git-checkout"
|
|
Then discovery should return 1 result
|
|
And the first result should have no config name
|
|
|
|
Scenario: Root .devcontainer.json has no config name
|
|
Given a temporary directory simulating a git checkout
|
|
And the directory has a root .devcontainer.json file
|
|
When I run devcontainer discovery on the directory as "git-checkout"
|
|
Then discovery should return 1 result
|
|
And the first result should have no config name
|
|
|
|
Scenario: Named config with invalid JSON is skipped
|
|
Given a temporary directory simulating a git checkout
|
|
And the directory has a named devcontainer configuration "broken" with invalid JSON
|
|
When I run devcontainer discovery on the directory as "git-checkout"
|
|
Then discovery should return 0 results
|
|
|
|
Scenario: Empty .devcontainer directory returns no results
|
|
Given a temporary directory simulating a git checkout
|
|
And the directory has an empty .devcontainer directory
|
|
When I run devcontainer discovery on the directory as "git-checkout"
|
|
Then discovery should return 0 results
|
|
|
|
# ── is_trigger_type checks ────────────────────────────────
|
|
|
|
Scenario: git-checkout is a trigger type
|
|
Then "git-checkout" should be a trigger type
|
|
|
|
Scenario: fs-directory is a trigger type
|
|
Then "fs-directory" should be a trigger type
|
|
|
|
Scenario: devcontainer-instance is not a trigger type
|
|
Then "devcontainer-instance" should not be a trigger type
|