forked from HAL9000/cleveragents-core
491781714f
Before calling upsert_actor(), check if the actor already exists using registry.get_actor() or service.get_actor(). If the actor exists and update_existing is False, print the spec-required error panel and exit with error code 1. Error panel includes: - Actor name - Registration timestamp (formatted as YYYY-MM-DD HH:MM) - Hint to use --update flag Adds Behave tests for: - Duplicate-without-update failure case (exit code 1, error panel shown) - Duplicate-with-update success case (exit code 0, actor updated) - New actor without --update success case (exit code 0, actor added) ISSUES CLOSED: #2609
38 lines
2.0 KiB
Gherkin
38 lines
2.0 KiB
Gherkin
# Regression tests for bug #2609: actor add must reject re-adding an existing
|
|
# actor unless --update is provided.
|
|
Feature: agents actor add enforces --update flag for existing actors
|
|
As a user of the CleverAgents CLI
|
|
I want `agents actor add` to fail with a clear error when re-adding an existing actor
|
|
So that I cannot accidentally overwrite actor configurations without explicit intent
|
|
|
|
@tdd_issue @tdd_issue_2609
|
|
Scenario: Re-adding an existing actor without --update fails with error panel
|
|
Given an actor add CLI runner where the actor already exists
|
|
When I run actor add without the --update flag
|
|
Then the actor-add-enforcement exit code should be 1
|
|
And the actor-add-enforcement output should contain an error panel with "Actor already exists"
|
|
And the actor-add-enforcement output should contain "Use --update to replace the existing actor definition"
|
|
And the actor-add-enforcement output should contain the registration timestamp
|
|
|
|
@tdd_issue @tdd_issue_2609
|
|
Scenario: Re-adding an existing actor without --update shows error status line
|
|
Given an actor add CLI runner where the actor already exists
|
|
When I run actor add without the --update flag
|
|
Then the actor-add-enforcement exit code should be 1
|
|
And the actor-add-enforcement output should contain "Actor already registered"
|
|
And the actor-add-enforcement output should contain "use --update to replace"
|
|
|
|
@tdd_issue @tdd_issue_2609
|
|
Scenario: Re-adding an existing actor with --update succeeds
|
|
Given an actor add CLI runner where the actor already exists
|
|
When I run actor add with the --update flag
|
|
Then the actor-add-enforcement exit code should be 0
|
|
And the actor-add-enforcement output should contain "Actor updated"
|
|
|
|
@tdd_issue @tdd_issue_2609
|
|
Scenario: Adding a new actor without --update succeeds
|
|
Given an actor add CLI runner where the actor does not exist
|
|
When I run actor add without the --update flag
|
|
Then the actor-add-enforcement exit code should be 0
|
|
And the actor-add-enforcement output should contain "Actor added"
|