Skip to content

refactor: stabilize Go tests and adapters - #267

Merged
morluto merged 6 commits into
mainfrom
agent/stabilize-go-codebase
Aug 3, 2026
Merged

refactor: stabilize Go tests and adapters#267
morluto merged 6 commits into
mainfrom
agent/stabilize-go-codebase

Conversation

@morluto

@morluto morluto commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

This refactor stabilizes the Go test and adapter boundaries while preserving existing behavior.

  • Cache reflected MCP schemas with type-keyed single-flight initialization, including cached errors.
  • Deep-clone schema trees before tool-specific customization so nested definitions, array items, defaults, enums, and ranges remain independent.
  • Isolate npm environment variables in upgrade tests and correct the MCP portfolio fixture contract.
  • Reuse a current-schema SQLite template for ordinary corpus fixtures without sharing WAL/SHM sidecars.
  • Replace the CLI's large dispatch switch with a focused routing table.
  • Re-enable test linting, address context/resource findings, and add behavior coverage for previously untested packages.

Review order

  1. internal/mcpserver/schemas.go and internal/mcpserver/schemas_test.go
  2. internal/corpus/corpus_test.go and internal/corpus/corpus_fixture_test.go
  3. internal/cli/cli.go and internal/cli/dispatch.go
  4. Environment, lint, and targeted coverage changes

Testing

  • npm_command=exec npm_lifecycle_event=npx go test ./... -count=1 — passed
  • make verify — passed
  • make test-race — passed
  • make lint-full — 0 issues
  • gofmt and git diff --check — passed

Compatibility and scope

  • No public product API or persisted schema changes.
  • Offline corpus-read, network-write, authorization, snapshot, and recovery boundaries are preserved.
  • The larger internal/app/mcp package extraction and exhaustive sleep replacement are intentionally deferred; the existing MCP implementation remains split across its capability-specific internal/app/mcp_*.go files.

morluto added 2 commits August 3, 2026 17:15
Add t.Setenv isolation for npm_command and npm_lifecycle_event in 6
upgrade tests and the shared setupUpgradeActivationTest helper. Without
these, discoverInstallation() short-circuits to npx context when tests
run inside an npx-launched process, causing all non-npx upgrade tests
to fail.
@morluto
morluto marked this pull request as ready for review August 3, 2026 11:11
@cursor

cursor Bot commented Aug 3, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@morluto
morluto merged commit 94b3aac into main Aug 3, 2026
14 checks passed
@morluto
morluto deleted the agent/stabilize-go-codebase branch August 3, 2026 11:35
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