Skip to content

refactor: align test structure to src/ and fix framework API breakage#174

Merged
jafreck merged 4 commits intomainfrom
refactor/test-structure-alignment
Mar 16, 2026
Merged

refactor: align test structure to src/ and fix framework API breakage#174
jafreck merged 4 commits intomainfrom
refactor/test-structure-alignment

Conversation

@jafreck
Copy link
Owner

@jafreck jafreck commented Mar 16, 2026

Summary

Aligns test file naming/structure to mirror src/ and fixes all 17 pre-existing type errors + 31 test failures from the @cadre-dev/framework consolidation in #173.

Test structure changes

Area Before After
tests/agents/ aamf-output-schema, claude-agent-definitions, result-parser agent-output-schemas, generator, plan-parser
tests/core/ claude-runner, progress-writer, infra-error-detection progress (others moved/deleted)
tests/flow/ coverage-gaps, shared-steps*, step-phase-*, flow-dsl error-classification, migration-flow, steps/ subdirectory
tests/lore/ (didn't exist) kb-search-handler, kb-search-tool, kb-server (moved from tests/core/)
  • No more files named "coverage" or "gaps"
  • No more legacy/indirection mappings
  • Test file names match the source module they exercise

Source fixes for @cadre-dev/framework API changes

File Issue Fix
src/flow/steps/shared.ts classifyError removed from framework/runtime Removed fallback call; AAMF's own pattern matching suffices
src/budget/cost-estimator.ts models config key removed Pass all pricing via costOverrides; implement 80/20 split directly
src/budget/token-tracker.ts loadFromAggregates / getByWorkItem removed Standalone tracking (no framework delegation)
src/execution/retry.ts computeDelay / RETRY_ORIGINAL removed Native retry loop preserving fast infra backoff + recovery semantics
src/core/agent-launcher.ts workItemId removed from framework AgentInvocation Map to issueNumber
src/core/runtime.ts signal / hooks removed from FlowRunnerOptions Process phase results from executionOutputs post-run

Results

Metric Before After
Failing test files 10 0
Failing tests 31 0
Passing tests 1383 1413
Type errors (tsc --noEmit) 17 0

jafreck added 4 commits March 15, 2026 18:07
Test structure changes:
- Rename test files to match source module names (e.g. aamf-output-schema → agent-output-schemas)
- Remove 'coverage-gaps' and legacy naming from test files
- Move flow step tests into tests/flow/steps/ mirroring src/flow/steps/
- Move KB/lore tests from tests/core/ to tests/lore/
- Delete obsolete claude-runner.test.ts (tested removed wrapper)

Source fixes for @cadre-dev/framework API changes:
- shared.ts: remove broken classifyError import from framework/runtime
- cost-estimator.ts: pass pricing via costOverrides (models key removed)
- cost-estimator.ts: implement 80/20 split in estimateFromTotal directly
- token-tracker.ts: replace framework delegation with standalone tracking
  (loadFromAggregates and getByWorkItem removed from framework)
- retry.ts: implement retry loop natively (computeDelay and RETRY_ORIGINAL
  removed from framework); preserves fast infr  removed from framework); preserves fast infr  removed from framework); preserves fast infr  removed from framework); ptes  removed from framewo (all pre-existing)
…untime

- agent-launcher.ts: map to issueNumber (workItemId removed from framework)
- runtime.ts: remove signal/hooks from FlowRunnerOptions (no longer supported),
  process phase results from executionOutputs post-run instead
- Resolves all 17 pre-existing type errors from framework consolidation
@jafreck jafreck merged commit e8b6d55 into main Mar 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant