Repository navigation
refactor(pm-aggregator): split server.ts (5,299 lines) under the production line limit (#13052) - #13093
Open
dezren39 wants to merge 1 commit into
Open
refactor(pm-aggregator): split server.ts (5,299 lines) under the production line limit (#13052)#13093dezren39 wants to merge 1 commit into
dezren39 wants to merge 1 commit into
Conversation
…production line limit (#13052) server.ts was 5,299 lines, grandfathered in the production line guard. Split along its existing seams with no behaviour change: - server-wiring.ts (412): config, stores, source selection, consumers, source-side sinks, fail-soft facet fallbacks - server-contexts.ts (809): the cached page/API context assemblies (board, roadmap, today, overview, attention, program) plus the health assembly, provenance priming and SLO summaries - server-pages.ts (716): the standalone token pages (Needs-Drew answer page, decision-set pages) and the PWA manifest - server-respond.ts (34): the json/jsonCompact/html/service-worker Response constructors - server-write-routes.ts (744): report-record resolution, the identity-registry admin + stack-token exchange, and the prompt / comment / action route families - server-alert-routes.ts (330): the alert throat - push subscriptions, test sends, incident intake, alerts pages - server-decision-routes.ts (457): Needs-Drew answers and the decision-set submit/defer/request-info/drafts routes server.ts (1,813 lines) keeps the read routes, the exact dispatch order (route literals stay in server.ts; the moved families are delegated to at their original positions), fetchHandler and the bootstrap. The move is verbatim: a line-multiset diff against the old file shows every original line preserved except one deliberate alias (hotListConsumer) needed for TS narrowing over the imported consumer binding. The server.ts grandfather entry is removed from check-production-line-limit.sh in the same PR, per the guard's convention. Verification: bun test 3328 pass / 3 fail (the 3 failures are the pre-existing sandbox-timeout failures also present on main; baseline was 3326 pass / 5 fail), bunx tsc --noEmit output identical to main (one pre-existing escalation-tick.ts error), guard contract tests pass and the guard no longer lists server.ts.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 53 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
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.
Closes #13052
What
pm-stack/aggregator/src/server.tswas 5,299 lines and grandfathered in.github/scripts/check-production-line-limit.sh. This PR splits it along its existing seams (wiring, contexts, pages, routes) with no behaviour change, and removes theserver.tsgrandfather entry from the guard in the same PR, per the guard's convention.Module map
server.tsfetchHandler, bootstrap + timersserver-wiring.tsserver-contexts.tsserver-pages.tsserver-write-routes.tsserver-alert-routes.tsserver-decision-routes.tsserver-respond.tsjson/jsonCompact/html/ service-worker Response constructorsEvery module is under the 2,500-line guard limit. The dispatch order in
handleris unchanged: the route literals stay inserver.ts(several test suites pin them there —nav.test.ts,board-view-8521,roadmap-view-8723,freshness-fallback-3976,ui-overhaul), and each moved route family is delegated to at its original position, returningnullwhen its routes do not match.The move is verbatim: a line-multiset diff of the new file set against the old
server.tsshows every original line preserved except one deliberate alias (const hotListConsumer = githubHotListConsumer) needed because TS does not narrow an imported binding inside the boot closure the way it narrowed the module-local one.Evidence
bun test(pm-stack/aggregator): 3328 pass / 3 fail / 1 error — baseline on main was 3326 pass / 5 fail / 1 error; the 3 remaining failures are the pre-existing sandbox-timeout failures (collect-fleet-feedaggregator(collect-fleet-feed): --out takes the next token blindly and unknown args are ignored — trailing --out crashes at startup with a raw TypeError, '--out --weird' writes the feed to a file named --weird, and a typo'd --otu silently overwrites the default feed #3509 ×2,deriveEpicEtaaggregator(forecast): capped resampling trials are recorded as completions, publishing optimistic P50/P80 dates #6386), a strict subset of the baseline set. The two baseline assembly-deadline PM aggregator /program still stalls on a cold first request #10383 failures pass in this run.bunx tsc --noEmit: output identical to main (one pre-existing error insrc/escalation-tick.ts, untouched).check-production-line-limit.sh:server.tsno longer listed (warning gone, entry removed, no new errors); the only remaining failures are the three pre-existing over-limit Rust files on main. Guard contract tests (check-production-line-limit.test.sh) all pass, including "every grandfather entry names an existing file".Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.