fix(acms): correct hot/warm/cold tier default values in ContextTierService, TierBudget, and Settings
CI / build (pull_request) Successful in 23s
CI / helm (pull_request) Successful in 32s
CI / quality (pull_request) Successful in 59s
CI / lint (pull_request) Failing after 1m3s
CI / typecheck (pull_request) Failing after 1m26s
CI / security (pull_request) Failing after 1m26s
CI / coverage (pull_request) Has been skipped
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
CI / unit_tests (pull_request) Failing after 2m25s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Failing after 14m55s
CI / integration_tests (pull_request) Failing after 18m43s
CI / status-check (pull_request) Failing after 3s
CI / build (pull_request) Successful in 23s
CI / helm (pull_request) Successful in 32s
CI / quality (pull_request) Successful in 59s
CI / lint (pull_request) Failing after 1m3s
CI / typecheck (pull_request) Failing after 1m26s
CI / security (pull_request) Failing after 1m26s
CI / coverage (pull_request) Has been skipped
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Has been skipped
CI / unit_tests (pull_request) Failing after 2m25s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Failing after 14m55s
CI / integration_tests (pull_request) Failing after 18m43s
CI / status-check (pull_request) Failing after 3s
Fixed three production source files to use correct default values per specification: - ContextTierService: hot=16000 tokens, warm=100 decisions, cold=500 decisions - TierBudget Pydantic model: same defaults - Settings configuration: same defaults Added TDD regression tests with @tdd_issue_1443 tags to prevent future regressions. ISSUES CLOSED: #1443
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
from behave import given, when, then
|
||||
from cleveragents.domain.models.acms.tiers import TierBudget
|
||||
from cleveragents.application.services.context_tiers import ContextTierService
|
||||
from cleveragents.config.settings import Settings
|
||||
|
||||
|
||||
@given("the ACMS tier specification defines")
|
||||
def step_spec_defines(context):
|
||||
context.spec = {}
|
||||
for row in context.table:
|
||||
tier = row["Tier"]
|
||||
field = row["Field"]
|
||||
value = int(row["Spec Value"])
|
||||
if tier not in context.spec:
|
||||
context.spec[tier] = {}
|
||||
context.spec[tier][field] = value
|
||||
|
||||
|
||||
@when("I create a TierBudget with no arguments")
|
||||
def step_create_tier_budget_no_args(context):
|
||||
context.budget = TierBudget()
|
||||
|
||||
|
||||
@then("the budget should have max_tokens_hot = {value:d}")
|
||||
def step_budget_max_tokens_hot(context, value):
|
||||
assert context.budget.max_tokens_hot == value
|
||||
|
||||
|
||||
@then("the budget should have max_decisions_warm = {value:d}")
|
||||
def step_budget_max_decisions_warm(context, value):
|
||||
assert context.budget.max_decisions_warm == value
|
||||
|
||||
|
||||
@then("the budget should have max_decisions_cold = {value:d}")
|
||||
def step_budget_max_decisions_cold(context, value):
|
||||
assert context.budget.max_decisions_cold == value
|
||||
|
||||
|
||||
@when("I create a ContextTierService with settings=None")
|
||||
def step_create_context_tier_service_no_settings(context):
|
||||
context.service = ContextTierService(settings=None)
|
||||
|
||||
|
||||
@then("the service budget should have max_tokens_hot = {value:d}")
|
||||
def step_service_budget_max_tokens_hot(context, value):
|
||||
assert context.service.budget.max_tokens_hot == value
|
||||
|
||||
|
||||
@then("the service budget should have max_decisions_warm = {value:d}")
|
||||
def step_service_budget_max_decisions_warm(context, value):
|
||||
assert context.service.budget.max_decisions_warm == value
|
||||
|
||||
|
||||
@then("the service budget should have max_decisions_cold = {value:d}")
|
||||
def step_service_budget_max_decisions_cold(context, value):
|
||||
assert context.service.budget.max_decisions_cold == value
|
||||
|
||||
|
||||
@when("I create a Settings object with no arguments")
|
||||
def step_create_settings_no_args(context):
|
||||
context.settings = Settings()
|
||||
|
||||
|
||||
@then("the settings should have context_max_tokens_hot = {value:d}")
|
||||
def step_settings_context_max_tokens_hot(context, value):
|
||||
assert context.settings.context_max_tokens_hot == value
|
||||
|
||||
|
||||
@then("the settings should have context_max_decisions_warm = {value:d}")
|
||||
def step_settings_context_max_decisions_warm(context, value):
|
||||
assert context.settings.context_max_decisions_warm == value
|
||||
|
||||
|
||||
@then("the settings should have context_max_decisions_cold = {value:d}")
|
||||
def step_settings_context_max_decisions_cold(context, value):
|
||||
assert context.settings.context_max_decisions_cold == value
|
||||
|
||||
|
||||
@when("I create a ContextTierService with those settings")
|
||||
def step_create_context_tier_service_with_settings(context):
|
||||
context.service = ContextTierService(settings=context.settings)
|
||||
@@ -0,0 +1,35 @@
|
||||
@tdd_issue
|
||||
@tdd_issue_1443
|
||||
Feature: TDD: ContextTierService and TierBudget use correct default values per spec
|
||||
|
||||
Background:
|
||||
Given the ACMS tier specification defines:
|
||||
| Tier | Field | Spec Value |
|
||||
| hot | max_tokens | 16000 |
|
||||
| warm | max_decisions | 100 |
|
||||
| cold | max_decisions | 500 |
|
||||
|
||||
Scenario: TierBudget() with no arguments yields correct defaults
|
||||
When I create a TierBudget with no arguments
|
||||
Then the budget should have max_tokens_hot = 16000
|
||||
And the budget should have max_decisions_warm = 100
|
||||
And the budget should have max_decisions_cold = 500
|
||||
|
||||
Scenario: ContextTierService(settings=None) yields correct budget defaults
|
||||
When I create a ContextTierService with settings=None
|
||||
Then the service budget should have max_tokens_hot = 16000
|
||||
And the service budget should have max_decisions_warm = 100
|
||||
And the service budget should have max_decisions_cold = 500
|
||||
|
||||
Scenario: Settings fields default to correct values
|
||||
When I create a Settings object with no arguments
|
||||
Then the settings should have context_max_tokens_hot = 16000
|
||||
And the settings should have context_max_decisions_warm = 100
|
||||
And the settings should have context_max_decisions_cold = 500
|
||||
|
||||
Scenario: ContextTierService reads correct defaults from Settings
|
||||
When I create a Settings object with no arguments
|
||||
And I create a ContextTierService with those settings
|
||||
Then the service budget should have max_tokens_hot = 16000
|
||||
And the service budget should have max_decisions_warm = 100
|
||||
And the service budget should have max_decisions_cold = 500
|
||||
@@ -42,9 +42,9 @@ logger = structlog.get_logger(__name__)
|
||||
# Default budget when settings are not provided
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
_DEFAULT_MAX_TOKENS_HOT = 8000
|
||||
_DEFAULT_MAX_DECISIONS_WARM = 500
|
||||
_DEFAULT_MAX_DECISIONS_COLD = 5000
|
||||
_DEFAULT_MAX_TOKENS_HOT = 16000
|
||||
_DEFAULT_MAX_DECISIONS_WARM = 100
|
||||
_DEFAULT_MAX_DECISIONS_COLD = 500
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Default runtime policy values
|
||||
|
||||
@@ -284,19 +284,19 @@ class Settings(BaseSettings):
|
||||
|
||||
# Context tier budgets (ACMS #208)
|
||||
context_max_tokens_hot: int = Field(
|
||||
default=8000,
|
||||
default=16000,
|
||||
ge=0,
|
||||
validation_alias=AliasChoices("CLEVERAGENTS_CONTEXT_MAX_TOKENS_HOT"),
|
||||
description="Maximum total tokens in the hot context tier.",
|
||||
)
|
||||
context_max_decisions_warm: int = Field(
|
||||
default=500,
|
||||
default=100,
|
||||
ge=0,
|
||||
validation_alias=AliasChoices("CLEVERAGENTS_CONTEXT_MAX_DECISIONS_WARM"),
|
||||
description="Maximum fragments in the warm context tier.",
|
||||
)
|
||||
context_max_decisions_cold: int = Field(
|
||||
default=5000,
|
||||
default=500,
|
||||
ge=0,
|
||||
validation_alias=AliasChoices("CLEVERAGENTS_CONTEXT_MAX_DECISIONS_COLD"),
|
||||
description="Maximum fragments in the cold context tier.",
|
||||
|
||||
@@ -140,17 +140,17 @@ class TierBudget(BaseModel):
|
||||
"""
|
||||
|
||||
max_tokens_hot: int = Field(
|
||||
default=8000,
|
||||
default=16000,
|
||||
ge=0,
|
||||
description="Maximum total tokens in the hot tier",
|
||||
)
|
||||
max_decisions_warm: int = Field(
|
||||
default=500,
|
||||
default=100,
|
||||
ge=0,
|
||||
description="Maximum number of fragments in the warm tier",
|
||||
)
|
||||
max_decisions_cold: int = Field(
|
||||
default=5000,
|
||||
default=500,
|
||||
ge=0,
|
||||
description="Maximum number of fragments in the cold tier",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user