singularity-forge/autoresearch.md
Mikael Hugo 05953e9599 fix(lint): restore 0 Biome diagnostics and fix web-mode-onboarding test timeout
- Remove/prefix unused imports and variables across 11 src/ files to clear
  74 diagnostics introduced by 37 subsequent commits since run #3
- Fix pre-existing timeout in web-mode-onboarding integration test:
  - Add timeoutMs: 120_000 to launchPackagedWebHost call (was unbounded)
  - Raise AbortSignal.timeout on simple fetches 10s → 30s (under parallel load)
  - Raise overall test timeout 180s → 420s (budget: 120+60+30+30+120+30=390s)
- Log autoresearch run #4 and update lessons in autoresearch.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-10 11:01:43 +02:00

3.3 KiB

Autoresearch: Reduce Biome Lint Diagnostics

Objective

Minimize the total number of Biome lint diagnostics (errors + warnings + info) across src/, starting from baseline ~40 diagnostics. Errors are mostly organizeImports, warnings are noUnusedImports, noUnusedVariables, and useConst.

Metrics

  • Primary: diagnostics (count, lower is better) — sum of errors + warnings + info from npx biome check src/
  • Secondary: errors (count, lower is better)
  • Secondary: warnings (count, lower is better)

How to Run

bash autoresearch.sh — runs Biome check, parses JSON summary, outputs METRIC diagnostics=N and METRIC errors=N and METRIC warnings=N.

Files in Scope

All files under src/ — but focus on the files flagged by Biome:

  • src/resources/extensions/sf/auto/phases.js
  • src/resources/extensions/sf/commands/handlers/ops.js
  • src/resources/extensions/sf/memory-repository.js
  • src/resources/extensions/sf/metrics-central.js
  • src/resources/extensions/sf/reasoning-assist.js
  • src/resources/extensions/sf/remote-steering.js
  • src/resources/extensions/sf/sf-db.js
  • src/resources/extensions/sf/subagent-inheritance.js
  • src/resources/extensions/sf/tests/memory-repository.test.mjs
  • src/resources/extensions/sf/tests/metrics-central.test.mjs
  • src/resources/extensions/sf/tests/trajectory-recorder.test.mjs
  • src/resources/extensions/sf/trajectory-command.js
  • src/resources/extensions/sf/trajectory-recorder.js
  • src/resources/extensions/sf/uok/writer.js

Off Limits

  • biome.json (don't change lint rules — fixing source is the goal)
  • node_modules/, dist/, .sf/, packages/ (outside src/ scope)
  • Test assertion logic (don't weaken tests to make linters pass)

Constraints

  • Existing vitest tests must pass: npx vitest run --config vitest.config.ts
  • No new dependencies
  • Don't introduce runtime behavior changes — only lint/import/style fixes

Termination

Run until interrupted by the user.

What's Been Tried

  • #2 (auto-fix): biome check --write — fixed 26 auto-fixable errors (format/organizeImports), dropped diagnostics from 40 to 11. Status: keep.
  • #3 (manual fixes): Removed 7 unused imports and prefixed 4 intentionally-unused items with underscore. Dropped from 11 to 0. Status: keep.
  • #4 (regression re-fix): 37 new commits introduced 74 diagnostics. biome check --write fixed 58 (auto-safe), manual prefix/removal fixed the remaining 16 unsafe warnings across 11 files. Also fixed pre-existing web-mode-onboarding test timeout: added timeoutMs: 120_000 to launchPackagedWebHost, raised AbortSignal.timeout on simple fetches 10s→30s, raised test budget 180s→420s. All 409 test files pass. Diagnostics: 0. Status: keep.

Lessons

  • New development (37 commits) is enough to re-introduce 74 diagnostics. Re-run autoresearch periodically (monthly or after large feature branches land).
  • Pattern of new violations: unused imports from refactors, unused function params from stubs, duplicate imports. Auto-fix handles errors; unsafe-fix (unused-import/var) requires manual triage.
  • Integration test timeout under parallel load: cold-start Next.js can consume most of a 180s test timeout leaving insufficient budget for multi-step API calls. Fix: bound launch phase separately, raise individual fetch timeouts, increase overall budget to match worst-case sum.