content/auto-draft
needs attentionviewing older commitb7dd610 · incrementalPR #304reviewed 2026-07-14 01:43 UTC0H · 6M · 7L- Purpose
- Autonomous content drafting pipeline for the Batu Energy marketing blog — SEO-targeted informational articles about CFE tariffs for the solar/energy market in Mexico.
- Goal
- Publish a complete, accurate GDMTH tariff explainer with code-generated SVG visuals that illustrate the demanda-facturable crossover mechanism and the two-front (energy + demand) solar impact.
- Sub-goals
- SG-1: Correct the GDMTH solar section — the previous version understated solar's effect on the demand charge
- SG-2: Add DemandaFacturableSolarChart (crossover visualization) and SolarBillImpactChart (world vs Mexico comparison)
- SG-3: Register both components in the MDX renderer and wire them into the post
- What
- Rewrote the FAQ solar answer and the 'GDMTH y paneles solares' section to explain the dual energy+demand mechanism. Added two new SVG chart components. The demanda-facturable formula block was reformatted to expose the min() structure. A blockquote aside notes the same mechanism applies to GDMTO.
- Why
- The previous copy implied solar only affects the energy charge. The demanda-facturable formula (min of measured peak vs energy-derived demand) means solar can also reduce the demand charge past a crossover point — a Mexico-specific mechanism that was missing from the original draft.
- Areas
- apps/web/content/blog+189−0apps/web/src/components/blog+177−0apps/web/src/app/(marketing)/blog+2−2
- Blast
- 3 files, +369/−2 lines. All changes confined to apps/web marketing blog. Zero backend impact.
Findings · 13
correctness2
Formula variable-definition line reads as nonsensical multiplication
apps/web/content/blog/tarifa-gdmth.mdx:92
The line 'FC GDMTH = 0.57 · Energía en kWh del periodo · días = días del periodo' uses · as separator between variable definitions. A reader evaluating the formula reads this as 0.57 × Energía × días = días — dimensionally nonsensical. Use aligned label definitions with = and newlines, or commas/semicolons.
billArea polygon has redundant duplicate closing point
apps/web/src/components/blog/charts.tsx:385
dm(100)=108*(1-1)=0 so the loop ends with a point at y(0), and billArea appends another x(100),y(0). Two consecutive identical points — harmless visually but indicates a logic gap.
conventions5
Spanish-named component breaks English-only identifier convention
apps/web/src/components/blog/charts.tsx:365
All existing chart exports use English names (BillAnatomyDiagram, DemandVsConsumptionChart, etc.). DemandaFacturableSolarChart introduces a Spanish identifier into the component registry. Suggest: BillableDemandSolarChart or DemandCrossoverChart.
SUN color constant declared 250 lines below the brand token block
apps/web/src/components/blog/charts.tsx:265
Brand tokens (HELIOTROPE, VIOLET, GREEN, CYAN, MUTED) are all at lines 10–14. SUN = '#F4B740' is declared mid-file at line 265. Move it to the token block with its 'semantic accent' comment so all colors are discoverable in one place.
as const on rows forces unnecessary cast — no existing chart uses this pattern
apps/web/src/components/blog/charts.tsx:326
Either remove as const from rows or explicitly type impacted: string[]. No existing chart in this file uses as const.
Component definition order in charts.tsx is inverse to MDX usage order
apps/web/src/components/blog/charts.tsx:289
MDX uses DemandaFacturableSolarChart first, then SolarBillImpactChart. In charts.tsx the order is reversed. File previously matched narrative MDX order across all other charts — swap to restore the convention.
Import and mdxComponents lines exceed readable length without multi-line format
apps/web/src/app/(marketing)/blog/[slug]/page.tsx:9
Line 9 (import) is 171 chars; line 26 (mdxComponents) 183 chars. Existing multi-line import pattern elsewhere — split these for readability.
tests1
No visual regression or smoke test for new chart components
apps/web/src/components/blog/charts.tsx
Matches existing no-test pattern for static SVG charts. A Playwright snapshot of /blog/tarifa-gdmth would catch silent geometry regressions and MDX registry drift. Low priority.
improvement5
as const + (readonly string[]) cast defeats type safety for segment key lookup
apps/web/src/components/blog/charts.tsx:326
Declaring rows as const narrows impacted to readonly literal tuples, then (row.impacted as readonly string[]).includes(s.key) widens it back, silencing future typo regressions. Fix: type SegKey = 'Energía' | 'Capacidad' | 'Distribución' and impacted: readonly SegKey[] — .includes becomes fully type-safe with no cast.
segX uses slice+reduce on every call — fragile running-total idiom
apps/web/src/components/blog/charts.tsx:308
segX(i) recomputes prefix sum each call (O(n²) over 3 items). Precompute once: const segXs = segs.reduce((acc, s, i) => [...acc, (acc[i-1] ?? pad.left) + s.pct * barW], []). Trivial overhead but the lambda-over-slice form requires readers to mentally re-evaluate on each use.
dmPts samples at 10% steps — CYAN line misses exact crossover intersection
apps/web/src/components/blog/charts.tsx:381
Crossover is at ≈21.3%, between the 20% and 30% samples. The CYAN dashed line doesn't visually meet the VIOLET peak at the labeled 'Punto de cruce'. Add the crossover point to dmPts (like billPts does) for geometric precision.
Redundant duplicate closing point in billArea polygon
apps/web/src/components/blog/charts.tsx:385
dm(100)=0, so the loop's last push is x(100),y(0); billArea then appends another x(100),y(0). Dead data — SVG renders correctly, but end loop at pct < 100 and rely on billArea's explicit close.
SunMark uses index key for rays — prefer semantic key prefix
apps/web/src/components/blog/charts.tsx:275
key={i} on ray lines. Stable array so no reconciliation issue, but key={`ray-${i}`} is more semantically clear and avoids react/no-array-index-key lint warnings.
History · 14 commits
- c27ea57needs attentionincremental3H · 5M · 4L2026-08-04 17:46
- ff69645needs attentionincremental0H · 6M · 8L2026-07-28 18:21
- 0257d74safeincremental0H · 0M · 0L2026-07-20 23:00
- 0795a9dsafeincremental0H · 0M · 2L2026-07-20 22:42
- 5c57414needs attentionincremental2H · 7M · 10L2026-07-20 22:29
- 5a57a8fneeds attentionincremental0H · 5M · 8L2026-07-20 17:14
- cc9056eneeds attentionfull1H · 3M · 9L2026-07-20 16:40
- 8b79d33needs attentionincremental5H · 7M · 11L2026-07-14 18:10
- f0c337cneeds attentionincremental1H · 1M · 5L2026-07-14 17:15
- 5c9de97needs attentionincremental0H · 5M · 7L2026-07-14 17:02
- 92cce08needs attentionincremental1H · 4M · 3L2026-07-14 02:00
- b7dd610needs attentionincremental0H · 6M · 7L2026-07-14 01:43current
- 8c43554needs attentionfull0H · 2M · 1L2026-07-14 01:15
- 2149391blockedfull8H · 6M · 7L2026-07-10 17:30