refactor(yaad): split oversized files for code clarity#22
Merged
Conversation
Mechanically split storage/sqlite.go (2015 LOC) into four same-package files for readability, moving code verbatim with no behavior, API, or exported-symbol changes: - sqlite.go: shared infra (schema, busy-retry, stmt cache, sessions, file-watch, scan helpers) - sqlite_nodes.go: node, version, metadata, signature, access-log ops - sqlite_edges.go: edge, graph-stats, cycle-check ops - sqlite_tx.go: WithTx/txStore plus version rollback/diff Verified with go build, go vet, go test, and golangci-lint (0 issues).
Mechanically split internal/server/rest.go (1370 LOC) into three same-package files, moving code verbatim with no behavior or API changes: - rest.go: server lifecycle, middleware, route registration, HTTP helpers - rest_handlers.go: core memory/graph/node/session/maintenance handlers - rest_extra.go: export/import, skill, version-history, confidence, compression, bridge, and advanced-feature handlers Verified with go build, go vet, go test, and golangci-lint (0 issues).
Mechanically split internal/server/mcp_test.go (1366 LOC) into three same-package test files, moving tests verbatim with no behavior changes: - mcp_test.go: shared test helpers plus remember/forget/pin/recall tests - mcp_graph_test.go: link, subgraph, status, session, skill, feedback, context, and clamp/cancellation tests - mcp_concurrency_rest_test.go: concurrency tests and REST API-key auth tests Verified with go vet, go test, and golangci-lint (0 issues).
Mechanically split engine/engine_test.go (1204 LOC) into three same-package test files, moving code verbatim with no behavior changes and preserving the file-level //nolint:gocritic directive: - engine_test.go: engine behavior tests - engine_mock_storage_test.go: mockStorage (in-memory storage.Storage) - engine_mock_graph_test.go: mockGraph and newTestEngine builder Verified with go vet, go test, and golangci-lint (0 issues).
Mechanically split integration_test.go (1027 LOC) into three same-package test files, moving tests verbatim with no behavior changes and preserving the //go:build integration tag and //nolint:noctx directive: - integration_test.go: setup helper plus core remember/recall/graph/phase 3-5 tests - integration_features_test.go: skills, benchmark, profile, conflict, temporal, dedup, compaction, mental-model, intent, and privacy tests - integration_api_test.go: utils, edge-case, TLS, config, storage, REST API, and concurrency tests Verified with go vet, go test, and golangci-lint (all with -tags=integration).
5bd4972 to
e983bbe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pure mechanical refactor for code clarity only — each oversized Go file
(>1000 LOC) is split into smaller, same-package files. Code was moved
verbatim: no behavior, no API, and no exported-symbol changes. Build
tags (
//go:build integration) and file-level directives (//nolint:gocritic,//nolint:noctx) are preserved.Files split (before → after LOC)
storage/sqlite.go(2015) →sqlite.go(666),sqlite_nodes.go(608),sqlite_edges.go(518),sqlite_tx.go(268)internal/server/rest.go(1370) →rest.go(376),rest_handlers.go(511),rest_extra.go(522)internal/server/mcp_test.go(1366) →mcp_test.go(449),mcp_graph_test.go(476),mcp_concurrency_rest_test.go(479)engine/engine_test.go(1204) →engine_test.go(419),engine_mock_storage_test.go(673),engine_mock_graph_test.go(141)integration_test.go(1027) →integration_test.go(346),integration_features_test.go(358),integration_api_test.go(363)No Go file in the module now exceeds 1000 LOC.
Test plan
All verified locally (CGO not required —
modernc.org/sqliteis pure Go):go build ./...go vet ./...go test ./...golangci-lint run ./...→ 0 issuesgo vet/test -tags=integration .andgolangci-lint run --build-tags=integration .→ pass / 0 issuesMade with Cursor