Files
cleveragents-core/robot/architecture.robot
freemo 64e606099c fix(test): convert soft warnings to hard failures in architecture test
Replace Run Keyword And Return Status soft checks with direct assertions
in three test cases:

- Docstring check now uses Should Contain directly instead of logging
  WARN, so missing docstrings cause a hard test failure.
- Settings file (config/settings.py) existence is now a hard File Should
  Exist assertion instead of a conditional that silently skips all
  checks when the file is absent.
- Exceptions file (core/exceptions.py) existence is now a hard File
  Should Exist assertion instead of a conditional that silently skips
  the exception hierarchy checks when the file is absent.
2026-03-14 03:33:37 +00:00

104 lines
4.4 KiB
Plaintext

*** Settings ***
Documentation Architecture and dependency validation tests
Library OperatingSystem
Library Collections
Library String
Resource ${CURDIR}/common.resource
*** Variables ***
${SRC_DIR} ${CURDIR}/../src/cleveragents
*** Test Cases ***
Package Structure Should Follow Layered Architecture
[Documentation] Verify package structure matches ADR-001
Directory Should Exist ${SRC_DIR}
# Check main packages exist
Directory Should Exist ${SRC_DIR}/cli
Directory Should Exist ${SRC_DIR}/runtime
Directory Should Exist ${SRC_DIR}/application
Directory Should Exist ${SRC_DIR}/domain
Directory Should Exist ${SRC_DIR}/infrastructure
Directory Should Exist ${SRC_DIR}/providers
Directory Should Exist ${SRC_DIR}/config
Directory Should Exist ${SRC_DIR}/core
Directory Should Exist ${SRC_DIR}/shared
Package Init Files Should Have Docstrings
[Documentation] Verify packages document their responsibilities
@{packages}= List Directories In Directory ${SRC_DIR}
FOR ${package} IN @{packages}
${init_file}= Set Variable ${SRC_DIR}/${package}/__init__.py
${exists}= Run Keyword And Return Status File Should Exist ${init_file}
IF ${exists}
${content}= Get File ${init_file}
Should Contain ${content} """ Missing docstring in ${package}/__init__.py
END
END
Development Tools Should Be Configured
[Documentation] Verify development tools are properly configured
File Should Exist ${CURDIR}/../pyproject.toml
File Should Exist ${CURDIR}/../noxfile.py
# Check tool configurations in pyproject.toml
${pyproject}= Get File ${CURDIR}/../pyproject.toml
Should Contain ${pyproject} [tool.ruff]
Should Contain ${pyproject} [tool.pyright]
Should Contain ${pyproject} [tool.coverage]
Should Contain ${pyproject} [tool.hatch]
Modern Tooling Should Be Used
[Documentation] Verify no legacy helper scripts - using modern tooling instead
# Verify we're NOT using legacy scripts (intentionally removed)
File Should Not Exist ${CURDIR}/../scripts/install.py
File Should Not Exist ${CURDIR}/../scripts/sync.py
# Verify modern tooling configuration exists
${pyproject}= Get File ${CURDIR}/../pyproject.toml
Should Contain ${pyproject} [tool.hatch] Modern build backend (Hatch) should be configured
Should Contain ${pyproject} [project.optional-dependencies] Dependency groups should be defined
Type Marker Should Exist
[Documentation] Verify py.typed marker for type hints
File Should Exist ${SRC_DIR}/py.typed
Configuration Should Use CLEVERAGENTS Prefix
[Documentation] Verify environment variables use correct prefix
${settings_file}= Set Variable ${SRC_DIR}/config/settings.py
File Should Exist ${settings_file}
${content}= Get File ${settings_file}
# Check for CLEVERAGENTS_ prefix
${matches}= Get Regexp Matches ${content} CLEVERAGENTS_[A-Z_]+
${count}= Get Length ${matches}
Should Be True ${count} > 0 No CLEVERAGENTS_ variables found in settings
Core Exception Hierarchy Should Be Defined
[Documentation] Verify exception hierarchy from ADR-005
${exceptions_file}= Set Variable ${SRC_DIR}/core/exceptions.py
File Should Exist ${exceptions_file}
${content}= Get File ${exceptions_file}
Should Contain ${content} class CleverAgentsError
Should Contain ${content} class DomainError
Should Contain ${content} class InfrastructureError
Should Contain ${content} class ValidationError
*** Keywords ***
List Files In Directory
[Arguments] ${directory} ${pattern}=*
@{files}= OperatingSystem.List Files In Directory ${directory} ${pattern}
RETURN @{files}
List Directories In Directory
[Arguments] ${directory}
@{items}= List Directory ${directory}
@{dirs}= Create List
FOR ${item} IN @{items}
${path}= Set Variable ${directory}/${item}
${is_dir}= Run Keyword And Return Status Directory Should Exist ${path}
IF ${is_dir} and not '${item}'.startswith('__')
Append To List ${dirs} ${item}
END
END
RETURN @{dirs}