types: select services with a single copy of the project #1001
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 275 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.336
Real PR Conversation Timeline
1 comments
"Review active on #1001"
general
weight: 0.35
glours
What this PR does, in one sentence
It makes
Project.WithSelectedServicescopy the project once, instead of once per service it leaves out.Context
Selecting services disabled each unselected service through
WithServicesDisabled, which deep copies the whole project. For a project of n services of which k are selected, that is n-k full copies: the cost grows with the square of the model, and everycompose up webon a large project pays it. On a model of 300 services (environment, labels, volumes, a healthcheck, adepends_onchain), selecting one service takes 290 ms and allocates 484 MB. TheWithSelectedServicesload option goes through the same method, so it does not avoid the cost.What the PR brings
DisabledServicesin a single pass over one copy. On the same model, selecting one service takes 1.3 ms and 2.2 MB; a fullLoadProjectwith one targeted service drops from 1063 MB to 581 MB.WithSelectedJob, which disabled every service one by one for a job with no service dependency, now does it in a singleWithServicesDisabledcall.DisabledServicesstays nil when nothing is disabled. One difference: thedepends_onof the disabled services is now left as declared. The former loop pruned them depending on the iteration order of a map, so they were not deterministic.The tests check the contract (original untouched, no shared state with the copy, nothing disabled when everything is selected) and that the allocations grow linearly with the number of services; the latter fail on the previous implementation.
This follows the erooM law promoted by Tristan Nitot (_Effort Radicalement Organisé d'Optimisation en Masse_: optimize software by a factor of two every two years, by finding the components that consume the most resources and optimizing them). Profiling found the component here: selecting one service of a 300-service model goes from 484 MB to 2.2 MB allocated.
🤖 Generated with Claude Code