Skip to content

refactor: audit tail — collapse duplicate config type, flatten handler barrel - #65

Merged
ZeR020 merged 4 commits into
mainfrom
refactor/audit-slim
Sep 8, 2026
Merged

ZeR020 merged 4 commits into
mainfrom
refactor/audit-slim

Conversation

@ZeR020

@ZeR020 ZeR020 commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

Final batch of the full-codebase audit (the over-engineering pass — every proposal here survived adversarial cross-review against the other audit lenses). Behavior-neutral. Gates green: format:check + typecheck + 844 tests passed + build.

Commit Change
refactor(config) The hand-maintained OpenCodeMemConfig interface duplicated the zod schema's ~70 keys. Type is now z.infer<typeof OpenCodeMemConfigSchema> — one source of truth, zero call-site churn
refactor(server) api-handlers.ts barrel deleted (~90 lines of re-exports + a duplicate ApiResponse type): web-server.ts imports route handlers directly; the two real handlers (cache stats, API status) moved into handlers/admin.ts; test imports updated
chore(deps) better-sqlite3 → optionalDependencies — installs no longer hard-fail where its native build breaks (bun:sqlite/node:sqlite probe chain unchanged)
refactor Shared StmtCache helper replaces two hand-rolled prepared-statement WeakMaps; plugin.ts re-exports OpenCodeMemPlugin directly instead of a try/catch that logs and rethrows

Not done (killed during review — recorded as audited-and-kept)

  • The 4 hand-rolled HTTP AI providers (~1,880 lines): serve real config surface (custom base URLs, Gemini/Responses shapes, tool loops) the ai SDK cannot drop-in replace.
  • jsonc-parser: config PUT preserves comments via applyEdits — that's a feature.
  • Node HTTP adapter + node>=20 engine support (CLI is #!/usr/bin/env node).

Verification

  • bun run format:check && bun run typecheck && bun run test && bun run build — all green (844 passed / 1 skipped)
  • plugin-loader-contract.test.ts still green after the plugin.ts simplification

The hand-written interface duplicated ~70 keys already enumerated by
OpenCodeMemConfigSchema — one type source, no drift.
…rs barrel

Dashboard routes already lived in handlers/; the barrel only re-exported
them plus two leftover admin handlers. Import origin modules instead.
Native builds fail on exotic platforms and used to fail the whole
install. bun:sqlite / node:sqlite users never needed it as a hard dep.
ConnectionManager and VectorSearch each rolled their own prepared-statement
WeakMap. plugin.ts only logged-and-rethrew around a static import.
Copilot AI lite review requested due to automatic review settings September 8, 2026 15:08
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

@ZeR020
ZeR020 merged commit ba9dadb into main Sep 8, 2026
7 checks passed
@ZeR020
ZeR020 deleted the refactor/audit-slim branch September 8, 2026 15:10
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.

2 participants