Daily Report — 2026-04-20

Daily Overview

  • What was done: Fixed critical issues in the gadget website build pipeline including missing daily chart images, Chinese summaries in English reports, BUILD BLOCKED errors, and chart styling problems
  • How it was done: Extended preflight_check.py with new validation rules, optimized translation prompts for small models, implemented staging-aware fix functions, adjusted chart generation parameters, and added chart backfill logic
  • Impact: Restored website completeness with all 65 daily charts properly displayed, eliminated language inconsistencies in bilingual reports, and established a robust two-phase fix mechanism (website + staging) to prevent sync overwrites

Debugged and fixed multiple issues in the gadget website build pipeline: image sync, frontmatter language validation, translation prompt optimization, and chart styling

Tasks

Architecture & Strategy

  • Fix missing daily chart images on website — Added static/images/daily to MANAGED_PATHS in sync_staging.py, implemented chart backfill in daily deploy, regenerated all 65 charts with correct styling
  • Fix Chinese summaries in English .md files — Extended check_language() to validate summary/description fields, changed translation prompt to English for en target (fixing 1.8B model context switching), made fix_language_issues() also fix staging sources
  • Fix relative chart image links — Added check_chart_links() to convert relative paths (2026-04-10-usage.png) to absolute (/images/daily/2026-04-10-usage.png) for both en/zh versions

Implementation & Fixes

  • Fix BUILD BLOCKED error — Excluded Resume.md/Resume.zh.md from frontmatter validation, fixed corrupted multi-line summary in 2026-03-25.zh.md
  • Standardize bugJournal titles — Implemented check_bug_journal_titles() to enforce format: ‘Bug Journal YYYY-MM-DD’, ‘Weekly Report YYYY-WXX’, ‘Monthly Report YYYY-MM’
  • Adjust chart styling — Changed font to Times New Roman, title 32pt / others 24pt, fixed x-axis to always show Claude Code + Codex (display 0 for missing data), removed bold from bar labels, set xlim to prevent edge squishing

Problems & Solutions

Critical Issues

1. Translation engine (1.8B model) failed to translate long Chinese summaries to English, always outputting Chinese

Solution: Changed build_translation_prompt() to use English instructions when target_lang==‘en’ instead of全中文指令, allowing the model to escape Chinese context and switch to English output

Key Insight: Small translation models (1.8B) are context-sensitive — Chinese prompts trap them in Chinese output mode. Using target-language instructions helps them switch output language

Solution: Modified all fix functions (fix_language_issues, fix_title_issues, fix_chart_links) to also fix staging source files (outputs/site/content/), not just website/content/

Key Insight: In a two-phase staging pipeline (staging → website), fixes must be applied to both sides to survive sync overwrites. The staging source is the authoritative copy

3. Daily charts missing from website despite being generated in outputs/images/summarize/

Solution: Added chart backfill logic to cmd_deploy() — after filtering deployed dates, scan for missing charts in staging and regenerate+copy without re-translating content

Key Insight: Deploy’s ‘already deployed’ check only looked at content existence, ignoring chart staging status. Asset deployment should be independent of content deployment state

Solution: Changed replacement to match both patterns: ‘(../images/xxx)’ and ‘(xxx-usage.png)’ → ‘(/images/daily/xxx)’, applied before translation so both en/zh get absolute paths

Key Insight: String replacements must match actual data patterns, not assumed patterns. Image link rewriting should happen pre-translation to ensure consistency across language variants

General Issues

5. Chart x-axis showing only one platform (Claude Code), Codex squeezed to right edge when no data

Solution: Fixed platforms list to always include both [‘Claude Code’, ‘Codex’], added ax.set_xlim(-0.5, 1.5) to keep bars centered, display ‘0.0M’/’$0.00’ for missing data

Key Insight: Matplotlib’s tight_layout + right legend causes x-axis compression with dynamic platform lists. Fixed xlim + fixed platform order prevents layout shifts

Human vs AI Approaches

Strategic Level

Realizing preflight fixes need to target staging sources

Role Approach
Human User pointed out ‘summary 中文问题又出现了’ after multiple fix attempts
AI AI kept fixing website/content/ files without realizing sync_staging.py overwrites them from outputs/site/content/ each time

Difference Analysis: Human’s pattern recognition (problem recurs) forced AI to trace the full sync pipeline and discover the staging source issue. AI should have mapped the data flow dependencies earlier

Role Approach
Human User directly checked the HTML output and reported links are still wrong, cutting through the intermediate debugging
AI AI assumed the deploy-time replace logic worked and tried to verify intermediate states

Difference Analysis: Human’s empirical validation (checking final HTML) caught the issue faster than AI’s assumption-based debugging. AI should verify end state before celebrating intermediate fixes

Implementation Level

Chart font size iteration

Role Approach
Human User requested specific font size (2.5x, then 1.5x, then 32pt) through trial-and-error visual inspection
AI AI executed each scaling request literally without suggesting optimal values upfront

Difference Analysis: Human’s iterative refinement based on visual feedback vs AI’s execute-then-wait approach. For subjective styling, iteration is necessary but AI could suggest reference ranges

AI Limitations

Critical Limitations

  • Failed to immediately recognize that preflight fixes must cover staging sources, leading to multiple cycles of ‘fix → gets overwritten → fix again’ before understanding the two-phase sync architecture
  • Took too long to diagnose translation prompt issue — initially explored chunking, model parameters, fallback strategies before realizing the root cause was Chinese instructions trapping the model in Chinese output mode

General Limitations

  • Did not proactively suggest optimal font sizes or reference standards for chart styling, requiring user to iterate through multiple size requests

Learnings

Key Learnings

  • For multi-stage pipelines (staging → deployment), fixes must be applied to the authoritative source (staging), not just the deployment target, to survive sync operations
  • Small translation models (~1-2B params) are highly context-sensitive: instruction language matters more than explicit target language specification. Use target-language instructions for better output switching
  • When debugging recurring issues, trace the full data flow from generation → staging → sync → deployment to identify where state gets overwritten
  • Asset deployment (images, static files) should be independent of content deployment state. Use separate ‘asset exists’ checks rather than inferring from content existence
  • For bilingual content, apply path normalization (relative → absolute) before translation so both language variants inherit consistent references. URL/path rewriting is language-agnostic and should happen pre-translation

Conversation Summaries

✅ Multi-system debugging: image sync, language validation, chart styling 04:42:09.324 | claude_code User reported missing daily chart images on the website. Investigation revealed a cascade of issues: missing MANAGED_PATHS entry in sync_staging.py, inadequate language validation in preflight_check (only checked body/title, not summary/description), Chinese translation prompts preventing small model from outputting English, relative chart image links, and undersized chart fonts. Fixed by extending preflight checks, optimizing translation prompts, implementing staging-aware fix functions, adding chart backfill logic, and adjusting chart styling (Times New Roman, 32pt title / 24pt body, fixed x-axis). Final outcome: all 65 daily charts correctly displayed with proper bilingual support and consistent absolute paths.

Token Usage

AI Usage · 2026-04-20 Claude Code + Codex
Total cost
$152.93
Total tokens
328M
Output tokens
1M
Cache read
78.2%
Cost split Claude Code $107 · Codex $46
Token character Cache reads 78.2% · Active 21.8%

Most token volume came from cache reads.