Files
cleveragents-core/robot/tdd_context_tier_runtime.robot
T
brent.edwards 202c9bfe75
CI / lint (push) Successful in 13s
CI / e2e_tests (push) Has started running
CI / quality (push) Successful in 23s
CI / benchmark-publish (push) Has started running
CI / typecheck (push) Successful in 43s
CI / benchmark-regression (push) Has been skipped
CI / build (push) Successful in 22s
CI / security (push) Successful in 59s
CI / integration_tests (push) Successful in 2m49s
CI / unit_tests (push) Successful in 4m1s
CI / docker (push) Successful in 1m26s
CI / coverage (push) Successful in 9m14s
test(acms): TDD failing tests for context tier runtime logic (bug #821) (#1058)
## Summary

TDD expected-fail tests proving bug #821 exists: `ContextTierService` has data models for hot/warm/cold tiers but **no runtime logic** for automatic promotion, demotion, or eviction.

- **Promotion on access**: Accessing a cold-tier fragment repeatedly via `get()` does NOT auto-promote it — `get()` updates `access_count`/`last_accessed` but never calls `promote()`
- **Demotion on staleness**: No staleness enforcement method exists — tried `enforce_staleness()`, `apply_tier_policy()`, `tick()`, etc. — none are implemented
- **Eviction on budget overflow**: `store()` does NOT enforce `TierBudget.max_tokens_hot` — the hot tier grows without bound

### Files Added
| File | Purpose |
|------|---------|
| `features/tdd_context_tier_runtime.feature` | 3 Behave scenarios tagged `@tdd_expected_fail @tdd_bug @tdd_bug_821 @mock_only` |
| `features/steps/tdd_context_tier_runtime_steps.py` | Type-annotated step definitions exercising real `ContextTierService` |
| `robot/tdd_context_tier_runtime.robot` | 3 Robot Framework integration tests tagged `tdd_expected_fail` |
| `robot/helper_tdd_context_tier_runtime.py` | Helper script for Robot tests with 3 subcommands |

### Verification
- `nox -s lint` — passed
- `nox -s typecheck` — passed (0 errors)
- `nox -s unit_tests -- features/tdd_context_tier_runtime.feature` — **3 scenarios passed** (all assertions fail as expected, `@tdd_expected_fail` inverts to CI pass)

ISSUES CLOSED: #840

Reviewed-on: #1058
Co-authored-by: Brent Edwards <brent.edwards@cleverthis.com>
Co-committed-by: Brent Edwards <brent.edwards@cleverthis.com>
2026-03-19 22:24:41 +00:00

46 lines
2.4 KiB
Plaintext

*** Settings ***
Documentation TDD Bug #821 — context tier service has data models but no runtime logic
... for promotion, demotion, or eviction. Integration smoke tests verifying
... that ContextTierService automatically promotes fragments on repeated access,
... demotes stale fragments, and evicts fragments when the hot tier budget
... overflows. Currently the service has manual promote()/demote()/evict_lru()
... methods but no automatic runtime behaviour wired into get() or store().
... Tests are tagged tdd_expected_fail so CI passes via result inversion.
Resource ${CURDIR}/common.resource
Suite Setup Setup Test Environment
Suite Teardown Cleanup Test Environment
*** Variables ***
${HELPER} ${CURDIR}/helper_tdd_context_tier_runtime.py
*** Test Cases ***
TDD Promotion On Repeated Access
[Documentation] Verify that accessing a cold-tier fragment repeatedly via get()
... auto-promotes it to warm or hot tier.
[Tags] tdd_bug tdd_bug_821 tdd_expected_fail
${result}= Run Process ${PYTHON} ${HELPER} promote-on-access cwd=${WORKSPACE} timeout=30s
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} tdd-promote-on-access-ok
TDD Demotion On Staleness
[Documentation] Verify that a stale hot-tier fragment is automatically demoted
... to warm or cold tier by a staleness enforcement runtime.
[Tags] tdd_bug tdd_bug_821 tdd_expected_fail
${result}= Run Process ${PYTHON} ${HELPER} demote-on-staleness cwd=${WORKSPACE} timeout=30s
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} tdd-demote-on-staleness-ok
TDD Eviction On Budget Overflow
[Documentation] Verify that storing beyond the hot tier token budget triggers
... automatic LRU eviction of the oldest fragment.
[Tags] tdd_bug tdd_bug_821 tdd_expected_fail
${result}= Run Process ${PYTHON} ${HELPER} evict-on-overflow cwd=${WORKSPACE} timeout=30s
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} tdd-evict-on-overflow-ok