Skip to content

feat: test suite (272 tests), persistence layer, retry logic, bug fixes#1

Open
arc-web wants to merge 1 commit into
BusyBee3333:mainfrom
arc-web:feat/tests-persistence-retry
Open

feat: test suite (272 tests), persistence layer, retry logic, bug fixes#1
arc-web wants to merge 1 commit into
BusyBee3333:mainfrom
arc-web:feat/tests-persistence-retry

Conversation

@arc-web
Copy link
Copy Markdown

@arc-web arc-web commented Mar 18, 2026

What's in this PR

Test Suite (4 files, 272 tests, vitest)

  • mogul.test.ts (48 tests): Phase routing, fallback tiers, provider health, budget enforcement, retry logic, delegation, persistence integration
  • landlord.test.ts (39 tests): Spike detection, anomaly patterns (rapid-fire, thrashing, output explosion), severity levels, key compromise detection
  • portfolio.test.ts (171 tests): Validates every field on all 16 models, tier assignments, cost sanity, strength coverage
  • persistence.test.ts (14 tests): JSON file roundtrip, memory adapter, error recovery

Persistence Layer (src/persistence.ts)

  • PersistenceAdapter interface with save() and load()
  • JsonFilePersistence - file-based JSON storage
  • MemoryPersistence - in-memory adapter for testing
  • Auto-loads on startup, auto-saves after each complete()

Retry Logic

  • Configurable retryConfig: { maxRetries, baseDelayMs, multiplier }
  • Exponential backoff before marking providers degraded
  • Default: 2 retries, 1s base, 2x multiplier

Bug Fixes

  • Global mutable state (MARKET_SENTIMENT, PORTFOLIO_LEDGER) moved to instance-scoped
  • TypeScript errors in examples/landlord.ts fixed
  • Duplicate model ID in local portfolio fixed
  • Added .gitignore

All 272 tests pass. TypeScript compiles clean. Build succeeds.

… fixes

- Added vitest test suite: mogul routing, landlord security, portfolio validation, persistence
- Added file-based JSON persistence layer (PersistenceAdapter interface)
- Added retry logic with exponential backoff before marking providers degraded
- Fixed global mutable state (MARKET_SENTIMENT, PORTFOLIO_LEDGER) → instance-scoped
- Fixed TypeScript errors in examples/landlord.ts
- Fixed duplicate model ID in local portfolio
- Added .gitignore
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