Skip to content

docs(tools): fix bytecheck EOL bug + extend to Fallacies/Virtues taxonomy (read-only, 0 write) - #818

Merged
jsboige merged 1 commit into
masterfrom
chore/bytecheck-encoding-correction
Jul 16, 2026
Merged

docs(tools): fix bytecheck EOL bug + extend to Fallacies/Virtues taxonomy (read-only, 0 write)#818
jsboige merged 1 commit into
masterfrom
chore/bytecheck-encoding-correction

Conversation

@jsboige

@jsboige jsboige commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What

Correction and extension of the tick-24 byte-check audit (docs/investigations/2026-07-16-bytecheck-datasets-non-couverts.md + tools/bytecheck-datasets.py), on jsboige's request for a work session while the Cards lane is otherwise drained. Read-only: no CSV write, no template edit, no prod encoding change.

Why

The committed tick-24 report had a factual error and a coverage gap:

  1. Its detect_encoding() read only the first 64 bytes → falsely reported LF for Rules/Rules PnP/Scenarii (the first line break sits past byte 64 — headers are wide).
  2. It never scanned the two core production taxonomies (Fallacies 1408×104, Virtues 223×81) — the files that render most cards — which inverted the BOM story.

A committed report that is wrong on a fact + blind to the biggest datasets is worth fixing for accuracy, not left as-is.

Findings (corrected)

Encoding — BOM is the majority convention, EOL is CRLF everywhere

Dataset BOM EOL
Fallacies Taxonomy BOM CRLF
Virtues Taxonomy BOM CRLF
Rules BOM CRLF
Rules PnP BOM CRLF
Scenarii no-BOM CRLF

Tick-24 implied "Rules is the BOM anomaly". Reality once the taxonomies are included: 4/5 carry BOM; Scenarii is the lone no-BOM outlier. All 5 are CRLF-terminated (bare LF counts are in-cell Markdown newlines — normal).

i18n — clean

BOM impact on the pipeline (verified in C#)

Decision surfaced for jsboige (decision-ready, gated)

No action taken — this PR only surfaces the picture.

Out of scope

Verification

  • python tools/bytecheck-datasets.py re-runs idempotently, ~1.5s, stdlib only.
  • No C# touched → no build/test impact. 2 files / 96 insertions / 59 deletions.

Refs

— po-2024 (tick 28, jsboige work-session request)

…nomy (read-only, 0 write)

Correction + extension of the tick-24 byte-check audit (report + tool),
following jsboige's request for a work session. Still read-only: no CSV
write, no template edit, no encoding change on prod data.

Tool bug fixed (tools/bytecheck-datasets.py):
- detect_encoding() read only the first 64 bytes and tested `b"\r\n" in raw`.
  The first line break of every production CSV sits past byte 64 (header is
  wide: first CRLF at bytes 82..1235), so it falsely reported LF for all of
  Rules/Rules PnP/Scenarii. Now reads the whole file and separates the row
  terminator (CRLF) from bare LF inside quoted multi-line Markdown cells.

Coverage extended to the 2 core production taxonomies never scanned on the
encoding dimension:
- Fallacies Taxonomy (1408 x 104) and Virtues Taxonomy (223 x 81) added to
  TARGETS. Runtime ~1.5s, stdlib only, idempotent.

Findings (report rewritten):
- EOL is CRLF for all 5 render CSVs (tick-24 "LF" was wrong).
- BOM is the MAJORITY convention (4/5: Fallacies + Virtues + Rules + Rules
  PnP); Scenarii is the lone no-BOM file. Tick-24 framing ("Rules anomalous")
  was inverted.
- Fallacies 1408 rows: 0 FR contamination. Virtues: 2 hits both in link_*
  URL columns = the known #192 link-URL research gap (not text MT).
- Read-path is BOM-safe (pipeline reads BOM files fine; CsvBase decodes
  upstream, UtilityExtensions.TrimStart(BOM), dedicated diff-engine BOM test).
- Latent churn trap: GSheetSyncRunner.cs:98 writes UTF-8 no-BOM (no encoding
  arg). If #193 GSheet-sync (Enabled=false) is ever run in pull on the 4 BOM
  files, it rewrites them no-BOM -> whole-file diff. Decision A/B/C surfaced
  for jsboige before enabling #193.

Out of scope: CSV write (#202), BOM normalization decision (gated jsboige),
GSheetSyncRunner edit (needs #193 mandate), link_* research (#192, post-tag).

Re-run: python tools/bytecheck-datasets.py

Refs: #202, #193, #192, dispatch 07kpoq (tick 24), tick 28.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jsboige
jsboige merged commit 5d316e9 into master Jul 16, 2026
3 checks passed
@jsboige
jsboige deleted the chore/bytecheck-encoding-correction branch July 16, 2026 20:10
jsboige added a commit that referenced this pull request Jul 16, 2026
…ppers (read-only, 0 write) (#821)

Read-only check on the 29 integrated HTML mindmap wrappers regenerated by
#819 (the T&A review vehicle for gate (b)), extending the #818 encoding
thread. Answers a concrete de-risking question: did the #804 residual #3
(.content.svg declare encoding="utf-16" but are UTF-8+BOM, ai-01 Cycle H)
propagate into the file Thomas & Adeline actually open?

Result: NO. 0/29 wrappers carry the latent.
- 29/29 are really UTF-8, declare charset=UTF-8 (meta).
- 0 utf-16-declared-but-utf8 mismatches.
- Cause: MindMapHtmlWrapper.FormatWrapper strips the <?xml?> prologue and
  injects the SVG into an HTML shell with its own charset=UTF-8, so the
  erroneous utf-16 declaration is eliminated, not inherited.

Independently corroborates ai-01's Cycle H localization certification
(SHA256 #636 + script composition) on the freshest artifact (#819).

Tracked-not-fixed observation: 4/29 wrappers carry a BOM
(Fallacies_{ar,es,fa,zh}.html) — harmless (meta charset + BOM precedence)
but inconsistent. Fix = po-2023 regen lane (mindmaps), not po-2024
(Cards). Folded into po-2023's post-tag mindmap regen pass (#804 #1/#2/#3).

Out of scope: wrapper/.content.svg regen, MindMapHtmlWrapper edit, BOM
strip — all lane po-2023. No write prod this PR.

Refs: #819, #804 residu #3, #818, #458.

Co-authored-by: Your <your.email@example.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant