# Cross-Repo Automated Test Coverage Bug Report Generated: 2026-02-15 ## Scope - `bytelyst-trading-bot-service` - `bytelyst-trading-dashboard-web` This report documents automated test execution results, coverage observations, discovered defects, and the coverage instrumentation baseline added on 2026-02-15. ## Automated Execution Summary ### `bytelyst-trading-bot-service` | Command | Result | |---|---| | `npm run check` | PASS | | `node --loader ts-node/esm scripts/run_all_tests.ts` | FAIL (`56 passed`, `9 failed`) | | `node --loader ts-node/esm scripts/testManualTraderCapitalGuard.ts` | PASS | | `node --loader ts-node/esm scripts/testSupabaseTradeHistorySourceFallback.ts` | PASS | ### `bytelyst-trading-dashboard-web` | Command | Result | |---|---| | `npm run check` | PASS (build/lint/format) | Build note: Vite emitted a chunk-size warning (`assets/index-*.js` > `500 kB` threshold). ### Coverage Baseline (2026-02-15) | Repo | Command | Statements | Branches | Functions | Lines | |---|---|---:|---:|---:|---:| | `bytelyst-trading-bot-service` | `npm run coverage:integration` | `23.99%` | `40.68%` | `33.12%` | `23.99%` | | `bytelyst-trading-dashboard-web` | `npm run coverage` (pre-scope baseline) | `5.44%` | `4.37%` | `3.14%` | `5.36%` | ### Enforced 80% Coverage Gate (2026-02-16) | Repo | Command | Scope | Statements | Branches | Functions | Lines | |---|---|---|---:|---:|---:|---:| | `bytelyst-trading-bot-service` | `npm run coverage` | `src/domain/tradingEnums.ts`, `src/utils/symbolMapper.ts`, `src/connectors/factory.ts` | `97.87%` | `93.02%` | `92.30%` | `97.87%` | | `bytelyst-trading-dashboard-web` | `npm run coverage` | `src/lib/tradeHistoryLedger.ts` | `99.06%` | `93.43%` | `100%` | `98.93%` | ## Coverage Snapshot ### `bytelyst-trading-bot-service` - `65` TypeScript test scripts under `tests/` - `37` TypeScript source files under `src/` - Coverage is integration-heavy (Supabase, Alpaca, localhost HTTP) and now has both: - broad integration snapshot via `npm run coverage:integration` - enforced 80% gate for selected critical modules via `npm run coverage` - Existing `check` pipeline validates schema/security/lifecycle/order-sync contracts, but does not run the full `tests/` folder. ### `bytelyst-trading-dashboard-web` - `32` source files under `src/` - `1` unit test file baseline under `src/lib` - Current automation now includes `vitest` coverage with an 80% gate for selected critical module scope, but UI/e2e behavior remains largely untested. ## Bugs Found by Automated Tests ### Failing tests from `scripts/run_all_tests.ts` - [ ] `check_alerts.ts` Error signature: `AggregateError [ECONNREFUSED]` to `localhost:5000` Gap: test assumes local API service is running; no harness/bootstrap. - [ ] `debug_db_logging.ts` Error signature: `TypeError: Cannot read properties of undefined (reading 'email')` Gap: user/profile object null safety missing in debug logging path. - [ ] `final_e2e_param_verification.ts` Error signature: `TypeError: Cannot read properties of undefined (reading 'ALPACA_API_KEY')` Gap: env/profile credential access without guard/default handling. - [ ] `simple_check.ts` Error signature: `AggregateError [ECONNREFUSED]` to `localhost:5000` Gap: same local service dependency issue as `check_alerts.ts`. - [ ] `test_alpaca_exhaustive.ts` Error signature: `TypeError: symbols.join is not a function` Gap: symbol collection contract mismatch (array vs non-array). - [ ] `test_fuzzy_match.ts` Error signature: `TypeError: this.portfolioGuard is not a function` Gap: service dependency wiring/interface mismatch in `AutoTrader`. - [ ] `test_safe.ts` Error signature: `TypeError: symbols.join is not a function` Gap: same symbol contract mismatch as `test_alpaca_exhaustive.ts`. - [ ] `test_slash.ts` Error signature: `TypeError: symbols.join is not a function` Gap: same symbol contract mismatch as `test_alpaca_exhaustive.ts`. - [ ] `verify_realtime.ts` Error signature: `TypeError: supabaseService.subscribeToProfiles is not a function` Gap: realtime subscription method missing or renamed vs test expectation. ## Additional Anomalies Observed During Test Sweep These surfaced in test output and should be triaged, even when the wrapper test status was `PASSED`. - [ ] `check_alpaca_pos.ts`: `TypeError: exchange.getPositions is not a function` - [ ] `test_query.ts`: `Code: 22P02` (invalid UUID input path) - [ ] `test_strategy_logic.ts`: `TypeError: this.executionManager.getPendingOrders is not a function` - [ ] `check_user_schema.ts` and `verify_profiles_e2e.ts`: `ALPACA_API_KEY` access appears in logs and needs explicit guard/contract verification. ## High-Impact Coverage Gaps - [ ] No deterministic test harness for external dependencies (Supabase, Alpaca, local API service). - [ ] No unified CI test stage that runs full bot `tests/` inventory and fails on any anomaly. - [ ] Dashboard behavioral coverage is still very low outside `src/lib/tradeHistoryLedger.ts` and needs tab/component-level tests. - [ ] No end-to-end automation proving dashboard/bot contract behavior under real lifecycle transitions. ## Artifacts - Bot full suite log: `bytelyst-trading-bot-service/.tmp_run_all_tests.log` - Bot check log: `bytelyst-trading-bot-service/.tmp_npm_check.log` - Dashboard check log: `bytelyst-trading-dashboard-web/.tmp_npm_check.log`