In this section
- GlobalGrid2050 Repair V6 Half Hourly Short Window Modes render · globalgrid2050 / scripts/repair_v6_half_hourly_short_window_modes.py lines 1–205
- GlobalGrid2050 Repair V6 High Low Trackers render · globalgrid2050 / scripts/repair_v6_high_low_trackers.py lines 1–101
- GlobalGrid2050 Repair V6 Inpage Chart Real Estate storage · globalgrid2050 / scripts/repair_v6_inpage_chart_real_estate.py lines 1–208
- GlobalGrid2050 Repair V6 Inspect Cache Buster storage · globalgrid2050 / scripts/repair_v6_inspect_cache_buster.py lines 1–78
GlobalGrid2050 Repair V6 Half Hourly Short Window Modes
A Python command-line tool in the scripts folder that replaces least (`replace_at_least_one`) and patches loader (`patch_loader`) and index (`patch_index`).
renderglobalgrid2050 / scripts/repair_v6_half_hourly_short_window_modes.py · lines 1–205 of 205 · Entry point · pattern patch_article (shared by 3 files)
- What it does
- It draws its content. Defines 12 functions or classes, including read, write, must_contain, replace_once, replace_at_least_one. Uses libraries pathlib, datetime. Side effects: changes the web page (DOM); reads or writes files.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 Repair V6 Half Hourly Short Window Modes Workflow (globalgrid2050).
- What it achieves
- It replaces once (`replace_once`) and is built from the assert final state helper (`assert_final_state`). Defines `read`, `write`, `must_contain` and 8 more.
- Why it matters
- Run by GlobalGrid2050 Repair V6 Half Hourly Short Window Modes Workflow.
- Application
- globalgrid2050 · scripts · Python CLI
- Uses
- pathlib, datetime
- Used by
- run by GlobalGrid2050 Repair V6 Half Hourly Short Window Modes Workflow (workflow run)
- Produces
- read, write, must_contain, replace_once, replace_at_least_one, patch_loader, patch_index, patch_article, patch_renderer, assert_final_state, write_report, main
- Defines here
- read, write, must_contain, replace_once, replace_at_least_one, patch_loader, patch_index, patch_article, patch_renderer, assert_final_state, write_report, main
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 scripts/repair_v6_half_hourly_short_window_modes.py:1-205 · blob b55fc3edb0c427b2fee55f2fc81c005457275b39 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: unknown · users: none · canonical: production_core
from pathlib import Path
from datetime import datetime, timezone
ROOT = Path(__file__).resolve().parents[1]
FILES = {
"ai_start": ROOT / "AI_START_HERE.md",
"protocol": ROOT / "uk_energy_tracking_v6" / "V6_ARCHITECTURAL_INTEGRITY_PROTOCOL.md",
"loader": ROOT / "uk_energy_tracking_v6" / "price_history_chart" / "load_price_history_data" / "load_price_history_data.js",
"renderer": ROOT / "uk_energy_tracking_v6" / "price_history_chart" / "render_price_chart" / "render_price_chart.js",
"index": ROOT / "uk_energy_tracking_v6" / "index.md",
"article": ROOT / "data" / "grid_studies_public" / "great_britain_electricity_price_grid_constraint_trends_2016_2026.html",
"report": ROOT / "uk_energy_tracking_v6" / "V6_REPAIR_HALF_HOURLY_SHORT_WINDOW_MODES_REPORT.md",
}
TOUCHED = []
def read(path):
if not path.exists():
raise SystemExit(f"Missing required file: {path}")
return path.read_text(encoding="utf-8")
def write(path, text):
old = read(path)
if old != text:
path.write_text(text, encoding="utf-8")
TOUCHED.append(str(path.relative_to(ROOT)))
def must_contain(text, needle, label):
if needle not in text:
raise SystemExit(f"Missing expected marker in {label}: {needle}")
def replace_once(text, old, new, label):
count = text.count(old)
if count != 1:
raise SystemExit(f"Expected exactly 1 match in {label}, found {count}: {old[:120]}")
return text.replace(old, new, 1)
def replace_at_least_one(text, old, new, label):
count = text.count(old)
if count < 1:
raise SystemExit(f"Expected at least 1 match in {label}, found {count}: {old[:120]}")
return text.replace(old, new)
def patch_loader():
path = FILES["loader"]
text = read(path)
must_contain(text, "function periodDays(p)", "loader")
must_contain(text, "function isDaily(p){return ['12m','5y','10y'].indexOf(p)>=0}", "loader")
old_days = "return {'12hday':0.5,'12hnight':0.5,'1d':1,'7d':7,'30d':30,'3m':92,'6m':183,'12m':366,'5y':1827,'10y':3653}[p]||7"
new_days = "return {'12hday':0.5,'12hnight':0.5,'1d':1,'24h':1,'48h':2,'7d':7,'30d':30,'3m':92,'6m':183,'12m':366,'5y':1827,'10y':3653}[p]||7"
if new_days not in text:
text = replace_once(text, old_days, new_days, "loader periodDays")
old_label = "return {'12hday':'12 hours day','12hnight':'12 hours night','1d':'1 day','7d':'1 week','30d':'1 month','3m':'3 months','6m':'6 months','12m':'12 months','5y':'5 years','10y':'10 years'}[p]||'1 week'"
new_label = "return {'12hday':'12 hours day','12hnight':'12 hours night','1d':'1 day','24h':'24 hours','48h':'48 hours','7d':'1 week','30d':'1 month','3m':'3 months','6m':'6 months','12m':'12 months','5y':'5 years','10y':'10 years'}[p]||'1 week'"
if new_label not in text:
text = replace_once(text, old_label, new_label, "loader periodLabel")
must_contain(text, "function isDaily(p){return ['12m','5y','10y'].indexOf(p)>=0}", "loader daily mode")
write(path, text)
def patch_index():
path = FILES["index"]
text = read(path)
old = "<option value=\"1d\">1 day</option>\n <option value=\"7d\" selected>1 week</option>"
new = "<option value=\"24h\">24 hours</option>\n <option value=\"48h\">48 hours</option>\n <option value=\"7d\" selected>1 week</option>"
if '<option value="24h">24 hours</option>' not in text or '<option value="48h">48 hours</option>' not in text:
text = replace_at_least_one(text, old, new, "V6 index period controls")
for marker in [
'<option value="30d">1 month</option>',
'<option value="3m">3 months</option>',
'<option value="6m">6 months</option>',
'<option value="12m">12 months</option>',
'<option value="5y">5 years</option>',
'<option value="10y">10 years</option>',
]:
must_contain(text, marker, "V6 index long range option")
write(path, text)
def patch_article():
path = FILES["article"]
text = read(path)
old = '<button type="button" data-start="2022-12-01" data-period="6m">2023 negative prices</button>\n <button type="button" data-dynamic="latest" data-period="7d" class="active">Latest 1 week</button>'
new = '<button type="button" data-start="2022-12-01" data-period="6m">2023 negative prices</button>\n <button type="button" data-dynamic="latest" data-period="24h">Latest 24 hours</button>\n <button type="button" data-dynamic="latest" data-period="48h">Latest 48 hours</button>\n <button type="button" data-dynamic="latest" data-period="7d … [line shortened here: 440 characters; full line on GitHub]
if new not in text:
text = replace_once(text, old, new, "main article chart controls")
write(path, text)
def patch_renderer():
path = FILES["renderer"]
text = read(path)
old_date_label = "function dateLabel(t,span){return span>45*86400000?new Date(t).toLocaleDateString('en-GB',{month:'long',year:'numeric'}):new Date(t).toLocaleDateString('en-GB')}"
new_date_label = "function dateLabel(t,span){return span>45*86400000?new Date(t).toLocaleDateString('en-GB',{month:'long',year:'numeric'}):new Date(t).toLocaleDateString('en-GB')}\n function shortTickLabel(t,span){var d=new Date(t);if(span<=2.1*86400000)return d.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:false});return d.toLocaleDateString('en-GB',{weekday:'short',day: … [line shortened here: 980 characters; full line on GitHub]
if new_date_label not in text:
text = replace_once(text, old_date_label, new_date_label, "renderer date label helpers")
old_axes = "function drawAxes(g,w,h,q,mm,pad,t0,t1){var st=step(mm.hi-mm.lo),start=Math.ceil(mm.lo/st)*st,span=t1-t0;g.font=11*q+'px Courier New';for(var v=start;v<=mm.hi+st*.5;v+=st){var y=pad.top+((mm.hi-v)/(mm.hi-mm.lo))*(h-pad.top-pad.bottom);g.fillStyle='#f5f7fb';g.textAlign='left';g.fillText('£'+fmt(v,0).replace('-0','0'),8*q,y+4*q)}g.save();g.strokeStyle='rgba(255,255,255,.26)';g.lineWi … [line shortened here: 741 characters; full line on GitHub]
new_axes = "function drawAxes(g,w,h,q,mm,pad,t0,t1){var st=step(mm.hi-mm.lo),start=Math.ceil(mm.lo/st)*st,span=t1-t0;g.font=11*q+'px Courier New';for(var v=start;v<=mm.hi+st*.5;v+=st){var y=pad.top+((mm.hi-v)/(mm.hi-mm.lo))*(h-pad.top-pad.bottom);g.fillStyle='#f5f7fb';g.textAlign='left';g.fillText('£'+fmt(v,0).replace('-0','0'),8*q,y+4*q)}g.save();g.strokeStyle='rgba(255,255,255,.26)';g.lineWi … [line shortened here: 786 characters; full line on GitHub]
if new_axes not in text:
text = replace_once(text, old_axes, new_axes, "renderer short window ticks")
must_contain(text, "function decimateRows(rows,limit)", "renderer decimation")
write(path, text)
def assert_final_state():
loader = read(FILES["loader"])
index = read(FILES["index"])
renderer = read(FILES["renderer"])
article = read(FILES["article"])
for needle in ["'24h':1", "'48h':2", "'7d':7"]:
must_contain(loader, needle, "loader short periods")
must_contain(loader, "function isDaily(p){return ['12m','5y','10y'].indexOf(p)>=0}", "loader long range preserved")
must_contain(index, '<option value="24h">24 hours</option>', "V6 index 24h")
must_contain(index, '<option value="48h">48 hours</option>', "V6 index 48h")
must_contain(index, '<option value="7d" selected>1 week</option>', "V6 index 7d")
must_contain(article, 'data-period="24h">Latest 24 hours</button>', "article 24h")
must_contain(article, 'data-period="48h">Latest 48 hours</button>', "article 48h")
must_contain(article, 'data-period="7d" class="active">Latest 1 week</button>', "article 7d")
must_contain(renderer, "function drawShortWindowTicks", "renderer short tick helper")
must_contain(renderer, "span>7.1*86400000", "renderer one week guard")
must_contain(loader, "window.V6LiveConfig.annualBase+year+'.csv", "loader annual CSV path")
must_contain(loader, "window.V6LiveConfig.dailyPriceHistory", "loader daily JSON path")
def write_report():
report = f"""# V6 Repair Report: Half Hourly Short Window Modes
Generated UTC: {datetime.now(timezone.utc).isoformat()}
## Scope
Only short chart windows up to 1 week were touched.
## Intended behaviour
1. 24 hours uses raw half hourly Elexon settlement data and should show up to 48 points.
2. 48 hours uses raw half hourly Elexon settlement data and should show up to 96 points.
3. 1 week uses raw half hourly Elexon settlement data and should show up to 336 points.
4. Periods beyond 1 week are not changed by this repair.
## Files touched by script
{chr(10).join('- ' + x for x in TOUCHED) if TOUCHED else '- No file content changes were required'}
## Guardrails checked
- AI_START_HERE.md present.
- V6_ARCHITECTURAL_INTEGRITY_PROTOCOL.md present.
- Long range daily aggregation remains 12m, 5y and 10y only.
- Annual CSV path remains unchanged.
- Daily aggregate JSON path remains unchanged.
- Renderer short window tick logic is guarded to 7.1 days maximum.
## Maintainer test checklist
1. Open /uk_energy_tracking_v6/.
2. Test 24 hours, 48 hours and 1 week.
3. Confirm 1 week shows roughly 336 visible records when a complete week is available.
4. Open /data/grid_studies_public/great_britain_electricity_price_grid_constraint_trends_2016_2026.html.
5. Test Latest 24 hours, Latest 48 hours and Latest 1 week.
6. Confirm 1 month, 3 months, 6 months, 12 months, 5 years and 10 years behave as before.
"""
FILES["report"].write_text(report, encoding="utf-8")
if str(FILES["report"].relative_to(ROOT)) not in TOUCHED:
TOUCHED.append(str(FILES["report"].relative_to(ROOT)))
def main():
ai = read(FILES["ai_start"])
protocol = read(FILES["protocol"])
must_contain(ai, "Do not directly rewrite large HTML, CSS or JavaScript files", "AI_START_HERE")
must_contain(protocol, "All V6 changes", "V6 protocol")
patch_loader()
patch_index()
patch_article()
patch_renderer()
assert_final_state()
write_report()
print("V6 half hourly short window repair completed.")
for item in TOUCHED:
print("touched:", item)
if __name__ == "__main__":
main()GlobalGrid2050 Repair V6 High Low Trackers
A Python module in the scripts folder.
renderglobalgrid2050 / scripts/repair_v6_high_low_trackers.py · lines 1–101 of 101 · Entry point
- What it does
- It loads data. Uses libraries pathlib. Side effects: reads or writes files.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 Repair V6 High Low Trackers Workflow (globalgrid2050).
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- Run by GlobalGrid2050 Repair V6 High Low Trackers Workflow.
- Application
- globalgrid2050 · scripts · Python module
- Uses
- pathlib
- Used by
- run by GlobalGrid2050 Repair V6 High Low Trackers Workflow (workflow run)
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 scripts/repair_v6_high_low_trackers.py:1-101 · blob d41e0aa62545e8b50ce57c0b5f2b8dc2ea777aaa · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: filesystem · domain stage: unknown · users: none · canonical: production_core
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
V6 = ROOT / "uk_energy_tracking_v6"
TARGET = V6 / "price_history_chart/render_price_chart/render_price_chart.js"
INDEX = V6 / "index.md"
REPORT = V6 / "V6_REPAIR_HIGH_LOW_TRACKERS_REPORT.md"
required = [
"AI_START_HERE.md",
"uk_energy_tracking_v6/V6_ARCHITECTURAL_INTEGRITY_PROTOCOL.md",
"uk_energy_tracking_v6/V5_V6_COMPARISON_REPORT.md",
"uk_energy_tracking_v5/price-history-ui.js",
"uk_energy_tracking_v6/price_history_chart/render_price_chart/render_price_chart.js",
"uk_energy_tracking_v6/index.md",
]
for rel in required:
path = ROOT / rel
if not path.exists():
raise FileNotFoundError(f"Required file missing: {rel}")
path.read_text(encoding="utf-8")
protocol = (V6 / "V6_ARCHITECTURAL_INTEGRITY_PROTOCOL.md").read_text(encoding="utf-8")
if "High, average and low values must not be hidden" not in protocol:
raise RuntimeError("V6 high average low chart contract not recognised")
v5 = (ROOT / "uk_energy_tracking_v5/price-history-ui.js").read_text(encoding="utf-8")
for token in ["function eventBox", "function drawPointer", "function drawEvents", "function drawDailyEvents"]:
if token not in v5:
raise RuntimeError(f"V5 reference tracker token missing: {token}")
text = TARGET.read_text(encoding="utf-8")
if "function drawHighAverageLowTrackers" in text:
raise RuntimeError("High average low trackers already present. Refusing duplicate repair.")
insert_after = " function compactDateText(t){return String(t||'').replace(/January/g,'Jan').replace(/February/g,'Feb').replace(/March/g,'Mar').replace(/April/g,'Apr').replace(/June/g,'Jun').replace(/July/g,'Jul').replace(/August/g,'Aug').replace(/September/g,'Sep').replace(/October/g,'Oct').replace(/November/g,'Nov').replace(/December/g,'Dec')}\n"
if insert_after not in text:
raise RuntimeError("Expected compactDateText marker not found. Refusing uncontrolled repair.")
tracker_functions = """ function trackerLines(label,val,date,clock){return[label,'£'+fmt(val,2)+'/MWh '+pence(val)+'p/kWh',compactDateText(date)+(clock?' '+clock:'')]}\n function drawTrackerPointer(g,point,q,x,y){g.save();g.strokeStyle='#ff3333';g.shadowColor='rgba(0,255,255,.55)';g.shadowBlur=7*q;g.lineWidth=1.4*q;g.beginPath();g.moveTo(point.x,point.y);g.lineTo(x,y-22*q);g.stroke();g.restore( … [line shortened here: 2,186 characters; full line on GitHub]
text = text.replace(insert_after, insert_after + tracker_functions, 1)
old_call = "g.restore();drawSummary(g,s,q,w,h,pad,isFull,isLandscape);set('ph-latest-price'"
new_call = "g.restore();drawHighAverageLowTrackers(g,s,q,w,h,pad,X,Y,isFull,isLandscape);drawSummary(g,s,q,w,h,pad,isFull,isLandscape);set('ph-latest-price'"
if old_call not in text:
raise RuntimeError("Expected post-dot drawSummary call not found. Refusing uncontrolled repair.")
text = text.replace(old_call, new_call, 1)
TARGET.write_text(text, encoding="utf-8")
updated = TARGET.read_text(encoding="utf-8")
for token in ["function drawHighAverageLowTrackers", "trackerLines", "drawTrackerPointer", "drawTrackerBox", "AVERAGE", "drawHighAverageLowTrackers(g,s,q,w,h,pad,X,Y,isFull,isLandscape)"]:
if token not in updated:
raise RuntimeError(f"Post repair assertion failed: {token}")
index_text = INDEX.read_text(encoding="utf-8")
old_src = "/uk_energy_tracking_v6/price_history_chart/render_price_chart/render_price_chart.js?v=20260601c"
new_src = "/uk_energy_tracking_v6/price_history_chart/render_price_chart/render_price_chart.js?v=20260602hilo1"
if old_src in index_text:
index_text = index_text.replace(old_src, new_src, 1)
elif new_src not in index_text:
raise RuntimeError("Expected V6 render script cache-bust URL not found")
INDEX.write_text(index_text, encoding="utf-8")
REPORT.write_text("""# V6 Repair Report: High Low Trackers
Status: prepared by deterministic repair script.
## Scope
This repair restores V5-style floating price tracker boxes inside the V6 electricity price chart.
## Behaviour changed
1. Adds floating chart callouts for HIGH, AVERAGE and LOW.
2. Uses the V5 event-box and pointer concept as the behavioural reference.
3. Applies to the normal in-page chart and fullscreen portrait chart.
4. Keeps fullscreen landscape clean by not drawing tracker boxes there.
5. Leaves the existing fullscreen portrait bottom summary box in place.
6. Bumps the V6 render script query string so the live page loads the repaired renderer.
## Files changed by workflow execution
1. `uk_energy_tracking_v6/price_history_chart/render_price_chart/render_price_chart.js`
2. `uk_energy_tracking_v6/index.md`
3. `uk_energy_tracking_v6/V6_REPAIR_HIGH_LOW_TRACKERS_REPORT.md`
## Explicit non scope
No V5 file changed.
No CSS changed.
No data feed changed.
No forecast wiring changed.
No period dropdown changed.
## Required maintainer test
Open `/uk_energy_tracking_v6/`, test the in-page chart, then enter fullscreen portrait. Confirm HIGH, AVERAGE and LOW tracker boxes render on the chart and the existing bottom summary box remains readable. Rotate to landscape and confirm the graph remains clean without tracker boxes.
""", encoding="utf-8")
print("V6 high low tracker repair prepared locally by script.")GlobalGrid2050 Repair V6 Inpage Chart Real Estate
A Python module in the scripts folder.
storageglobalgrid2050 / scripts/repair_v6_inpage_chart_real_estate.py · lines 1–208 of 208 · Entry point
- What it does
- It loads data. Uses libraries pathlib, re. Side effects: reads or writes files.
- Downstream impact
- Used directly by 3 files: GlobalGrid2050 Compare UK Energy V5 V6 V3 (globalgrid2050); GlobalGrid2050 Repair V6 Inpage Chart Real Estate Workflow (globalgrid2050); GlobalGrid2050 Update V5 V6 Granular Change Tracker (globalgrid2050). Reached from 2 other entry points, including GlobalGrid2050 Compare UK Energy V5 V6 V3 Workflow (globalgrid2050); GlobalGrid2050 Update V5 V6 Granular Change Tracker Workflow (globalgrid2050).
- What it achieves
- V6 electricity price chart layout repair.
- Why it matters
- Run by GlobalGrid2050 Compare UK Energy V5 V6 V3, GlobalGrid2050 Repair V6 Inpage Chart Real Estate Workflow and GlobalGrid2050 Update V5 V6 Granular Change Tracker.
- Application
- globalgrid2050 · scripts · Python module
- Uses
- pathlib, re
- Used by
- run by GlobalGrid2050 Compare UK Energy V5 V6 V3 (script call), run by GlobalGrid2050 Repair V6 Inpage Chart Real Estate Workflow (workflow run), run by GlobalGrid2050 Update V5 V6 Granular Change Tracker (script call)
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 scripts/repair_v6_inpage_chart_real_estate.py:1-208 · blob fa0bd35d96baea73c606d8a75d38bca65dfcb5cd · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: filesystem · domain stage: unknown · users: none · canonical: production_core
#!/usr/bin/env python3
"""
V6 electricity price chart layout repair.
Narrow scope:
1. Normal in page portrait chart height only.
2. Fullscreen toolbar and Period selector CSS only.
3. No data, fetcher, render calculation, V5 or frequency changes.
"""
from pathlib import Path
import re
ROOT = Path(__file__).resolve().parents[1]
V6 = ROOT / "uk_energy_tracking_v6"
CSS = V6 / "styles" / "app.css"
INDEX = V6 / "index.md"
REPORT = V6 / "V6_REPAIR_INPAGE_CHART_REAL_ESTATE.md"
required = [
ROOT / "AI_START_HERE.md",
V6 / "V6_ARCHITECTURAL_INTEGRITY_PROTOCOL.md",
V6 / "V5_V6_COMPARISON_REPORT.md",
V6 / "V5_V6_COMPARISON_REPORT_V2.md",
CSS,
INDEX,
]
for path in required:
if not path.exists():
raise FileNotFoundError(f"Required file missing: {path.relative_to(ROOT)}")
path.read_text(encoding="utf-8", errors="replace")
css = CSS.read_text(encoding="utf-8", errors="replace")
index = INDEX.read_text(encoding="utf-8", errors="replace")
# Remove only this final hard override if rerun. Older historic repair blocks are left alone,
# because this block is appended last and uses stronger selectors with !important.
css = re.sub(
r"\n/\* V6 hard override: fullscreen toolbar grid and safe selector\..*?\n/\* End V6 hard override \*/\n?",
"\n",
css,
flags=re.S,
)
hard_override = """
/* V6 hard override: fullscreen toolbar grid and safe selector.
This block must sit last so it defeats the older flex toolbar rules above. */
@media(max-width:850px) and (orientation:portrait){
#electricity-price-history-panel #price-history-canvas{
height:63dvh!important;
min-height:470px!important;
max-height:none!important;
}
}
.price-history-fullscreen-toolbar{
display:grid!important;
grid-template-columns:minmax(0,1fr) 40px!important;
grid-template-rows:22px 46px!important;
align-items:start!important;
gap:4px 8px!important;
height:76px!important;
padding:7px max(8px,env(safe-area-inset-right)) 5px max(8px,env(safe-area-inset-left))!important;
background:rgba(0,0,0,.82)!important;
border-bottom:1px solid rgba(0,255,255,.12)!important;
backdrop-filter:blur(4px)!important;
color:#00ffff!important;
font-family:"Courier New",monospace!important;
box-sizing:border-box!important;
}
.price-history-fullscreen-toolbar strong{
grid-column:1!important;
grid-row:1!important;
color:#00ffff!important;
font:800 12px/18px "Courier New",monospace!important;
letter-spacing:.08em!important;
text-transform:uppercase!important;
white-space:nowrap!important;
overflow:hidden!important;
text-overflow:ellipsis!important;
max-width:100%!important;
margin:0!important;
}
.price-history-fullscreen-toolbar button#price-history-fullscreen-close{
grid-column:2!important;
grid-row:1 / span 2!important;
justify-self:end!important;
align-self:start!important;
margin:0!important;
width:34px!important;
height:34px!important;
border:1px solid rgba(0,255,255,.35)!important;
border-radius:50%!important;
background:#05070c!important;
color:#00ffff!important;
box-shadow:0 0 12px rgba(0,255,255,.18)!important;
font:24px/1 "Courier New",monospace!important;
}
.price-history-fullscreen-period-label{
grid-column:1!important;
grid-row:2!important;
justify-self:start!important;
align-self:start!important;
display:flex!important;
align-items:center!important;
gap:9px!important;
margin:1ch 0 0 0!important;
color:#00ffff!important;
font:800 11px/1 "Courier New",monospace!important;
letter-spacing:.12em!important;
text-transform:uppercase!important;
}
.price-history-fullscreen-period-label select{
color-scheme:dark!important;
appearance:none!important;
-webkit-appearance:none!important;
min-width:150px!important;
max-width:58vw!important;
padding:8px 34px 8px 12px!important;
border:1px solid rgba(0,255,255,.45)!important;
border-radius:7px!important;
background:#05070c!important;
color:#00ffff!important;
font:800 14px/1.1 "Courier New",monospace!important;
box-shadow:0 0 12px rgba(0,255,255,.16),inset 0 0 18px rgba(0,255,255,.045)!important;
text-shadow:0 0 7px rgba(0,255,255,.35)!important;
}
.price-history-fullscreen-period-label select option{
background:#05070c!important;
color:#00ffff!important;
font-family:"Courier New",monospace!important;
}
.price-history-fullscreen-period-label::after{
content:"▾"!important;
margin-left:-31px!important;
color:#00ffff!important;
pointer-events:none!important;
text-shadow:0 0 8px rgba(0,255,255,.65)!important;
}
#price-history-fullscreen-meta{
display:none!important;
}
#price-history-fullscreen-canvas{
height:calc(100dvh - 76px)!important;
}
@media(orientation:landscape){
.price-history-fullscreen-toolbar{
height:64px!important;
grid-template-rows:18px 38px!important;
}
.price-history-fullscreen-toolbar strong{
font-size:11px!important;
line-height:16px!important;
}
.price-history-fullscreen-period-label{
margin-top:.6ch!important;
}
.price-history-fullscreen-period-label select{
min-width:138px!important;
font-size:12px!important;
padding:6px 32px 6px 10px!important;
}
#price-history-fullscreen-canvas{
height:calc(100dvh - 64px)!important;
}
}
/* End V6 hard override */
"""
css = css.rstrip() + hard_override
index = re.sub(
r'/uk_energy_tracking_v6/styles/app\.css\?v=[^"]+',
'/uk_energy_tracking_v6/styles/app.css?v=20260604toolbargrid1',
index,
)
if "20260604toolbargrid1" not in index:
raise RuntimeError("Cache bust token missing from index.md")
CSS.write_text(css, encoding="utf-8")
INDEX.write_text(index, encoding="utf-8")
REPORT.write_text("""# V6 Repair: Fullscreen Toolbar Grid and Safe Period Selector
Status: prepared by deterministic repair script.
## Why the earlier fix did not work
The live stylesheet still had the original fullscreen toolbar as a flex row. The close button still used margin left auto. That forced the title, Period selector and close button into one row.
The previous selector styling did not survive into the final live stylesheet in the required position, so the browser kept applying the old toolbar contract.
## Fix applied by this script
1. Adds a hard CSS override at the end of `app.css`.
2. Changes fullscreen toolbar from flex to a 2 row grid.
3. Row 1 left is the title.
4. Row 1 right is the close button.
5. Row 2 left is the Period selector.
6. The Period selector uses black background and cyan text, not cyan text on white.
7. The normal in page portrait chart remains `63dvh` with `470px` minimum height.
8. No chart renderer logic is changed.
9. No data logic is changed.
10. No V5 file is changed.
""", encoding="utf-8")
print("V6 fullscreen toolbar grid and safe selector repair prepared.")GlobalGrid2050 Repair V6 Inspect Cache Buster
A Python command-line tool in the scripts folder. It is built from the bump step (`bump`).
storageglobalgrid2050 / scripts/repair_v6_inspect_cache_buster.py · lines 1–78 of 78 · Entry point
- What it does
- It loads data. Defines read, write, must, bump, main. Uses libraries pathlib, datetime, re. Side effects: reads or writes files.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 Repair V6 Inspect Cache Buster Workflow (globalgrid2050).
- What it achieves
- Defines `read`, `write`, `must` and 1 more.
- Why it matters
- Run by GlobalGrid2050 Repair V6 Inspect Cache Buster Workflow.
- Application
- globalgrid2050 · scripts · Python CLI
- Uses
- pathlib, datetime, re
- Used by
- run by GlobalGrid2050 Repair V6 Inspect Cache Buster Workflow (workflow run)
- Produces
- read, write, must, bump, main
- Defines here
- read, write, must, bump, main
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 scripts/repair_v6_inspect_cache_buster.py:1-78 · blob 6d4f0bc44c8586a2c618bcfd6750d76a4161ed80 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: filesystem · domain stage: unknown · users: none · canonical: production_core
from pathlib import Path
from datetime import datetime, timezone
ROOT = Path(__file__).resolve().parents[1]
FILES = {
"index": ROOT / "uk_energy_tracking_v6" / "index.md",
"article": ROOT / "data" / "grid_studies_public" / "great_britain_electricity_price_grid_constraint_trends_2016_2026.html",
"renderer": ROOT / "uk_energy_tracking_v6" / "price_history_chart" / "render_price_chart" / "render_price_chart.js",
"report": ROOT / "uk_energy_tracking_v6" / "V6_REPAIR_INSPECT_CACHE_BUSTER_REPORT.md",
}
NEW_VERSION = "20260604inspect1"
TOUCHED = []
def read(path):
if not path.exists():
raise SystemExit(f"Missing required file: {path}")
return path.read_text(encoding="utf-8")
def write(path, text):
old = read(path)
if old != text:
path.write_text(text, encoding="utf-8")
TOUCHED.append(str(path.relative_to(ROOT)))
def must(text, needle, label):
if needle not in text:
raise SystemExit(f"Missing {label}: {needle}")
def bump(path):
text = read(path)
must(text, "render_price_chart.js?v=", str(path))
import re
text2 = re.sub(r"render_price_chart\.js\?v=[A-Za-z0-9_.-]+", f"render_price_chart.js?v={NEW_VERSION}", text)
must(text2, f"render_price_chart.js?v={NEW_VERSION}", str(path))
write(path, text2)
def main():
renderer = read(FILES["renderer"])
must(renderer, "ensureInspectControls(canvasId,result);attachInspectEvents(canvasId);", "connected inspect setup")
must(renderer, "drawInspectOverlay(g,result,q,w,h,pad,X,Y,canvasId);", "connected inspect overlay")
bump(FILES["index"])
bump(FILES["article"])
report = f"""# V6 Repair Report: Inspect Cache Buster
Generated UTC: {datetime.now(timezone.utc).isoformat()}
## Reason
The inspect overlay code was present and connected in the shared renderer, but both public pages still referenced the renderer with an old cache query string. Browsers and GitHub Pages could continue serving the old JavaScript.
## Change
Updated render_price_chart.js cache query string to `{NEW_VERSION}` in:
{chr(10).join('- ' + x for x in TOUCHED) if TOUCHED else '- No file changes required'}
## Guardrails
- No data files changed.
- No renderer logic changed.
- No loader paths changed.
"""
FILES["report"].write_text(report, encoding="utf-8")
TOUCHED.append(str(FILES["report"].relative_to(ROOT)))
print("V6 inspect cache buster repair completed")
for t in TOUCHED:
print("touched:", t)
if __name__ == "__main__":
main()