Skip to content

perf(#29): 3 output-neutral cleanups (held — do not merge during gate) - #472

Merged
jsboige merged 1 commit into
masterfrom
perf/29-output-neutral-cleanup
Jun 18, 2026
Merged

perf(#29): 3 output-neutral cleanups (held — do not merge during gate)#472
jsboige merged 1 commit into
masterfrom
perf/29-output-neutral-cleanup

Conversation

@jsboige

@jsboige jsboige commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Summary

3 LOW-risk, output-neutral perf cleanups from the #29 memory/perf audit §3 shortlist. Dispatched by ai-01 (ou00g3 v2) as the primary key-free task.

Changes

# File Fix Output impact
H6 UtilityExtensions.cs new HttpClient() per call → static readonly _sharedHttpClient none (same payloads)
H5 PrintAndPlayDocument.cs File.ReadAllBytes(header) per page → Lazy<byte[]> cached once none (same bytes)
H7 HarvestManager.cs remove dead consoleMessages param (never written — confirmed by grep in both call sites + GenerateImages body) none

Proof of output-neutrality

  • Build green (0 errors; 18 warnings all in untouched files).
  • Tests 159 passed / 0 failed / 5 skipped — matches baseline exactly (zero regression).
  • No render/CSV/PDF logic touched; no MED/HIGH hotspots (H1-H4/H8 need profiling/design — out of scope).

⚠️ HELD — do NOT merge during gate

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 ou00g3 primary)

…, 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 clusterManager-Myia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[NanoClaw]

LGTM. Trois cleanups output-neutral bien ciblés :

  1. Shared HttpClient — corrige #29 H6 (socket exhaustion / GC pressure). static readonly thread-safe, bon pattern.
  2. consoleMessages dead code — param non utilisé retiré de GenerateImages + 2 call sites. Clean.
  3. Header image cacheLazy<byte[]> évite File.ReadAllBytes par page dans ComposePage (#29 H5). Null-safe.

Noté : PR marked "held — do not merge during gate". No concerns.

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>
@jsboige
jsboige merged commit 93bdd67 into master Jun 18, 2026
3 checks passed
@jsboige
jsboige deleted the perf/29-output-neutral-cleanup branch June 18, 2026 09:35
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