Skip to content

refactor(yaad): split oversized files for code clarity#22

Merged
Patel230 merged 5 commits into
mainfrom
refactor/code-clarity
Jun 19, 2026
Merged

refactor(yaad): split oversized files for code clarity#22
Patel230 merged 5 commits into
mainfrom
refactor/code-clarity

Conversation

@Patel230

Copy link
Copy Markdown
Contributor

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/sqlite is pure Go):

  • go build ./...
  • go vet ./...
  • go test ./...
  • golangci-lint run ./... → 0 issues
  • go vet/test -tags=integration . and golangci-lint run --build-tags=integration . → pass / 0 issues

Made with Cursor

Patel230 added 5 commits June 19, 2026 21:00
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).
@Patel230 Patel230 force-pushed the refactor/code-clarity branch from 5bd4972 to e983bbe Compare June 19, 2026 15:37
@Patel230 Patel230 merged commit ceb690a into main Jun 19, 2026
12 checks passed
@Patel230 Patel230 deleted the refactor/code-clarity branch June 19, 2026 17:12
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