Class ActionNameCollisionValidator
- All Implemented Interfaces:
Validator
@ActionSpec method names must be unique across
every role attached to an agent.
The framework dispatches actions by name (see
ActionExecutor). When two roles each
declare an action with the same name, the executor's name → action
map silently keeps whichever role was registered last; the earlier
one is shadowed. The runtime symptom is "the wrong implementation
ran" — a class of bug that's painful to track down because nothing
ever throws and nothing logs the shadowing.
This validator collects every
invalid reference
ActionMetadata#getName()Role.getActions(), groups by name, and emits one
ERROR per duplicated name. The error context lists every offending
role class so the operator can see at a glance which roles need to
disambiguate.
Intra-role duplicates are impossible — Java method dispatch
already prevents two methods with the same name from coexisting
after annotation processing collapses to ActionMetadata.
The check here is strictly cross-role.
Empty action names are skipped — they indicate a metadata bug elsewhere (probably the discovery layer) and would produce noise rather than signal in this report.
Suppress with AgentBuilder.relaxValidation("AGENT-V008")
— useful when the operator has wired an
ActionExecutor subclass that disambiguates
by role+name (rare but legitimate, e.g. multi-tenant role isolation).
- Since:
- 0.5.0 (issue #85 slice)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionid()Short, stable id for logging and test assertions (e.g.Inspect the agent configuration and return any issues detected.
-
Constructor Details
-
ActionNameCollisionValidator
public ActionNameCollisionValidator()
-
-
Method Details
-
id
Description copied from interface:ValidatorShort, stable id for logging and test assertions (e.g."llm-presence"). -
validate
Description copied from interface:ValidatorInspect the agent configuration and return any issues detected. Returning an empty list means "no problems found by this validator".
-