R18 part 1 (#104): split WriteEndpoints god-method into per-entity files - #125
Merged
Conversation
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
3 tasks
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.
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-lineMapAtlasWriteEndpointsmethod).Split
partial class WriteEndpointsacross a thin composer + seven per-entity files (allnamespace Atlas.Api):WriteEndpoints.cs(composer: fields, shared helpers, dispatch)WriteEndpoints.Demands.csWriteEndpoints.Projects.csWriteEndpoints.OKRs.csWriteEndpoints.Releases.csWriteEndpoints.Programs.csWriteEndpoints.Blockers.csWriteEndpoints.Products.csBecause 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
dotnet buildgreen. A duplicate or missing route would fail theWebApplicationFactory-hosted tests, so green ⇒ every endpoint still registers exactly once.max-linesratchet is frontend-only (eslint oversrc/), so there's no C# pin to lower for this backend split. (A C# file-length analyzer could be a future addition.)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