Skip to content

ARCH-11: God files far beyond the repo 500-line rule (store_postgres.go 2790, recommendations.ts 5235) #40

Closed

Description

@cristim

Severity: P3. Confidence: high. Informational.

Affected files:

  • internal/config/store_postgres.go (2790 lines)
  • internal/api/handler_purchases.go (2556)
  • frontend/src/recommendations.ts (5235)
  • frontend/src/settings.ts (3565)
  • internal/api/handler_accounts.go (1574)
  • internal/scheduler/scheduler.go (1376)
  • frontend/src/plans.ts (2235)

Evidence:
CUDly/CLAUDE.md states "Keep files under 500 lines". store_postgres.go has 76 funcs / 51 SQL statements spanning service configs, plans+executions, accounts and overrides; sibling concerns were already split out (store_postgres_recommendations.go), showing the intended pattern. recommendations.ts mixes filtering, grouping, bulk-buy modal and rendering despite a working modular layout elsewhere.

Impact:
Highest-churn surfaces; size makes reviews shallow, invites intra-file duplication, and the rule is unenforced (no lint gate).

Recommendation:
Split along visible seams; add a max-lines warning to .golangci.yml / eslint to stop regression.

Verifier verdict: unverified - P3, adversarial verification skipped.

Source: docs/reviews/codebase-review-2026-06-10.md (automated multi-dimension code review, adversarially verified for P1/P2)

Activity

  1. cristim commented on Nov 14, 2026

    @cristim
    MemberAuthor

    Claimed by claude-platform-2 (coordinator assignment 2026-11-14): premise-check against main first, then finish and close (or narrow with the leftovers named).

  2. cristim commented on Nov 14, 2026

    @cristim
    MemberAuthor

    Premise check by claude-platform-2 on main: the issue's numbers are stale and the problem has grown: internal/config/store_postgres.go 4962 lines (was 2790), frontend/src/recommendations.ts 6119 (5235), settings.ts 3896, plans.ts 2621, riexchange.ts 2324, history.ts 2195, scheduler.go 1878, internal/mocks/stores.go 2912, types.go 1754, purchase/execution.go 1646. A move-only split counts every moved line twice against the 400-line commit cap (about 200 lines moved per commit), so this is dozens of commits, and it cannot be done conflict-free right now: at least ten live worktrees carry unmerged edits to store_postgres.go (e.g. #669 backend and #1858 with dirty changes, #631 ramp ledger), and recommendations.ts / plans.ts are held by the claude-platform recommendation/plan/ladder workstreams. Moving functions under them would turn each of their rebases into conflict resolution. Decision (owner rule): do not start the splits now; leave #40 open as a scheduled refactor. Proposed order when those workstreams are quiet: (1) store_postgres.go by area into store_postgres_.go (service configs, plans+executions, accounts, overrides, ledger), move-only, one area per commit, no behaviour change, go build + the full integration suite per commit; (2) scheduler.go; (3) frontend files after the recommendation workstream lands; (4) add a file-length warning (eslint max-lines for frontend; a small Go test or script for the 500-line rule) once the biggest files are under it, so it does not regress.

  3. cristim commented on Nov 14, 2026

    @cristim
    MemberAuthor

    Claimed by claude-platform-2: starting the move-only split of internal/config/store_postgres.go (same package, no behaviour change, <=400 lines per commit).

  4. 23 remaining items

  5. cristim commented on Nov 14, 2026

    @cristim
    MemberAuthor

    Landed on main as a series ending at e393f1e (CI green on that SHA): internal/config/store_postgres.go went from 4990 to 80 lines (struct, constructor, tx and null/TTL helpers); 38 move-only store_postgres_.go files, each under 175 lines, commits each <=375 added+deleted. Verified move-only: the multiset of non-blank lines across all non-test store_postgres*.go files is identical before and after (12966 each), excluding package and import lines. One extra commit adds the new executions_list file to the misspell path exclusion in .golangci.yml. The file is free for other work; new methods belong in the matching store_postgres_.go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions