perf(#29): 3 output-neutral cleanups (held — do not merge during gate) - #472
Merged
Conversation
…, dead param) LOW-risk safe-to-apply fixes from the #29 audit (docs/investigations/2026-06-14-29-memory-perf-hotspots.md, §3 shortlist). All three are output-neutral by construction — no render/CSV/PDF logic touched, verified by build green + tests 159/0/5 (zero regression vs baseline). - H6 UtilityExtensions.cs: `new HttpClient()` per download call -> `static readonly HttpClient _sharedHttpClient`. Avoids socket exhaustion / GC pressure on long runs. Same payloads, output identical. - H5 PrintAndPlayDocument.cs: `File.ReadAllBytes(header)` called once per page in ComposePage -> read once via Lazy<byte[]> cache. Same bytes rendered, output identical. - H7 HarvestManager.cs: remove dead `consoleMessages` parameter (never written by Page_Console handler which logs via Log(), never written inside GenerateImages — confirmed by grep). Pure cleanup. Build: 0 errors, 18 pre-existing warnings (all in untouched files). Tests: 159 passed / 0 failed / 5 skipped (DoD met). No MED/HIGH hotspots touched (H1-H4 / H8 require deliberate profiling or design changes per the audit — out of scope here). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
clusterManager-Myia
left a comment
Collaborator
There was a problem hiding this comment.
[NanoClaw]
LGTM. Trois cleanups output-neutral bien ciblés :
- Shared HttpClient — corrige #29 H6 (socket exhaustion / GC pressure).
static readonlythread-safe, bon pattern. - consoleMessages dead code — param non utilisé retiré de
GenerateImages+ 2 call sites. Clean. - Header image cache —
Lazy<byte[]>éviteFile.ReadAllBytespar page dansComposePage(#29 H5). Null-safe.
Noté : PR marked "held — do not merge during gate". No concerns.
This was referenced Jun 15, 2026
jsboige
added a commit
that referenced
this pull request
Jun 16, 2026
…n + 12 tests (#504) Extract the field-conversion transform from CardSetLocalization.TranslateCardSetInfo (the #216 root-cause site) into a pure output-neutral static ApplyFieldConversions, plus a fail-loud companion FindAbsentSourceFields that surfaces the silent false-pass: source field names mapped in FrontFieldConversions but absent from the Mustache template. template.Replace silently no-ops when the pattern is missing, so a wrong mapping name leaves content untranslated with no error — exactly the #216 footgun. - ApplyFieldConversions: byte-identical to the previous inline logic (full suite 318/0/5, no regression). FormatField delegates to a shared static FormatFieldToken so production and the pure helpers share one source of truth. - FindAbsentSourceFields: pure capability, NOT yet wired to Logger in production. That one-line wiring is a deliberate post-gate follow-up to keep this extraction output- neutral during the release gate (the gate holds even output-neutral pipeline behaviour changes, cf #472). - FieldMappingContractTests (12): (a) present field -> replaced, global not first-match; (b) absent field -> silent skip documented as the hazard, AND surfaced by FindAbsentSourceFields; no-dest-lang conversion skipped (and not reported absent); (c) 4-CardSet lockstep (Fallacies/Virtues/Rules/Scenarii) — every 'en'-mapped front field is present in a real template, the regression guard that would have caught #216; plus real-Fallacies-template grounding. Contributes to #204. Refs #216. Co-authored-by: Your <your.email@example.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
3 LOW-risk, output-neutral perf cleanups from the #29 memory/perf audit §3 shortlist. Dispatched by ai-01 (
ou00g3v2) as the primary key-free task.Changes
UtilityExtensions.csnew HttpClient()per call →static readonly _sharedHttpClientPrintAndPlayDocument.csFile.ReadAllBytes(header)per page →Lazy<byte[]>cached onceHarvestManager.csconsoleMessagesparam (never written — confirmed by grep in both call sites + GenerateImages body)Proof of output-neutrality
Per dispatch rule: this PR is open but not self-merged. ai-01/jsboige decide timing post-validation (master untouched while jsboige validates the 64 Release PDFs on po-2023). The branch does not affect validation (jsboige validates already-regenerated artefacts).
🤖 Worker po-2024 (dispatch
ou00g3primary)