Files
temp/robot/actor_add_yaml_first_path.robot
freemo 62ded31c24 fix(cli): route 'agents actor add' through ActorRegistry.add() YAML-first path
Route the 'agents actor add' CLI command through ActorRegistry.add() instead
of the legacy registry.upsert_actor() path. This ensures the original YAML
text, schema_version, and compiled_metadata are preserved in the database.

Changes:
- src/cleveragents/cli/commands/actor.py: Add _load_config_text() helper that
  returns both raw text and parsed dict. Refactor add() to call registry.add()
  with the raw yaml_text and update=update_existing flag when a registry is
  available. The service fallback path (no registry) is unchanged.
- features/steps/actor_cli_steps.py: Update add command step definitions to
  mock registry.add() instead of registry.upsert_actor(). Update 'the actor
  add should pass the loaded config' assertion to verify registry.add() is
  called with a non-empty yaml_text string.
- features/steps/actor_cli_yaml_steps.py: Update add command steps to mock
  registry.add() instead of registry.upsert_actor().
- features/steps/actor_add_rich_output_steps.py: Update add command steps to
  mock registry.add() instead of registry.upsert_actor().
- robot/helper_actor_add_rich_output.py: Update helper to mock registry.add()
  instead of registry.upsert_actor().
- features/actor_add_yaml_first_path.feature: New Behave feature verifying
  the YAML-first persistence path is used by actor add.
- features/steps/actor_add_yaml_first_path_steps.py: Step definitions for
  the new YAML-first path feature.
- robot/actor_add_yaml_first_path.robot: New Robot integration tests verifying
  yaml_text is preserved and upsert_actor is not called.
- robot/helper_actor_add_yaml_first_path.py: Helper script for Robot tests.

Fixes #3426

ISSUES CLOSED: #3426
2026-04-05 21:19:40 +00:00

53 lines
2.5 KiB
Plaintext

*** Settings ***
Documentation Integration tests verifying that ``agents actor add`` routes through
... ActorRegistry.upsert_actor() with yaml_text threaded through, preserving
... the original YAML text in the database while honouring all CLI flags.
Library OperatingSystem
Library Collections
Library Process
*** Variables ***
${PYTHON} python
${HELPER} ${CURDIR}/helper_actor_add_yaml_first_path.py
*** Test Cases ***
Actor Add Preserves yaml_text Via Registry upsert_actor
[Documentation] Verify that ``actor add`` calls ActorRegistry.upsert_actor() with
... yaml_text so the original YAML text is preserved in the database.
${result}= Run Process ${PYTHON} ${HELPER} yaml_text_preserved
... stdout=PIPE stderr=PIPE
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} yaml-text-preserved-ok
Actor Add With set-default Flag Passes set_default=True To Registry
[Documentation] Verify that ``actor add --set-default`` passes set_default=True
... to ActorRegistry.upsert_actor() so the actor is set as default.
${result}= Run Process ${PYTHON} ${HELPER} set_default_flag
... stdout=PIPE stderr=PIPE
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} set-default-flag-ok
Actor Add With option Flag Passes option_overrides To Registry
[Documentation] Verify that ``actor add --option key=value`` passes option_overrides
... to ActorRegistry.upsert_actor() so the override is applied.
${result}= Run Process ${PYTHON} ${HELPER} option_override_flag
... stdout=PIPE stderr=PIPE
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} option-override-flag-ok
Actor Add With Update Flag Calls Registry upsert_actor
[Documentation] Verify that ``actor add --update`` calls registry.upsert_actor()
... (upsert semantics handle the update case).
${result}= Run Process ${PYTHON} ${HELPER} update_flag
... stdout=PIPE stderr=PIPE
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} update-flag-ok