Files
cleveragents-core/features/plan_ulid_validation.feature
CoreRasurae cc24d8c8ac fix(cli): remove legacy plan commands from help output
Completely removed all legacy plan commands from the CLI:
    - Removed tell, build, new, current, cd, continue CLI commands
    - Removed programmatic wrapper functions (tell_command, build_command, etc.)
    - Removed legacy deprecation message
    - Updated help text to indicate V3 Plan Lifecycle exclusively
    - Removed stale references to tell/build in help output and command validation

    Removes the legacy 'tell' and 'build' CLI shortcuts from main.py:
    - Removed echo lines advertising tell/build commands
    - Removed tell/build from valid_cmds list
    - Removed tell/build from _LIGHTWEIGHT_COMMANDS frozenset
    - These dead entries were preventing helpful error messages

    Test infrastructure improvements:
    - Event bus exception test: Patch the module-level logger during emit() so that
      structlog.testing.capture_logs() can capture the logs. Without patching, the
      module-level logger created at import time is not captured by the context manager.
    - Session create/list commands: Suppress cleveragents.mcp logger to CRITICAL level
      during JSON/YAML output formatting to prevent health check warnings with ANSI codes
      from being written to stdout before JSON output, which breaks JSON parsing.
    - Extended plan_cli_coverage_boost with scenarios for estimation_result,
      invariants, execution_environment, validation_summary, and checkpoint
      coverage in _plan_spec_dict

    Documentation:
    - Created docs/Legacy_to_V3_Guide.md with comprehensive migration instructions
    - Updated CONTRIBUTING.md to document removal of legacy workflow
    - Updated CHANGELOG.md to reference issue #4181 instead of PR #10800

ISSUES CLOSED: #4181
2026-05-05 02:01:49 +00:00

127 lines
6.2 KiB
Gherkin

Feature: ULID validation for v3 plan commands
As a CleverAgents user
I want clear, actionable error messages when I accidentally mix legacy and v3 plan workflows
So that I understand the incompatibility and know how to fix it
# ===================================================================
# _validate_plan_ulid unit tests
# ===================================================================
Scenario: _validate_plan_ulid accepts a valid ULID
When I call _validate_plan_ulid with "01HXM8C2ZK4Q7C2B3F2R4VYV6J"
Then ulid-val the validation should succeed and return "01HXM8C2ZK4Q7C2B3F2R4VYV6J"
Scenario: _validate_plan_ulid accepts a valid ULID in lowercase
When I call _validate_plan_ulid with "01hxm8c2zk4q7c2b3f2r4vyv6j"
Then ulid-val the validation should succeed and return "01hxm8c2zk4q7c2b3f2r4vyv6j"
Scenario: _validate_plan_ulid rejects a legacy plan name
When I call _validate_plan_ulid with "64-bit port plan"
Then ulid-val the validation should raise ValidationError
And ulid-val the error message should contain "not found"
And ulid-val the error message should contain "ULID"
And ulid-val the error message should contain "legacy"
And ulid-val the error message should contain "agents plan use"
Scenario: _validate_plan_ulid rejects a plain string that is not a ULID
When I call _validate_plan_ulid with "not-a-ulid"
Then ulid-val the validation should raise ValidationError
And ulid-val the error message should contain "ULID"
Scenario: _validate_plan_ulid rejects a string that is too short
When I call _validate_plan_ulid with "01ARZ3NDEK"
Then ulid-val the validation should raise ValidationError
And ulid-val the error message should contain "ULID"
Scenario: _validate_plan_ulid rejects a string that is too long
When I call _validate_plan_ulid with "01ARZ3NDEKTSV4RRFFQ69G5FAAEXTRA"
Then ulid-val the validation should raise ValidationError
And ulid-val the error message should contain "ULID"
Scenario: _validate_plan_ulid rejects a ULID with invalid characters (I, L, O, U)
When I call _validate_plan_ulid with "01ARZ3NDEKTSV4RRFFQ69G5FII"
Then ulid-val the validation should raise ValidationError
And ulid-val the error message should contain "ULID"
# ===================================================================
# agents plan execute — ULID validation
# ===================================================================
Scenario: plan execute rejects a legacy plan name with actionable error
Given a ulid-validation CLI runner
When I invoke ulid-validation plan execute with "my-legacy-plan"
Then the ulid-validation command should abort
And the ulid-validation output should contain "not found"
And the ulid-validation output should contain "ULID"
And the ulid-validation output should contain "legacy"
And the ulid-validation output should contain "agents plan use"
Scenario: plan execute rejects a non-ULID string with actionable error
Given a ulid-validation CLI runner
When I invoke ulid-validation plan execute with "not-a-valid-id"
Then the ulid-validation command should abort
And the ulid-validation output should contain "ULID"
Scenario: plan execute accepts a valid ULID and proceeds normally
Given a ulid-validation CLI runner
And a mocked lifecycle service for ulid-validation execute
When I invoke ulid-validation plan execute with "01HXM8C2ZK4Q7C2B3F2R4VYV6J"
Then the ulid-validation command should not abort due to ULID validation
# ===================================================================
# agents plan apply — ULID validation
# ===================================================================
Scenario: plan apply rejects a legacy plan name with actionable error
Given a ulid-validation CLI runner
When I invoke ulid-validation plan apply with "my-legacy-plan"
Then the ulid-validation command should abort
And the ulid-validation output should contain "not found"
And the ulid-validation output should contain "ULID"
And the ulid-validation output should contain "legacy"
Scenario: plan apply rejects a non-ULID string with actionable error
Given a ulid-validation CLI runner
When I invoke ulid-validation plan apply with "not-a-valid-id"
Then the ulid-validation command should abort
And the ulid-validation output should contain "ULID"
# ===================================================================
# agents plan status — ULID validation
# ===================================================================
Scenario: plan status rejects a legacy plan name with actionable error
Given a ulid-validation CLI runner
And a mocked lifecycle service for ulid-validation status
When I invoke ulid-validation plan status with "my-legacy-plan"
Then the ulid-validation command should abort
And the ulid-validation output should contain "ULID"
And the ulid-validation output should contain "legacy"
Scenario: plan status rejects a non-ULID string with actionable error
Given a ulid-validation CLI runner
And a mocked lifecycle service for ulid-validation status
When I invoke ulid-validation plan status with "not-a-valid-id"
Then the ulid-validation command should abort
And the ulid-validation output should contain "ULID"
# ===================================================================
# agents plan errors — ULID validation
# ===================================================================
Scenario: plan errors rejects a legacy plan name with actionable error
Given a ulid-validation CLI runner
When I invoke ulid-validation plan errors with "my-legacy-plan"
Then the ulid-validation command should abort
And the ulid-validation output should contain "ULID"
# ===================================================================
# agents plan cancel — ULID validation
# ===================================================================
Scenario: plan cancel rejects a legacy plan name with actionable error
Given a ulid-validation CLI runner
When I invoke ulid-validation plan cancel with "my-legacy-plan"
Then the ulid-validation command should abort
And the ulid-validation output should contain "ULID"