Skip to content

R18 part 1 (#104): split WriteEndpoints god-method into per-entity files - #125

Merged
nicpozent merged 1 commit into
mainfrom
claude/code-examination-qx719b
Aug 5, 2026
Merged

R18 part 1 (#104): split WriteEndpoints god-method into per-entity files#125
nicpozent merged 1 commit into
mainfrom
claude/code-examination-qx719b

Conversation

@nicpozent

Copy link
Copy Markdown
Owner

What & why

Part of the code-review remediation epic (#106). Addresses R18 / #104 — which is explicitly one file per PR. This is part 1: the #1 god object in the table, server/WriteEndpoints.cs (805 lines, 34 endpoints inline in one ~735-line MapAtlasWriteEndpoints method).

Split

partial class WriteEndpoints across a thin composer + seven per-entity files (all namespace Atlas.Api):

File Lines
WriteEndpoints.cs (composer: fields, shared helpers, dispatch) 83
WriteEndpoints.Demands.cs 203
WriteEndpoints.Projects.cs 182
WriteEndpoints.OKRs.cs 110
WriteEndpoints.Releases.cs 109
WriteEndpoints.Programs.cs 96
WriteEndpoints.Blockers.cs 70
WriteEndpoints.Products.cs 59

Because every file is the same partial class, the shared helpers (HealthFor, CanDelete, NextId, Clamp, ResolveKrLink, _log/UseLogger) stay in scope with zero reference rewrites and no namespace/module-boundary change (ADR-0072 unaffected). It's a pure mechanical slice at the section-banner boundaries — no endpoint logic touched.

Verification & scope notes

  • Behaviour-preserving: 507 backend tests pass, dotnet build green. A duplicate or missing route would fail the WebApplicationFactory-hosted tests, so green ⇒ every endpoint still registers exactly once.
  • The R7 max-lines ratchet is frontend-only (eslint over src/), so there's no C# pin to lower for this backend split. (A C# file-length analyzer could be a future addition.)
  • [R18] refactor: split the remaining god objects (one file per PR) #104 stays open for the remaining table files (Gantt.tsx, Admin.tsx, Dtos.cs, Pip.tsx, Teams.cs, and the folder-less screens), one PR each per the issue.

🤖 Generated with Claude Code


Generated by Claude Code

WriteEndpoints.cs was 805 lines with 34 endpoints inline in one ~735-line
MapAtlasWriteEndpoints method — the #1 god object in the R18 table. Split it
into a thin composer + seven per-entity partial-class files:

  WriteEndpoints.cs (83 lines) — fields, shared helpers (HealthFor, CanDelete,
    NextId, Clamp, ResolveKrLink), _log/UseLogger, and a MapAtlasWriteEndpoints
    that dispatches to the groups.
  WriteEndpoints.{Demands,Blockers,Projects,Programs,Products,Releases,OKRs}.cs
    — one Map<Group>Writes(RouteGroupBuilder) each (45–203 lines).

All files are `partial class WriteEndpoints` in namespace Atlas.Api, so every
shared helper stays in scope with zero reference rewrites and no module-boundary
change (ADR-0072 unaffected). Pure mechanical slice at the section banners — no
endpoint logic touched. Behaviour-preserving: 507 backend tests pass, build
green (a duplicate/missing route would fail the WebApplicationFactory tests).

The R7 max-lines ratchet is frontend-only (eslint on src/), so there is no C#
pin to lower for this backend split. #104 stays open for the remaining files in
the table (Gantt.tsx, Admin.tsx, Dtos.cs, Pip.tsx, Teams.cs, and the folder-less
screens) — one file per PR per the issue.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F1g44VLAeYdf3FAoXsXRu7
@nicpozent
nicpozent merged commit 81bf138 into main Aug 5, 2026
8 checks passed
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