Files
cleveragents-core/features/settings_missing_spec_fields.feature
freemo da0c5f14b5
CI / lint (pull_request) Successful in 28s
CI / typecheck (pull_request) Successful in 47s
CI / quality (pull_request) Successful in 33s
CI / security (pull_request) Successful in 1m2s
CI / build (pull_request) Successful in 25s
CI / helm (pull_request) Successful in 23s
CI / unit_tests (pull_request) Successful in 6m41s
CI / docker (pull_request) Successful in 1m23s
CI / e2e_tests (pull_request) Successful in 18m32s
CI / coverage (pull_request) Successful in 11m14s
CI / integration_tests (pull_request) Successful in 22m20s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 57m4s
fix(config): add server_url, server_token, format, and default_estimation_actor fields to Settings
Add four spec-required environment variable fields to the Settings class
that were previously missing, causing AttributeError when accessed:

- server_url: str | None — maps to CLEVERAGENTS_SERVER_URL (spec: server.url)
- server_token: str | None — maps to CLEVERAGENTS_SERVER_TOKEN (spec: server.token)
- format: str | None — maps to CLEVERAGENTS_FORMAT (spec: core.format)
- default_estimation_actor: str | None — maps to CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR
  (spec: core.default_estimation_actor)

All fields default to None when the corresponding env var is unset, and
are fully statically typed (no type: ignore). BDD scenarios cover env var
binding, default value, type validation, and model_fields presence for
each new field.

ISSUES CLOSED: #2866
2026-04-05 07:15:48 +00:00

90 lines
4.9 KiB
Gherkin

Feature: Settings class spec-required env var fields
The Settings class must expose fields for all spec-required environment
variables: CLEVERAGENTS_SERVER_URL, CLEVERAGENTS_SERVER_TOKEN,
CLEVERAGENTS_FORMAT, and CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR.
Background:
Given no CleverAgents spec-field env vars are set
# ── server_url ──────────────────────────────────────────────────────────────
Scenario: server_url defaults to None when env var is absent
When I instantiate Settings for spec fields
Then settings.server_url should be None
Scenario: server_url reads CLEVERAGENTS_SERVER_URL from environment
Given the environment variable "CLEVERAGENTS_SERVER_URL" is set to "https://ca.example.com"
When I instantiate Settings for spec fields
Then settings.server_url should be "https://ca.example.com"
Scenario: server_url accepts any string value
Given the environment variable "CLEVERAGENTS_SERVER_URL" is set to "http://localhost:9000"
When I instantiate Settings for spec fields
Then settings.server_url should be "http://localhost:9000"
# ── server_token ─────────────────────────────────────────────────────────────
Scenario: server_token defaults to None when env var is absent
When I instantiate Settings for spec fields
Then settings.server_token should be None
Scenario: server_token reads CLEVERAGENTS_SERVER_TOKEN from environment
Given the environment variable "CLEVERAGENTS_SERVER_TOKEN" is set to "secret-token-abc"
When I instantiate Settings for spec fields
Then settings.server_token should be "secret-token-abc"
Scenario: server_token accepts any string value
Given the environment variable "CLEVERAGENTS_SERVER_TOKEN" is set to "bearer-xyz-789"
When I instantiate Settings for spec fields
Then settings.server_token should be "bearer-xyz-789"
# ── format ───────────────────────────────────────────────────────────────────
Scenario: format defaults to None when env var is absent
When I instantiate Settings for spec fields
Then settings.format should be None
Scenario: format reads CLEVERAGENTS_FORMAT from environment
Given the environment variable "CLEVERAGENTS_FORMAT" is set to "json"
When I instantiate Settings for spec fields
Then settings.format should be "json"
Scenario: format accepts any string value
Given the environment variable "CLEVERAGENTS_FORMAT" is set to "markdown"
When I instantiate Settings for spec fields
Then settings.format should be "markdown"
# ── default_estimation_actor ─────────────────────────────────────────────────
Scenario: default_estimation_actor defaults to None when env var is absent
When I instantiate Settings for spec fields
Then settings.default_estimation_actor should be None
Scenario: default_estimation_actor reads CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR from environment
Given the environment variable "CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR" is set to "gpt-estimator"
When I instantiate Settings for spec fields
Then settings.default_estimation_actor should be "gpt-estimator"
Scenario: default_estimation_actor accepts any string value
Given the environment variable "CLEVERAGENTS_DEFAULT_ESTIMATION_ACTOR" is set to "claude-estimator"
When I instantiate Settings for spec fields
Then settings.default_estimation_actor should be "claude-estimator"
# ── model_fields presence ────────────────────────────────────────────────────
Scenario: all four spec fields appear in Settings.model_fields
When I inspect Settings.model_fields
Then "server_url" should be present in model_fields
And "server_token" should be present in model_fields
And "format" should be present in model_fields
And "default_estimation_actor" should be present in model_fields
# ── type annotation ──────────────────────────────────────────────────────────
Scenario: all four spec fields are typed as str or None
When I instantiate Settings for spec fields
Then settings.server_url should be of type str or None
And settings.server_token should be of type str or None
And settings.format should be of type str or None
And settings.default_estimation_actor should be of type str or None