Eloverblik

Dokumentation · Arkitektur og beslutninger

Phase 1 – Build specification: the owner's own data in a browser

Status: version 1.4, 16 November 2026. Third and last architect round (brief orchestration/tasks/a1r2-phase-1-specification.md), written by worker elo-a1r2-phase-1-specification (Claude · Fable) after the round 2 reviews reviews/architecture/advisor-2.md (A2v-01…17) and reviews/architecture/codex-2.md (A2x-01…18, one blocker). Version 1.1 applies the fixes of the final review reviews/architecture/codex-3.md (A3x-01…12, no blocker; brief orchestration/tasks/a1f-phase-1-fixes.md). Version 1.2 is a consistency pass over the whole document by worker elo-a1c-phase-1-consistency (brief orchestration/tasks/a1c-phase-1-consistency.md): it repairs places where the document disagreed with itself and decides nothing; Appendix A lists each repair and what needs a decision. Version 1.3 writes in the lead's decisions on those eight points, N1–N8, of 16 November 2026 (worker elo-a1d-phase-1-decisions, brief orchestration/tasks/a1d-phase-1-decisions.md): each at every place it touches; Appendix A says where. Version 1.4 writes in the lead's decision N9 of 16 November 2026, that the state directory data/state/ is private (worker elo-a1e-state-directory-decision, brief orchestration/tasks/a1e-state-directory-decision.md), taken after finding B05v-01 of the review of the Eloverblik client: at every place it touches, with one new epic, B02b; Appendix A says where.

**Precedence. This document is the complete build specification of phase 1. Where it and docs/architecture/solution.md differ, this document wins.** solution.md remains the design of the whole product; its phases 2 to 4 are provisional and are re-planned before each phase starts. An epic of phase 1 is built from this document and the research it cites; solution.md need not be opened.

0. Reading guide

Inputs: docs/brief/ (owner's brief; decisions D1–D17, fixed), docs/research/ R1–R4, L1, L2, docs/sources/eloverblik/samples/, docs/design/ (task A2), the two round 2 reviews, and read-only <folder>/an earlier internal project. Conventions: Decision: marks a decision with its reason and what was rejected. "MP" is a metering point (18-digit GSRN); a "local day" is a day in Europe/Copenhagen; "R1 §9.1" is a research section, "A1x-02" is a finding of the round 1 review (reviews/architecture/codex-1.md), "A2x-01" and "A2v-01" are round 2 findings, "A3x-01" is a finding of the final review, "RT-03" is a row of a test table here, "N2" is a decision of the lead in Appendix A ("Needs a decision"; N9 under "Decision N9"), "B05v-01" is a finding of the review of an epic's build (reviews/build/B05-codex.md). Some IDs share their letters and are told apart by form: R1–R4 with a section or an open question are research documents, a bare R1–R9 is an invariant of §4.2; D1–D17 are the owner's decisions (D1 and D2 only here and in §1.1), "D1" anywhere else is the page D1 Målepunkt, and D04–D15 given as the type of an MP or a series (D14 and D15 in §3.3, D15 in B16b's row) are DataHub's type codes; an epic above B18 (B22, B27, B28, B44) is an epic of a later phase in solution.md. Types: int = int4, bigint = int8, ts = timestamptz, num(p,s) = numeric(p,s). Appendix A lists every finding of rounds 2 and 3 with what was done, the repairs of the consistency pass, and the decisions N1–N9.

The lead's rulings built in: a report from Eloverblik is evidence only with a declaration snapshot of the same day, the validation runs in a throwaway database, and the live declaration rows are compared with the snapshot once after 24 November 2026 (§9.4, §8); emission variances and intensities use only hours that have a factor on both sides, and the page says how many (§9.3); the dense time series chart is a phase 1 epic (B18); what phase 1 takes from the design task A2 is stated and the pages follow its notation manual (§11); the capture of the owner's history is finished before 31 December 2026 in an epic of its own (B06b).

1. Scope, shape and what was cut

1.1 Scope

In phase 1Not in phase 1 (re-planned with phase 2 or later)
The Customer API with one refresh token from the owner's .env (D1, D2)Several accounts, the sealed credential store, Keycloak, roles, row-level security
The MP tree, versioned master data, price areaHierarchy above the MPs, allocations, tags, boundary
Readings at 15 and 60 minutes, change log, per-day state and summaryCalendar-resolution readings; month tables; node-hours; any stored emission or cost fact
DeclarationGridEmission with history; methods LB-PA-125, LB-PA-200; GWP set as a parameterMunicipality, yearly and market-based methods; grid mix; prices, charges, cost
Pages X1 Overblik, A1 Forbrug (consumption or emissions), D1 MålepunktEvery other page; exports; anomalies; notifications
First load, daily 14-day run, weekly master data, manual re-fetchControl sweeps, coverage reconciliation, yearly re-fetch, closing sweep, off-peak window
A generated demo organisation for tests and make demoThe scale gate (B22), the public demo build

1.2 Services

Compose serviceImage / packageResponsibility in phase 1
postgrespostgres:18.7-alpine3.24, shm_size: 1gb (as an earlier internal project/deploy/compose.yaml)The only data store
migrateimage of services/api, one-shotBootstraps the roles elo_owner, elo_api, elo_worker; applies forward-only SQL migrations; loads seeds
apiservices/api (elo_api): FastAPI, Uvicorn, asyncpgNamed queries (§10). Reads only. Never calls an external service. Logs in as elo_api (not an owner, NOBYPASSRLS) and sets app.user_id to the one local user in every transaction, so that phase 2 adds identity without rebuilding
workerservices/worker (elo_worker)Scheduler (APScheduler, Europe/Copenhagen), job queue, Eloverblik ingestion, the declaration loader. The only process with outbound access and the only one that sees the token. Every Energi Data Service job (the declaration's two; phase 2's of §2.1 there) runs, in slices of at most 30 windows (B51; phase 2 §2.2), in a lane of its own (one thread, one at a time); every other job, the scheduler and the Eloverblik runtime run in the main loop; at a graceful stop a declaration job asleep in its wait gives it up within seconds and goes back to the queue with every attempt it had (B19). Runs as the host user's UID and GID, not as a user of the image (N9; below and §5.2)
caddycaddy:2.11.9-alpineServes the static web build and proxies /api; published on 127.0.0.1:8080 only

The stack runs in local single-user mode: no login, loopback only, and the API refuses to start when its public address is not a loopback address. Identity, the sealed token store and row-level security are phase 2; what this mode needs instead is in §12.

make up and the worker (B19). A running worker is stopped before the start ticket is written; after the ticket nothing is built or pulled; one make up runs at a time.

The worker's user (N9). The worker is the one service that mounts a directory of the host, data/state/ (§5.2), and it runs there as the user who owns it: Compose gives it user: "${ELO_UID:?}:${ELO_GID:?}", with no default, so that Compose starts nothing when either is unset; make up sets both from the user who runs it (id -u, id -g) and refuses to run as UID 0. The image need not know that UID. It has no passwd entry for it, and the service definition and the image carry what that requires:

RequirementDetail
A homeHOME is set under environment: to a directory that any UID can write and that is not the state directory (/tmp). Without a passwd entry Docker sets it to /, which the user cannot write
No user nameNothing asks the passwd database for the user's name or home (in Python getpass.getuser() raises without an entry). The database user is in DATABASE_URL; owner.json (§5.2) records host and PID, not a name
Writable pathsTwo: the mount /data/state, and /tmp. Nothing else is written at run time: the code and the virtual environment belong to root and are readable and searchable by every UID, bytecode is compiled at build or not written (PYTHONDONTWRITEBYTECODE=1), and no tool keeps a cache under the home
The other servicesUnchanged. None of them mounts data/state/ (§12.1) and none takes the host's UID

Jobs (defaults; all configuration; one module per job in elo_worker/jobs/, registered by discovery, so two epics never edit one registry file). There is no recompute, backup or housekeeping job in phase 1 (§1.4).

WhenJobWhat it does
Continuouslyjob-runnerTakes jobs from ops.job with SKIP LOCKED (copied from an earlier internal project)
While open chunks are dueeloverblik-backfillWorks the chunk queue, newest first (§6)
05:30 daily, plus up to 10 minuteseloverblik-dailyLists the MPs, plans uncovered tails, re-fetches the trailing 14 local days (§6.5)
Sunday 02:00eloverblik-weeklygetdetails for all MPs (§7)
04:30 dailyeds-loadRolling 120-day re-pull of the declaration (§8)
The 2nd of each month, 03:00eds-monthly-repullRe-pull from 1 January of the previous year (§8)

1.3 Names, commands, configuration

Nothing is named after [standard] (D5). Python: libs/core (elo_core: time rules, payload models with the allowlist, the chunk planner, the reference calculation; pure), libs/sources (elo_sources: MeteringSource, both clients, demo and replay sources; no database), services/api (elo_api, with migrations/), services/worker (elo_worker), tools (elo_devtools). Web: web/packages/{charts,notation-tokens,shell} as @elo/…, web/apps/elo-web. Also fixtures/ (generated: contract/, factors/), data/ (git-ignored: capture/, validation/, state/), deploy/, tests/. Compose project elo, address http://elo.localhost:8080, tool versions as an earlier internal project (R4 §3.6). Commands a person runs, each specified where it is named: make up, demo, status, verify, load-capture, refetch, probe-window, withdraw-day, set-price-area, validate, capture-purge, purge; and doctor (B71; phase 2 §6.2, docs/operations.md §7.2).

Operational settings are environment variables: ELO_CALLS_PER_MINUTE 60 (hard ceiling 100), ELO_TOKEN_SPACING_S 60, ELO_EDS_SPACING_S 60 (B51; a setting of migrate, installed in ingest.pace_setting), ELO_DAILY_WINDOW_DAYS 14, ELO_WITHDRAW_MIN_HOURS 20 (§4.3), ELO_FRONTIER_THRESHOLD 0.98 and ELO_FRONTIER_LOOKBACK_DAYS 45 (§2), ELO_ROW_BUDGET 2 000 000 (§10.3), ELO_ACCOUNT_PARTY_KIND 0 (unclassified, treated as private, §12). ELOVERBLIK_REFRESH_TOKEN is in the owner's git-ignored .env and reaches the worker only (§12). The three database roles have development passwords in deploy/dev.env.

1.4 The simple choices, and what each costs at 5 000 metering points

The lead's rule for this round: the simplest design that satisfies the invariants, with its cost stated so that phase 2 can revisit it with measurements. "L1 tree" is three hourly series and one quarter-hourly per site.

Choice in phase 1Class of error it removesCost at 5 000 MPsPhase 2 revisits with
One Eloverblik request in flight, the next spaced from its completion; one process merges readings (§5.2)Any reordering of responses for one MP; lock ordering; two calls sent closer than the spacingFor 5 000 L1 sites (20 000 MPs) a first load is 75 501 calls in series: 26 days if a call takes 30 s (unmeasured, R1 §9.4), 4.4 days at 5 s, plus one spacing per call (0.9 days). With 4 in flight it was 6.6 daysThe latency B06b measures; per-MP serialisation with several in flight
One transaction per response, all items (§4.3)Half-written days; a chunk marked without its dataAt most 10 MPs × 92 days × 24 = 22 080 rows (or 31 × 96 × 10 = 29 760) per transaction: no cost–
No stored emission facts, no aggregates beyond the day summary, no dirty queue (§9.1)Stale facts; a preparing state; a recomputation that misses a triggerA year of the root at day grain reads 5 000 × 8 760 = 43.8 million readings: not servable. Works to about 228 series-years per query (§10.3)B22: the stored day and month facts of solution.md §2.7–2.8
Like-for-like comparison computed per hour in the query (§9.3)A stored "matched" measure that drifts2 × 8 760 rows per MP and year: 87.6 million for the rootA stored matched measure, or a day-level definition
Every chunk of the window is requested; nothing is inferred from a refused neighbour (§6.3)An untested range declared unreadable (A2x-03)An MP whose access began in 2024 spends 12 of 24 quarterly calls on refusals; the capture's exhaustive search (§6.3 level 3) adds up to 2 requests per refused dayAccess bounds from a business login (B28), a search over anchors (B27)
Calendar-resolution answers are not stored (§4.5)Two stores that can both hold the same period (A2x-04)Monthly-read MPs have no consumption until phase 2The share of such MPs seen in B28
The watermark advances on every confirmation: one ts.day_load update per series-day in the 14-day windowA2x-0170 000 to 280 000 row updates a day; no reading row is touched–
Month partitions of ts.reading created by migration for 2020–2031; no partition jobA reading that fails because its partition is missing (A2v-05)None; make status warns below 12 future partitionsThe housekeeping job
No backup job. What cannot be fetched again is the capture: files the owner keeps (§12.2)–A dump of 35 to 150 GB nightly was never viable (solution.md §8.6)pgBackRest (B44)
raw.fetch_item and raw.payload unpartitioned and never droppedA dropping job in phase 17.3 million item rows a year: needs partitions and retentionB44
No result cache in the APIA cached answer that survives a writeEvery request runs its queryThe cache key of solution.md §6.4
Not built at all (A2v-10): ts.reading_period and ts.replace_period(), agg.*, calc.dirty, calc.run, the stored fact tables calc.emission_* (the function calc.emission_matched of §9.3 is not one of them and is built), core.mp_access, ingest.token_request, ref.municipality, the off-peak window, CSV export, the /News watchWhat each would have had to get right before the first viewAs the rows aboveThe re-plan of phase 2

2. Time

**Decision: every instant is a timestamptz in UTC, every interval is half-open [start, end), and every calendar period is a period of Europe/Copenhagen.** Reason: UTC keys are unambiguous on the 23- and 25-hour days and are what both sources deliver (L1, R2 §4.3). Rejected: local timestamps (the repeated hour collides).

TopicRule
Local daylocal_date = (interval_start AT TIME ZONE 'Europe/Copenhagen')::date. ref.calendar_day holds each day's UTC bounds and its length: 1 380, 1 440 or 1 500 minutes. 29 March 2026 is 2026-03-28T23:00Z–2026-03-29T22:00Z; 25 October 2026 is 2026-10-24T22:00Z–2026-10-25T23:00Z (L1). Months and years are calendar periods of local dates; a month figure is the sum of its local days
Expected intervals of a series-dayDay length ÷ resolution: 23, 24, 25 or 92, 96, 100. Completeness is measured in minutes, so resolutions add up
Hour cell(local date, local clock hour 0–23, occurrence). The occurrence is 2 for the second 02:00 of the 25-hour day and 1 otherwise; the 23-hour day has no cell for clock hour 2
Factor joinKey = the UTC hour of the interval start; a quarter-hour takes the factor of its hour (R2 §4.2)
Mixed resolutionsStored as delivered. At hour grain a quarter-hourly series is the sum of its quarters. At quarter-hour grain an hourly series is returned at its own resolution; nothing is split
RequestsEloverblik: dateFrom inclusive and dateTo exclusive are local dates (L1). Energi Data Service: timezone=UTC; window bounds are local midnights converted to UTC (the first local hour of 2021 starts 2020-12-31T23:00Z)
PresentationDanish formats (D4) from one formatting module in @elo/shell. The API returns ISO 8601 instants and local dates
Comparison with the previous yearA period [a, b] of local dates is compared with the same month-and-day range one year earlier (29 February maps to 28 February as a bound). Hour cells correspond by month, day, clock hour and occurrence; a cell without a counterpart (29 February, the two DST hours) is unmatched. Since B55 this is one of three kinds of comparison (py); the others (pp, from:<date>) correspond by offset or by whole months (phase 2 §3.4, docs/time-rules.md)

The frontier ("data through") of a selection is the latest local day d, among the last 45, on which Σ minutes with a quantity ÷ Σ expected minutes ≥ 0.98 over the selection's active consumption series (A2v-08): E17 roots with status "active", whose current access is not false (access not known, which no daily run has written yet, as after a replay, counts as active until a daily run says otherwise; B19), a readable_from on or before d (§6) and at least one stored day. If no day of the 45 qualifies, the frontier is the day with the highest coverage (the latest among equals) and the response carries frontierState: "low_coverage" with the percentage; without an active series there is no frontier and the pages show "no data". Period presets end at the frontier and the comparison period at the corresponding day. Holes before the frontier do not move it; they show in the coverage figure.

3. Storage

Schemas: ops, raw, ingest, core, ts, ref, fx, and calc (views and functions only). Every table has created_at ts unless it is a partition child. B03 creates every table of this section.

3.1 Request records (raw) and operations (ops)

Decision: no raw table holds a GSRN, an upstream free text or a field outside the allowlist (§7). Items are keyed by mp_id; errors are stored as the documented code only. Reason: an error string or an unknown field can carry a name, an address or a token (A1x-05, A1x-06).

TableGrain / PKColumns
raw.fetchone HTTP request; PK fetch_id bigint (identity)source smallint (1 Eloverblik Customer, 3 Energi Data Service, 8 replay of a capture, 9 demo), account_id int NULL, endpoint text, request_key text (endpoint, window, internal IDs; never a token or a GSRN), requested_at ts NOT NULL (the reserved start of the call, §5.2; for a replay the time the capture recorded), completed_at ts NULL, http_status smallint NULL (NULL: the row was written before the call and no response was recorded), duration_ms int, user_correlation_id uuid, server_correlation_id text, body_sha256 bytea, body_bytes int, item_count smallint, error_code int NULL, retry_after_s int NULL, credential_generation int, job_run_id bigint
raw.fetch_itemone requested entity in one response; PK (fetch_id, item_no smallint)mp_id int NULL, dataset_window text NULL, success bool, error_code int, outcome smallint (1 ok, 2 no data, 3 outside the available period, 4 permanent for this request, 5 retry later, 6 parse error, 7 unsupported unit, 8 stale on every day, 9 unsupported resolution), content_sha256 bytea, six day counters in series-days, by the mapping of §4.3 (N7): days_written int (loaded + changed), days_confirmed int, days_stale int, days_marked int, days_noted int, days_withdrawn int (nothing has no counter), rows_inserted int, rows_changed int, rows_deleted int, unexpected_error_text bool (the upstream text was not the documented name of its code; the text is discarded)
raw.payloadPK (fetch_id, item_no)encoding smallint (1 = zstd JSON), body bytea (after the allowlist, and with every metering point ID replaced by its mp_id, §7). Stored for items that wrote, changed or withdrew something and for parse errors. Not dropped in phase 1
ops.job, ops.job_runPK job_id bigint; PK run_id bigintAs an earlier internal project (kind, payload jsonb, state, run_after; job_id, started_at, finished_at, outcome, detail jsonb)
ops.data_versionone rowversion bigint. Incremented once in every transaction that changes a reading, a ts.day_load row (a confirmation and an absence mark included), a factor row or a price area; a response that is stale or a no-op on every day does not increment it (§4.3 step 4). Ingestion progress (ingest.chunk, ingest.mp_state) is not versioned: it is read afresh by every request

The recorder (elo_worker.ingest.recorder) is delivered by B03 with these tables; every epic that makes or applies a request (B07, B08a for the merge transaction of §4.3, B08b, B09, B11) calls it and none writes raw.* itself (A2v-05). The recorder owns the projection that the decision above needs (A3x-12): the allowlist keeps the ID fields, because parsing matches on them (§7), so before a body or a request key is stored the recorder replaces every metering point ID by its mp_id. B03 tests it on every raw table.

3.2 Ingestion state (ingest)

TableGrain / PKColumns
ingest.source_accountPK account_id int; one row in phase 1kind smallint (1 customer), label text, party_kind smallint (0 unclassified, 1 company, 2 private), status smallint (1 active, 3 invalid), credential_fingerprint bytea (SHA-256 of the refresh token; never the token), credential_generation int, token_expires_at ts (the refresh token's exp), last_ok_at ts, last_error_code int
ingest.pacerPK egress smallint CHECK (egress = 1); one rownext_start_at ts, token_next_start_at ts, cooldown_until ts NULL, cooldown_level smallint, consecutive_503 smallint, in_flight_kind smallint NULL (the kind of a reserved call whose completion is not yet recorded) (§5.2)
ingest.chunkone piece of work: one MP, one window; PK chunk_id bigint (identity)account_id int, mp_id int, purpose smallint (1 first load, 2 bootstrap of an MP awaiting first data (§6.3), 3 manual re-fetch), date_from date, date_to date (local dates, half-open), state smallint (§6.2), attempts smallint, solo bool, parent_chunk_id bigint NULL, lineage_id bigint (the chunk_id of the unsplit ancestor; its own for a root), next_try_at ts NULL, tries_after_park smallint, no_data_tries smallint, last_error_code int, last_fetch_id bigint, closed_at ts. CHECK (date_from < date_to). Exclusion constraint (extension btree_gist): EXCLUDE USING gist (account_id WITH =, mp_id WITH =, daterange(date_from, date_to) WITH &&) WHERE (state IN (1, 2, 3)): no two open chunks of one account and MP overlap
ingest.mp_statePK mp_idobserved_resolution smallint NULL, readable_from date NULL (§6.3), first_load_to date NULL, daily_ok_through date NULL, last_daily_ok_at ts, daily_failures smallint, last_daily_code int, current_access bool, and the latest attempted daily window, successful or not: last_daily_requested_at ts NULL, last_daily_date_from date NULL, last_daily_date_to date NULL (§4.3, §6.5). A daily run is recorded here, not as chunks, so the chunk table does not grow by a row per MP and day (A2v-12)
ingest.capture_importone imported capture; PK capture_id uuidmanifest_sha256 bytea, mp_map jsonb (capture-local MP number → mp_id), chunk_map jsonb (capture-local chunk ID → chunk_id, or null for a chunk that was not imported), applied_through int (the sequence number of the last captured response applied), imported_at ts, completed_at ts NULL (§6.4)
ingest.dataset_statePK dataset textnext_start_at ts, cooldown_until ts NULL (no longer read since B51: the pace of the service is the one row of ingest.service_pace, phase 2 §2.2), loaded_from ts, loaded_through ts, meta_last_update ts, caution_sha256 bytea, caution_changed_at ts, columns_seen text[], last_run_at ts, last_full_repull_on date, status smallint (1 ok, 2 stopped: an expected column is missing)
ingest.unknown_fieldPK (endpoint text, json_path text)first_seen ts, last_seen ts, occurrences int. The name of a field the allowlist does not know, never its value

3.3 Metering points (core) and reference data (ref)

TableGrain / PKColumns
core.metering_pointPK mp_id int; unique gsrn char(18)parent_mp_id int NULL, root_mp_id int, type_code text (→ ref.mp_type), account_id int, first_seen_at ts, last_seen_at ts, status smallint (1 active, 2 no longer listed, 3 no current access, 4 invalid ID), has_relation bool, is_moved_out bool NULL. The only table that holds a GSRN
core.mp_versionone observed version of master data; PK (mp_id, observed_from ts)observed_to ts NULL, content_sha256 bytea, fetch_id bigint, and one typed column per allowlisted field (§7): sub_type, physical_status, net_settlement_group, connection_type, disconnection_type, settlement_method, grid_area char(3), grid_operator_gln, grid_operator_name, municipality_code char(3), postcode, city, street, building_no, floor, room, location_description, dar_reference uuid NULL, supplier_gln, supplier_name, supplier_start date NULL, consumer_start date NULL, consumer_cvr, data_access_cvr, asset_type, capacity_kw num(12,3) NULL, reading_occurrence, unit, product, tax_reduction bool NULL, alias, meter_number, protected_name bool NULL (NULL: not known, as from the list response, which carries no protection flag; never stored as false), protected_address bool, occurrence_raw text. The columns street, building_no, floor, room, location_description, dar_reference are NULL unless protected_name is false and protected_address is false: the address is withheld unless the name is known to be unprotected (§7, N4)
core.mp_geoprice area of an MP over time; PK (mp_id, valid_from date)valid_to date NULL, grid_area char(3) NULL, price_area char(3) NULL, rule smallint (1 from the grid area, 3 set by make set-price-area). An MP without a price area has no emission figures and says so
ref.codePK (list text, code text)name_da, name_en, note. The code lists of R1 §5
ref.mp_typePK type_code textname_da, name_en, role smallint (1 consumption E17, 2 production E18 and D05, 3 export D06, 4 import from grid D07, 5 tax basis D15 and D14, 6 surplus D04, 9 other), fetch_timeseries bool (false for D99), in_energy_totals bool, chartable_as_load bool (false for D15 and D04: a daily amount in the first hour is not a load, L1). Seeded from R1 §5.1, §6.3
ref.price_areaPK code char(3)name_da, name_en (DK1, DK2)
ref.grid_areaPK (code char(3), valid_from date)name, price_area, source. Seed: the 45 areas of docs/sources/energi-data-service/samples/derived_grid-area-and-municipality-to-price-area_2026-08.json
ref.calendar_dayPK local_date datestart_utc ts, end_utc ts, minutes smallint, iso_year, iso_week, weekday, month, quarter, year. Generated for 2015–2040 from the PostgreSQL time zone database. Holidays are not needed in phase 1
ref.gwp_setPK gwp_set textch4 num(6,2), n2o num(6,2), source. Seeds: AR5 = 28 / 265 (the product default; stated by Eloverblik and Energinet, R2 §3.4.1), KK2025 = 28 / 273 (R3 §1.4)
ref.methodPK method_id smallint; unique codefamily, resolution, geography, allocation smallint, name_da, name_en, version int, status. Seeds: 1 LB-PA-125 "Lokationsbaseret · time · prisområde · 125 %" (allocation 1), 2 LB-PA-200 (allocation 2), both available. The other codes of solution.md §5.1 are reserved and not seeded

Consumption (measure E01) is the E17 root's own series; a parent and its children are never added (L2). Children are loaded and shown on D1 with their role; D15 and D04 are not charted as a load. The export child's series is the measure E03, shown beside E01 and subtracted from it only in the figure named net, ENET (B54; phase 2 §3.1).

3.4 Time series (ts) and emission factors (fx)

TableGrain / PKColumns
ts.seriesone series of one MP; PK series_id int; unique (mp_id, business_type text)source_unit text, to_kwh num(12,6) NULL (1 for KWH, 1 000 for MWH, NULL otherwise: not loaded), first_start ts, last_start ts
ts.readingone value; PK (series_id, interval_start ts); PARTITION BY RANGE (interval_start), one partition per Danish calendar month, e.g. FROM ('2026-03-01 00:00 Europe/Copenhagen') TO ('2026-04-01 00:00 Europe/Copenhagen'); partitions for January 2020 to December 2031 created by B03's migration; no default partitionseries_id int, quality smallint (1–5 = A01–A05), resolution smallint (15 or 60), interval_start ts, quantity num(15,3) NULL (kWh; NULL only with quality A02). Checks: resolution IN (15, 60); the start is a multiple of the resolution. The interval end is start + resolution
ts.day_loadstate and summary of one series and local day; PK (series_id, local_date date)State: accepted_requested_at ts NOT NULL (the watermark), content_sha256 bytea, fetch_id bigint (the response that is evidence for the current values), first_loaded_at ts NOT NULL (set once, never changed), last_changed_at ts, absent_since ts NULL, withdrawn_at ts NULL. Summary, always a function of the day's stored rows: resolution smallint, points smallint, kwh_sum num(15,3), minutes_measured (A04), minutes_estimated (A03), minutes_incomplete (A05), minutes_adjusted (A01), minutes_flagged_missing (A02), all smallint, kwh_estimated num(15,3), kwh_incomplete num(15,3)
ts.reading_changeappend-only log; PK change_id bigint (identity); index (series_id, interval_start); not partitionedseries_id, interval_start ts, old_present bool, old_resolution smallint NULL, old_quantity, old_quality, new_present bool, new_resolution smallint NULL, new_quantity, new_quality, changed_at ts, old_fetch_id, new_fetch_id. One row for every interval whose stored state changed after the first load of its day
fx.factor_hourPK (dataset smallint, price_area char(3), allocation smallint, hour_utc ts)co2_g num(12,6) (g/kWh), ch4_mg num(12,6) (mg/kWh), n2o_mg num(12,6) (mg/kWh), co2_origin_g num(12,6) (g/kWh before biogenic CO2 is set to zero), t_factor num(8,6), d_factor num(8,6), version smallint (1 Initial, 2 Preliminary, 3 Final), retrieved_at ts, meta_updated_at ts, fetch_id bigint, extras jsonb (columns the loader does not know; public data). dataset 1 = DeclarationGridEmission; allocation 1 = 125 %, 2 = 200 %, 3 = Total
fx.factor_hour_historyPK (dataset, price_area, allocation, hour_utc, superseded_at ts)The superseded or vanished row, and cause smallint (1 changed, 2 vanished)

**Decision: elo_worker has no INSERT, UPDATE or DELETE on the three tables of readings; it calls ts.apply_day() and ts.observe_absence() (§4.3), owned by elo_owner and run with its rights.** Reason: "written only through one function" is then a property of the database. elo_api has SELECT.

Size: the owner's four series over 2 144 days are 2 144 × (72 + 96) = 360 192 readings and 8 576 day rows, about 30 MB. At 5 000 hourly series over five years ts.day_load is 9.13 million rows of about 150 bytes, 1.4 GB, and 5.5 GB with four series a site; B22 adds it to the disk requirement (A2v-12).

The seam for a later lock (A2x-05). first_loaded_at is the instant a day first had readings and never changes; every later difference, a withdrawal and a reappearance included, is a row of ts.reading_change, and rows of one transaction are ordered by change_id, a day's deletions before its insertions (step A5). The interval set of a day at time T is therefore defined: nothing before first_loaded_at, otherwise the current set with every change after T undone in descending change_id. Phase 1 stores this and builds no as-of function.

4. Readings: one function, one watermark

This section replaces every earlier text on replacing readings, withdrawn days and stale responses. Findings: A1x-02, A2x-01 (blocker), A2v-01, A2x-04, and the seam of A2x-05.

4.1 Terms

TermMeaning
Response time traw.fetch.requested_at of the response: the reserved start of the request (§5.2), or for a replay the time the capture recorded. Because one request is in flight at a time, live responses have strictly increasing t in the order DataHub answered them
Delivered dayA local day for which an accepted item contains a Period of the series
Delivered range of a series in a responseFrom the first to the last delivered day, over all items of that MP in the response (an ID can repeat, one item per access period, R1 §3.1)
Content observation(series, day, t, the delivered points)
Absence observation(series, day, t) for a day strictly inside the delivered range that is not delivered
Not an observationAn item with any code other than 10000 (including 30015), an HTTP error, a day before the first or after the last delivered day, an item that fails validation. It changes no reading and no day state

4.2 Invariants

#Invariant (always true of the stored data)Kept by
R1For one series, at most one stored value covers any instantOne resolution per series-day; every interval lies inside its local day; the key (series_id, interval_start)
R2After a content observation is accepted for a day, the stored intervals of that day are exactly the delivered onests.apply_day() replaces the day as a set
R3accepted_requested_at is the greatest t among the observations accepted for the day, and an observation with t ≤ accepted_requested_at changes nothingThe first check of both functions
R4A day that has readings loses all of them only through two absence observations that are both live, both newer than every accepted content observation of the day, and at least ELO_WITHDRAW_MIN_HOURS apart; or by a person who names the day (make withdraw-day, §4.3)ts.observe_absence(); make withdraw-day goes through its step B6
R5The summary columns and content_sha256 of ts.day_load equal those computed from the day's rowsWritten in the same statement sequence; checked by make verify
R6first_loaded_at never changes; every later change of a stored interval has a row in ts.reading_changets.apply_day(), ts.observe_absence()
R7Applying a response twice has the effect of applying it onceR3 (the second time t is not newer)
R8A response is applied wholly or not at allOne transaction per response
R9Only one process at a time applies responsesThe session advisory lock elo.ingest

4.3 The algorithm

Before anything is written, each MP's items in a response are validated as a whole. One failure gives every item of that MP the stated outcome and changes nothing for it; other MPs of the response are unaffected.

#CheckOutcome on failure
V1success is true, errorCode is 10000, the document and its TimeSeries array are presentBy code (§6.2)
V2Every TimeSeries has a unit with a conversion to kWh (KWH, MWH)7 unsupported unit
V3Every Period has resolution PT15M or PT1H9 unsupported resolution (§4.5)
V4Every Period.timeInterval equals the UTC bounds of exactly one local day of ref.calendar_day, inside the requested window6 parse error
V5Positions are distinct integers from 1 to day length ÷ resolution; a quantity is a decimal with at most three decimals, or absent with quality A02; the quality is A01–A056 parse error
V6Across every TimeSeries and Period of every item of the MP, grouped by series and local day after the conversion to kWh: all representations of one series-day have the same resolution and the same set of points (position, quantity, quality)6 parse error

Identical representations of a series-day are one delivered day, so ts.apply_day is called once per series-day and the order of items and periods cannot decide what is stored (A3x-08). A quantity is never rounded and a failed item's payload is never read (R1 §3.1). Missing positions are allowed: they are simply not stored. A Period whose Point array is absent, null or empty counts as not delivered, so an empty period can never replace a day's values in one step; a point with quality A02 and no quantity is content.

The merge transaction (step 5 of §5.2), under the session lock elo.ingest:

  1. Complete the raw.fetch row; insert one raw.fetch_item per item (after the allowlist). 2. For each MP whose items pass V1–V6 and each of its series, in date order over the delivered range: a delivered day calls ts.apply_day(series, local_date, resolution, points, t, fetch_id), once (V6); an undelivered day inside the range calls ts.observe_absence(series, local_date, t, fetch_id, live), where live is false for the replay source. Each call's result is counted in its item's day counters (below). 3. Update the chunk rows or ingest.mp_state of the items (§6; a replay updates neither, §6.4); update the pacer (§5.2 step 5). 4. Increment ops.data_version once if any call returned something other than stale or nothing, that is, if a reading or a ts.day_load row changed: loaded, confirmed, changed, marked, noted, withdrawn. A response that is stale or a no-op on every day does not increment it (A3x-07). 5. Commit. Any error rolls the whole response back; the request is then an attempt that left no trace but its pre-written raw.fetch row.

ts.apply_day (steps A) and ts.observe_absence (steps B) return what they did. h is the SHA-256 over the day's delivered points as lines of interval start, resolution, quantity in kWh, quality, sorted by start.

StepConditionActionReturns
A1–SELECT … FROM ts.day_load WHERE (series, day) FOR UPDATE–
A2Row exists and t ≤ accepted_requested_atNothingstale
A3No rowInsert the readings; insert ts.day_load with first_loaded_at = now(), the watermark t, h, the summary, fetch_id. No change-log rowsloaded
A4Row exists, h = content_sha256Set the watermark to t; clear absent_since. No reading is touchedconfirmed
A5Row exists, h differsCompare the stored and the delivered set by interval_start (when the resolution differs, every stored row is a deletion and every delivered row an insertion). Delete, update and insert accordingly, and write one ts.reading_change row per interval that differs, with presence, resolution, quantity and quality on both sides; all deletions are logged before all insertions, so that undoing in descending change_id never meets two rows with one start. Update ts.day_load: h, summary, fetch_id, watermark t, last_changed_at, absent_since = NULL, withdrawn_at = NULLchanged
B1No row, or a row with points = 0Nothingnothing
B2t ≤ accepted_requested_atNothingstale
B3Not liveNothingnothing
B4absent_since is NULLabsent_since = t; watermark tmarked
B5t < absent_since + ELO_WITHDRAW_MIN_HOURSWatermark tnoted
B6OtherwiseDelete the day's readings and log each as a deletion; points = 0, kwh_sum = 0, summary zero, content_sha256 = the hash of the empty set, withdrawn_at = now(), last_changed_at, fetch_id, watermark twithdrawn

The day counters of an item (N7). Every call of the two functions is about one series-day and returns one of eight results. The merge transaction counts them on the item's raw.fetch_item row (§3.1):

ResultStepsCounter
loaded, changedA3, A5days_written
confirmedA4days_confirmed
staleA2, B2days_stale
markedB4days_marked
notedB5days_noted
withdrawnB6days_withdrawn
nothingB1, B3None. It is the remainder: the item's series-days minus the six counters

An item's series-days are, for each of its series, the days of the delivered range (§4.1). A series-day is counted once in a response, also when an ID repeats: a delivered day on the first item of its MP that delivers it, an undelivered day on the first item of its MP. An item that does not pass V1–V6 calls neither function and has all six counters at zero.

**Decision: a day is withdrawn only when it is missing inside the delivered range, twice, live, at least 20 hours apart; every other kind of absence leaves the stored values in place and visible as unconfirmed.** Reason: "no data" is also what a slow day, an edge of delivery, an edge of access and a transient 30015 look like, and deleting on such evidence loses history that cannot be fetched again; a day missing between two delivered days on two different days' runs is the one case in which the source has plainly dropped it. The price: a window that DataHub withdrew completely and answers 30015 for ever keeps its old values. They are never shown as confirmed, and make withdraw-day removes a named day through step B6 and logs it. Rejected: letting a repeated 30015 withdraw (A2v-01: two transient answers would delete fourteen days); never withdrawing.

A stored series-day is not confirmed (A3x-07) when it lies inside the MP's latest attempted daily window (ingest.mp_state.last_daily_date_from to last_daily_date_to, recorded for every attempt, §6.5) and its watermark is older than last_daily_requested_at: the latest attempt did not observe it. make status and D1 list such days with the reason: verification failed, with the code, when that attempt's item did not answer 10000 or the request got no response; not delivered when it did and the day lay outside the delivered range. A day with absent_since set is listed apart, as observed absent since that time: it was observed, and it was missing. The predicate does not depend on the last successful run, so repeated failures cannot leave old values looking confirmed.

4.4 Test cases (acceptance tests of B08a)

Stored state is written (value, watermark, flags). T = 10 means a response with t = 10; later numbers are later.

#FromGiven, in arrival orderExpected stored result
RT-01A1x-02A day stored as 96 quarter-hours, four of them 1 kWh each in one hour (T=10). T=20 delivers the day as 24 hourly points, that hour 4 kWh24 rows at 60 minutes; that hour sums to 4, not 7; 96 deletions and then 24 insertions logged, in that order of change_id; watermark 20
RT-02A1x-0224 stored points. T=20 delivers the day without position 523 rows; one log row old_present = true, new_present = false for position 5
RT-03A2x-01Value 1 (T=10). T=30 delivers 1 (same hash) and arrives first. Then T=20 arrives with 2(1, watermark 30). The T=20 day is stale; no log row
RT-04A1x-021 (T=10); 3 (T=30); then 2 (T=20) arrives(3, 30)
RT-05A2x-01Day delivered with 1 at T=30. Then two responses with T=12 and T=14 arrive whose range surrounds the day and lacks it(1, 30), absent_since NULL: both are stale
RT-06A1x-02Day stored (T=10). A live response T=40 lacks it inside its rangeReadings intact; absent_since = 40; watermark 40
RT-07A1x-02As RT-06, then a live response 25 hours later lacks it againReadings deleted and logged; points = 0; withdrawn_at set
RT-08A2v-01As RT-06, then a live response 5 minutes later (a retry, or a manual re-fetch after the daily run) lacks itReadings intact; noted, counted in days_noted and in no other counter; not withdrawn
RT-09A2x-01As RT-06, then the same response is applied again (same t)Nothing changes: stale
RT-10A1x-02As RT-06, then T=70 delivers the day with new valuesThe values of T=70; absent_since NULL
RT-11A2v-01, A2x-01Days stored. Two daily runs in which the item answers 30015Nothing changes in ts; ingest.mp_state.daily_failures = 2; last_daily_requested_at is the second run's t, although the last successful run is unchanged; every stored day of the window has an older watermark and is listed as not confirmed, verification failed (30015)
RT-12A2v-01One response with two items for the same MP: item 1 delivers days 1–5, item 2 days 6–10, all stored beforeAll ten confirmed; no day marked
RT-13A2v-01Days 1–14 stored. A response delivers days 1–11Days 12–14 untouched: no mark, watermark unchanged
RT-14A2v-01Live data stored at T=100. The capture (its t values are all below 100) is replayedEvery day stale; zero writes
RT-15–The same response applied twiceThe second application writes nothing
RT-16–The process is killed between two ts.apply_day calls of one responseNothing of that response is stored; a later run applies it whole
RT-17A1x-15A series in MWH with quantity 1; a series in KWT1 000 kWh stored; the KWT item has outcome 7 and nothing is stored
RT-18A2x-05A withdrawn day (RT-07) is delivered againRows inserted and logged with new_present = true; first_loaded_at unchanged; withdrawn_at NULL
RT-19A2v-01, A3x-08(a) Two items of one MP deliver the same series-day with different points. (b) One item delivers the day in two Period entries with different points. (c) One item delivers it in two entries with the same positions and quantities, one PT1H and one PT15MOutcome 6 for that MP in all three cases, in either order of the entries; nothing changes
RT-20–A Period that is not a whole local day; a position above the day's count; a quantity with four decimalsOutcome 6; nothing changes
RT-21L129 March and 25 October 2026, hourly and quarter-hourly23 and 25, 92 and 100 rows; expected minutes 1 380 and 1 500; both 02:00 hours of October are stored
RT-22A2x-01A stored window that from now on always answers 30015Values stay for ever; listed as not confirmed; make withdraw-day removes a named day and logs it
RT-23A2x-01Day stored at T=10. A replayed response with T=50 lacks it inside its range; a live one at T=60 lacks it tooAfter T=50 nothing (not live); after T=60 marked only: a replay never counts as a sighting
RT-24A3x-08, N7One item delivers a series-day in two identical Period entriests.apply_day runs once for the day: loaded, the rows stored once. The item's counters say so by the mapping above: days_written = 1, and days_stale and the other four are 0
RT-25A3x-07A day stored at T=10. T=20 delivers it unchanged. A live T=30 lacks it inside its range. Then T=25 arrives and is stale on every dayops.data_version rises by one for T=20 (confirmed) and by one for T=30 (marked), not for T=25; the dataVersion of the next query response shows it

4.5 Fixed and calendar resolutions: one store

**Decision: phase 1 stores readings of 15 and 60 minutes only. An item that contains a Period of any other resolution (P1D, P1M, P1Y, PXD) gets the outcome "unsupported resolution": nothing is stored, nothing is deleted or marked, its chunk becomes unresolved with that outcome, and the series is listed by make status.** Reason: with a single physical store, "no instant is covered twice" (R1) holds across everything stored, and no rule for precedence, promotion or partial months is needed (A2x-04). The owner's four series are hourly and quarter-hourly, and profiled history has aged out of the API's window (R1 §6.4). The capture keeps such answers as files, so phase 2 can load them when it has a rule. Rejected: a second table with an exclusion rule between the two, which is exactly the contract two rounds could not make exact. The Month answers used for the consumption check (§9.4) are requested with Month aggregation, kept as capture files and never stored as readings.

#FromGivenExpected stored result
UT-01A1x-08A monthly-read MP: Actual returns one P1M period of 3 000 kWh for MarchNothing stored; outcome 9; chunk unresolved; the MP's March consumption is "no data", not 3 000
UT-02A2x-04As UT-01; later the same MP delivers 15- or 60-minute readings for March totalling 3 100March sums to 3 100, not 6 100
UT-03A2x-04Fixed readings stored for March; a later response delivers March as one P1M periodThe fixed readings are unchanged: nothing deleted, no day marked; outcome 9
UT-04A2x-04A response delivers a calendar period covering part of MarchOutcome 9; nothing changes; no month is treated as complete
UT-05A2x-04One series delivers day 1 at 60 minutes and day 2 at 15 minutesBoth stored at their own resolution; the hour-grain sum of day 2 is the sum of its quarters
UT-06R1 §4.8One item with a 60-minute TimeSeries and a profiled PXD TimeSeriesOutcome 9 for the item; nothing changes

5. The Eloverblik client and pacing

5.1 The client (elo_sources.eloverblik)

The ingestion talks to a MeteringSource interface with five calls (health, list_metering_points, get_details, get_charges, get_timeseries), each returning one ItemResult per requested MP: the ID, an outcome, the source's error code, the parsed item. Implementations in phase 1: the Customer API, the demo source (generated) and the replay source (a capture directory). Exact paths are in R1 §4.2; parsing is per endpoint, there is no universal wrapper (R1 §3.1).

CallSuccess shapeErrors
GET …/isalivebare true503
GET …/token with the refresh token{"result": "<JWT>"}401, 403; codes 50000–50005
GET …/meteringpoints/meteringpoints?includeAll=true{"result": [dto…]}; children only inside childMeteringPoints (L1)401
POST …/meteringpoint/getdetails, …/getcharges (the second in the capture only){"result": [{success, errorCode, errorText, id, result}…]}Per item; 400 (ProblemDetails, or a string with #nnnnn: or [nnnnn]), 401, 429, 503
POST …/meterdata/gettimeseries/{from}/{to}/{aggregation}The same wrapper with MyEnergyData_MarketDocumentThe same
RuleDetail (L1, R1 §3.1, §4.8, §6.1)
TypesEvery scalar may be a string, including booleans ("False") and numbers. Absent, null and "" all mean "no value"; arrays may be null. Timestamps come as …Z and as ….000Z
MatchingOn id / MarketEvaluationPoint.mRID.name, never on order
Position → instantstart = Period.timeInterval.start + (position − 1) × resolution, in UTC
RequestsActual aggregation for readings: every series at its own resolution. At most 10 MPs per request (R1 §4.1), whatever their resolutions: one response may mix PT1H and PT15M (L1)
ErrorsThe documented code is kept; errorText and stackTrace are discarded
Never calledrelation/add (it cannot be undone, R1 §4.4); the CSV exports; getchargelinkswithcharges
TransportConnect timeout 10 s, read timeout 120 s (R1 §9.2), and one deadline of 130 s for a whole call; the lock elo.worker asked before a send and again after a gap of 2 s (packaging-and-setup.md §2.4, B101); no HTTP cache; a generic user agent

5.2 Pacing: every start is reserved before the call

Limits (R1 §9.1): 120 calls a minute per IP for all calls, 2 a minute for /token; on breach HTTP 429; HTTP 503 when DataHub is overloaded. Findings: A1x-16, A2x-17, A2v-05 item 3, A2v-11 item 5, A2x-16, A3x-03, A3x-04, A3x-10, B05v-01 (N9).

#InvariantKept by
P1Two calls of the deployment, of any kind (data, token, health, probe), are sent at least 60 / ELO_CALLS_PER_MINUTE seconds apart (1 s by default; never below 0.6 s). So no half-open minute holds more than 60 starts by default and never more than 100ingest.reserve_start(), ingest.finish_call(), one caller at a time
P2Two /token calls are sent at least ELO_TOKEN_SPACING_S (60 s) apartThe same
P3No call starts before cooldown_untilingest.reserve_start()
P4P1–P3 hold across restarts, crashes, a late dispatch, several processes and both modes (worker and capture)Reservation and completion are committed row updates; the recovery of step 0; the egress ownership and its handoff
P5An unused reservation is lost, never reusedNothing reads a past reservation
P6A request is sent with a data access token obtained from the refresh token currently configuredThe credential fingerprint (step 0)
P7A deadline (next_start_at, token_next_start_at, cooldown_until) is never moved earlierEvery update takes the greatest of the old and the new value

ingest.reserve_start(kind), one statement sequence in one transaction: lock the single ingest.pacer row FOR UPDATE; start = greatest(clock_timestamp(), next_start_at, cooldown_until, and for a token call token_next_start_at); set next_start_at = start + spacing, for a token call token_next_start_at = start + token spacing, and in_flight_kind = kind; return start. The database clock is the only clock.

ingest.finish_call(kind), in the transaction that records the completion (a response or a timeout): next_start_at = greatest(next_start_at, clock_timestamp() + spacing); for a token call also token_next_start_at = greatest(token_next_start_at, clock_timestamp() + token spacing); in_flight_kind = NULL.

**Decision: the next call is spaced from the completion of the previous one, not only from its reservation (A3x-04).** Reason: a reservation says when a call may start, not when it was sent. A process that is paused after reserving (a suspended laptop) sends late, the answer comes at once, and the next reservation would follow 0.01 s after the late send. Spacing from completion cannot be undercut by any delay before the send, and with one request in flight it costs one spacing per call. requested_at stays the reserved start: it orders the responses (§4.1). Rejected: recording the moment of sending (there is always a gap between reading the clock and the send).

One call, start to finish. The worker makes Eloverblik calls strictly one after another, token and health calls included, and holds the session advisory lock elo.ingest (R9) from before step 2 until transaction B has committed, so that no other process reserves or sends in between.

  1. At start: check the state directory (the decision "the state directory is private", below), then acquire the egress ownership (below). If in_flight_kind is set, the completion of a call was never recorded: call ingest.finish_call(in_flight_kind), so that the next call waits a full spacing from now, and a full token spacing if the unfinished call was a token call. Then compute the SHA-256 of the configured refresh token (the fingerprint). The access token is kept in a file (mode 0600; data/state/eloverblik-access-token, in the private state directory, which no service but the worker mounts) together with exp and the fingerprint of the refresh token that obtained it; a file with another fingerprint is deleted unread. The worker also compares with ingest.source_account.credential_fingerprint and, on a difference, stores the new one and increments credential_generation. This comparison is the worker's side of step 0 and needs the database: it is built and tested in B07 (PT-11, N3); the capture tool has no such row.
  2. If no access token of the current fingerprint has more than 30 minutes left, make a token call first (steps 2 to 5 with kind token). The token response is never stored or logged; of the token's claims only exp and tokenType are read (§12.1). 2. Transaction A: start = ingest.reserve_start(kind); for a time series request, attempts = attempts + 1 on every chunk of the batch, and for the daily request the attempted window of every MP in it (§6.5 step 3); insert raw.fetch with requested_at = start and http_status NULL. Commit. 3. Wait until start. Send. 4. Receive the response, or a timeout. 5. Transaction B (the merge transaction of §4.3): complete raw.fetch, apply the items, set chunk states, call ingest.finish_call(kind) and update the cooldown by the table below. Commit.
ResponsePacer and request
200cooldown_level = 0, consecutive_503 = 0
429cooldown_until = greatest(cooldown_until, completion + Retry-After, completion + local back-off), where the local back-off is 60 s × 2^cooldown_level, capped at 900 s. The cap applies to the local back-off only, never to Retry-After. cooldown_level + 1. The attempt is given back (attempts − 1); the batch is not split: a 429 is about rate, not about the request
503 or a read timeoutcooldown_until = greatest(cooldown_until, completion + Retry-After, completion + 60 s); consecutive_503 + 1. At 5 in a row completion + 900 s joins the greatest as one more lower bound, never as a replacement of a longer deadline, and the next call is isalive; data calls resume when it answers true. The chunk follows the ladder of §6.2
401 on a data callDelete the access-token file, obtain a new token once and retry; a second 401 stops the job and sets the account invalid
/token answers 401, 403 or 50001The account becomes invalid; Eloverblik jobs stop; make status and the pages say that a new token is needed (the account's state in meta.context, §10.4, §11.1)
400The code is parsed and stored; the request is never sent again unchanged (R1 §9.2); its chunks become unresolved

Retry-After is read in both forms of RFC 9110: delay-seconds, and an HTTP-date, which is converted to seconds after the completion. A value that is neither is ignored, and the local back-off applies. raw.fetch.retry_after_s holds the seconds (A3x-10).

isalive is called once before a backfill run and every 5 minutes during it; the daily run makes no health call.

Decision: the worker and the capture tool (B06b) share one egress ownership and one pacing history (A3x-03). The capture tool uses the same client with a file store for the pacer's values (data/capture/pace.json, written and synced at each reservation and each completion, under the same rules, recovery included); the worker always uses the database. Before its first Eloverblik call a mode must own the egress:

RuleDetail
OwnershipThe directory data/state/egress/lock/, created with mkdir, which is atomic on the host's file system also through the worker's bind mount, and holding owner.json: the mode (worker, capture), a start ID, host and PID, the time. Whoever creates it owns the egress. The other mode, started at the same instant or later, cannot create it and makes no call. The worker acquires it when it starts and, while it cannot, retries once a minute, runs its other jobs and is named by make status; the capture tool acquires it at start or exits with the explanation
ReleaseOnly by the owner, after its last response is recorded: it writes its deadlines and counters (next_start_at, token_next_start_at, cooldown_until, cooldown_level, consecutive_503) to the handoff record data/state/egress/pace.json (a temporary file, synced, renamed) and then removes the lock. The worker releases on a graceful stop (Compose stop_grace_period: 150s, longer than a read timeout), the capture tool at its end and on an interrupt
HandoffOn acquiring, a mode sets every deadline and counter of its own store to the greatest of its own value and the handoff record's. Its first call starts at least one ordinary spacing after the acquisition and, when the record was written by the other mode, its first token call at least one token spacing after it: the two stores read two clocks (the host's and the database's), and these waits cover their difference. A mode never starts from an empty history after the other has run. The first capture ever finds no record and needs no database
A lock left by a crashTaken over only by the same mode, which can prove that its predecessor has stopped and whose own durable store holds the predecessor's deadlines: the worker because Compose runs exactly one worker container (a fixed container_name) and nothing else runs the worker, and because it holds the database's lock elo.worker on the pace store's connection, and has waited 150 s where the owner record was left (packaging-and-setup.md §2.4, B101); the capture tool when no process with the recorded PID runs on the recorded host. It then applies the recovery of step 0. The other mode never takes over: it fails closed, names the owner and says how to release (start that mode and stop it gracefully)

Reason: the capture must not depend on the database epics (it carries the deadline); PostgreSQL is not published on the host (§12.1), so no check of its port can see a running worker, and a reachability check is not ownership anyway; and two stores are safe only if one mode calls at a time and the next mode continues the previous history: a capture's token call at T = 0 and a fresh worker's at T = 0.1 would otherwise be 0.1 s apart. The tool keeps its access token under data/state/, as the worker does and by the rules of step 0 (data/state/capture-access-token, mode 0600, with exp and the fingerprint; a file of its own, which the worker never reads), and never under data/capture/: that directory holds no token (§12.2, PT-12), and the owner keeps a second copy of it (N1). Rejected: the port check of version 1; one shared pace file with a file lock (locks between a container and the host are not reliable on macOS); the capture waiting for B03.

**Decision: the state directory is private (N9, B05v-01). A secret never lives in a directory that another user can write to.** data/state/ holds the two access-token files, the egress ownership and the handoff record. The build of version 1.3 made it and egress/ mode 0777, so that the host user (the capture tool) and the image's nobody (the worker) could both write there. In such a directory another local user can plant a symbolic link where a token is about to be written (B05v-01), and after the client was hardened against that the same user can still delete, replace or block every file in it (B05's report). The cause is the directory, so the directory changes:

RuleDetail
One userThe worker container runs as the host user's UID and GID (§1.2), not as nobody. Both modes are then the same user, and sharing the directory needs no permission for anyone else: no 0777, no group, no sticky bit
Modesdata/state/ and every directory under it are created 0700 by that user: by make up before the stack starts, by the capture tool at its start, never by Docker, whose directory would be root's. A file that holds a token is 0600, and no file there is writable by group or others. Nothing changes the mode or the owner of a directory that exists: one left 0777 by an earlier build is refused, and the owner repairs it. The capture tool's own pace store, data/capture/pace.json, is not in this directory and is private already (§12.2)
The start checkBefore a mode acquires the egress and before it reads or writes a token file, it examines every path component from the repository root down to data/state/, and data/state/egress/, with lstat, following no link. It refuses to start when one of them is a symbolic link, is not owned by the current user, or is writable by group or others (with or without the sticky bit). It then sends no call, makes no lock, reads, writes and deletes no file, and exits non-zero. The message names the path, what is wrong with it (a link, its owner's UID, its permission bits) and the refusing mode (worker or capture), and never a secret. The check ends at the repository root; what lies above is the owner's account
The worker's two halvesThe container sees the mount /data/state and none of the components above it. So make up runs the check on the host, for the mode worker, as the user it then gives the container, and starts no container when it refuses: the host half. The worker runs the check again inside the container at every start, on /data/state and /data/state/egress: the link and the permission bits always, the owner where the mount reports it (next row). A refused worker exits non-zero, and make up fails with its message
The mount check of make upAfter the host half and before the worker starts, a one-shot container of the worker's image, with the worker's user: and mount, works on a probe file of a name of its own, which is removed afterwards; the egress lock is not touched. make up stops unless (1) a 0600 file made on the host is read in the container, (2) a 0600 file made in the container is, on the host, the host user's with mode 0600, and (3) the directory's permission bits read in the container are the host's. Then the same container, run as another UID, tries to read the host's file. Denied: the mount enforces ownership, and the worker's half compares the owner (ELO_STATE_MOUNT=enforcing, also the meaning of the variable unset). Read: the mount performs every access as the host user and reports no dependable owner, and the worker's half leaves the owner to the host half (ELO_STATE_MOUNT=passthrough). make up sets the variable and prints which it found. (1) also fails when the mount's source is not the host's directory: on macOS a path spelled in another letter case than on disk is another, empty directory inside the VM
UnchangedThe ownership by mkdir, release by the owner only, the handoff, and the rule that a mode never takes over the other mode (the table above). Only who may write the directory changes

Linux and macOS under Colima. The two rows above exist because the bind mount is not the same thing on both. On a Linux host the container reads the host's file system directly: owner and permission bits are the host's and are enforced, and the mount check is expected to find enforcing; B02b's stack check in CI is the measurement. **Measured on the owner's machine on 16 November 2026 (macOS, Colima profile elo, mount type virtiofs):** permission bits and symbolic links pass the mount unchanged in both directions, and what a container creates is the host user's on the host with the mode it was given; but a container of another UID read a 0600 file in the 0700 directory, and the owner reported for one directory changed from one read to the next (0, 501, 12345). There ownership is neither reported nor enforced inside the VM: the host's file system keeps other users of the host out, which is the boundary of this decision, and inside the VM the boundary is which service mounts the directory (the worker alone, §12.1). A worker that compared the owner there would refuse at random; a worker that compared nothing would accept a 0777 directory. With the two halves the three conditions are judged on both platforms, each where it can be read truthfully.

Rejected: the sticky bit (1777 stops others renaming and deleting, not adding files, and the tokens would stay among files of others); a group of the two users with mode 2770 (a group to keep in step on the host and in the image, where one user does it); nobody with a directory of its own for the worker's token (the egress lock and the handoff record would stay in a directory others write).

Test cases (B05, against the file store under a simulated clock, **asserting the times at which calls are sent, not the reservations returned**; B03 repeats PT-02, PT-04, PT-05, PT-09 and PT-13 against ingest.reserve_start() and ingest.finish_call(); B07, the first epic with the PostgreSQL store, repeats PT-02, PT-09 and PT-13 with that store through the client. PT-10 and PT-15…PT-18, all five, run two modes with two stores against one log of outbound starts (a test double, not the recorder of §3.1): in B05 the file store and an in-memory store, in B07 the file store and the PostgreSQL store, in B06b through the tool. PT-11 has two halves (N3): B05 asserts what needs no database (the file is deleted, the first call is /token with the new credential, no data call carries the old access token), B07 what needs one (the comparison of step 0 on the worker's side, the generation on ingest.source_account and on every later raw.fetch row). PT-19…PT-22 (N9) are B02b's: PT-19…PT-21 against the start check and through the client in each mode, with the log of outbound starts empty, and again through the tool in B06b; PT-22 on the live stack):

#FromGivenExpected
PT-01A1x-16500 calls, token, health and data mixedNo half-open 60-second window holds more than 60 sent starts
PT-02A2x-17A data request is started; the process is killed and restarted at once; another request is startedThe second start is at least one spacing after the first reservation and after the restart (the recovery of step 0)
PT-03A2x-17Ten restarts in ten seconds, each needing a token, with no token fileAt most one /token call per 60 seconds. With a valid token file: no /token call
PT-04A2x-17Two processes reserve against one store at the same timeAll sent starts are distinct and at least one spacing apart: the second caller waits for the first's completion
PT-05A2x-17A process reserves and dies before sendingThe next start is later than the lost reservation; the lost slot is not reused
PT-06A1x-16429 without Retry-After; then another 429No start for 60 s; then for 120 s; the local back-off is capped at 900 s; the request is not split and its attempt is given back
PT-07A1x-16429 with Retry-After: 90No start for 90 s
PT-08A2x-17503 with Retry-After: 300; 503 without; five 503 in a row300 s; 60 s; 15 minutes and isalive first
PT-09A1x-16A cooldown is set and the process restartsNo call starts before cooldown_until
PT-10A2v-05, A3x-03The worker and the capture tool start at the same instant, in either order of arrival, with PostgreSQL not publishedExactly one owns the egress and calls. The other makes no call: the capture tool exits and says why; the worker retries each minute and calls only after the release
PT-11A2x-16The worker restarts with a different refresh token while the token file holds a valid access token of the old oneThe file is deleted; the first call is /token with the new credential; no data call carries the old access token (B05). ingest.source_account holds the new fingerprint, its credential_generation is one higher and is on every later raw.fetch row (B07)
PT-12A1x-16, A3x-12The request log and the capture's files are scanned after the suiteNo token, no claim, no Authorization header; no body file of a token response
PT-13A3x-04A call is reserved; the process is paused until 10 s after its start and then sends; the response arrives within 10 ms; another call follows. Repeated with a crash in place of the response, with two contending callers, and with two token callsThe second call is sent at least one spacing after the completion of the first (after the recovery, in the crash case); the second token call at least 60 s after it
PT-14A3x-10A 429 with Retry-After: 1800; the fifth 503 in a row with Retry-After: 3600; a Retry-After given as an HTTP-date 40 minutes ahead; the process restarts during each cooldownNo start for 1 800 s; for 3 600 s; for 40 minutes. Neither the 900-second cap, nor the 15-minute pause, nor the restart shortens them
PT-15A3x-03The capture tool makes a token call and exits; the worker starts 0.1 s later without a token fileThe worker's first call starts at least one spacing, and its token call at least 60 s, after the capture's token call
PT-16A3x-03As PT-15 with the worker first and the capture tool secondThe same
PT-17A3x-03The owner of the egress is killed during a call. Then (a) the same mode starts; (b) the other mode starts(a) takes over, recovers its store and waits a full spacing, and a full token spacing if the call was a token call; (b) makes no call and names the owner
PT-18A3x-03The worker receives a 503 with Retry-After: 600 and is stopped gracefully; the capture tool startsThe capture's first call is not before that cooldown_until; consecutive_503 is carried over
PT-19N9, B05v-01data/state/ has a group or other write bit (0777, as the build of version 1.3 left it; 0770; 0702; 1777); in turn data/state/egress/, data/ and the repository root have one. Each mode startsThe mode refuses to start: no call is sent, no lock is made, no token file is read, written or deleted, and nothing in the directory changes. The message names the path, its bits and the mode, and no secret. With the bits removed (0700) the same start succeeds
PT-20N9, B05v-01Each of the same components in turn is a symbolic link to a directory that is itself private (the user's own, 0700). Each mode startsThe same refusal; the link is named and not followed
PT-21N9data/state/, and in turn a component above it, belongs to another user and has no group or other write bit (made without root: the check runs with another current UID than the owner's). Each mode startsThe same refusal, naming the owner's UID. The worker's half in the container refuses where the mount enforces ownership and leaves the owner to the host half on a pass-through mount (the mount check)
PT-22N9The live stack on a state directory of the check's own, on a Linux host and on macOS under Colima: make up with the directory absent; then with it 0777; then docker compose up without ELO_UID and ELO_GIDAbsent: it is created 0700 with egress/; the host's 0600 file is read by the worker container and the container's is the host user's 0600 file on the host; the worker runs under a UID the image has no passwd entry for; the mount check prints which kind of mount it found. 0777: make up stops before any container starts, and a worker started on that directory without make up refuses too. Without the variables Compose starts nothing

6. Chunks, first load, access edges, daily run

Findings: A1x-09, A1x-10, A2x-02, A2x-03, A2v-02, A2v-12, A2x-18, A3x-01, A3x-02, A3x-06, A3x-09. **Decision: the planner is a pure module (elo_core.plan): functions from a set of chunks and an outcome to a new set of chunks and the next request. The worker keeps the chunks in ingest.chunk, the capture tool in data/capture/<run>/chunks.jsonl.** Reason: the state machine and the edge search are one implementation, tested once, and the capture runs without a database.

6.1 Planning

RuleDetail
The API's windowFrom 1 January of (current year − 5) to today: on 15 November 2026 [2021-01-01, 2026-11-15), 2 144 local days, 24 calendar quarters, 71 calendar months (R1 §6.6; the exact cut-off is unverified)
Chunk sizeCalendar quarters for an MP whose meterReadingOccurrence is PT1H; calendar months for PT15M or unknown. At most 92 × 24 × 10 × 85 bytes = 1.9 MB and 31 × 96 × 10 × 85 = 2.5 MB per response of 10 MPs (R1 §9.4)
TilingFor an MP without chunks the planner tiles [window start, today) with calendar-aligned purpose-1 chunks and sets first_load_to = today. Later it adds chunks only for a gap (§6.5 step 2), for a restored MP (§6.5 step 1), as bootstrap chunks (§6.3) and for a manual re-fetch (§6.5). It never plans a day that a purpose-1 or purpose-2 chunk of the MP, in any state but split, already covers
OrderNewest window first: every MP gets its most recent chunk before any MP gets an older one
BatchUp to 10 open chunks with the same account and the same window, not marked solo, in one request

6.2 Invariants and the state machine

#InvariantKept by
C1A chunk has an immutable identity (chunk_id), account, MP, purpose and windowSurrogate key; none of these columns is ever updated
C2No two open chunks of one account and MP overlapThe exclusion constraint of §3.2
C3A split retires the parent (split) and creates two children that tile its window, in one transactionThe planner's split, executed in this order, because the exclusion constraint is checked at once and not at commit: lock the parent; UPDATE its state to split; INSERT the two children; commit. A rollback leaves the parent as it was and no child. The same order serves the 503 ladder, the edge search and the exhaustive search (A3x-09)
C4attempts counts requests sent for the chunk and is committed before each request is sent; children inherit itTransaction A of §5.2
C5Without a person, at most 11 requests are sent for a lineage before it parks, and at most 8 more per parked chunkThe ladder below
C6A chunk's state changes only through its own item's outcome, never through a neighbour'sThe merge transaction updates a chunk from the item with its MP
C7not_available is set only for a single local day that was requested alone and refusedThe edge search (§6.3)
C8ingest.mp_state.current_access describes the present and is changed only by the daily run: by the listing (§6.5 step 1) and by the daily window (§6.5 step 4). No chunk's answer changes it: a chunk's answer is about a past window (N2)The outcome table below gives no chunk outcome an effect on access; the merge transaction updates current_access only from the items of a daily request
StateOpenMeaningLeaves it by
1 pendingyesTo be requestedIts item's outcome. A crash leaves it pending: there is no in-flight state
2 parkedyesTransient failures used up the laddernext_try_at (1 hour, 6 hours, 1 day, then daily), requested alone; after 8 such tries unresolved
3 no_datayesThe item answered 30015; or a bootstrap chunk was refused or delivered no day (§6.3)Retried after 1, 7 and 30 days; then empty
4 donenoThe item answered 10000 and was applied (§4.3)–
5 splitnoReplaced by its two children–
6 outsidenoRefused as a whole: by a code about the request's dates (30018, 30017, 30010, 30016) or by a code about the relation or authorisation (20010, 40014, 20012). It says the request was refused, not that every day in it is unreadable, and it says nothing about access today (C8)The edge search may split it (§6.3); the exhaustive search of the capture and of make probe-window splits it (§6.3 level 3)
7 not_availablenoOne local day, requested alone, refused–; once more pending only as the day directly before a bootstrap anchor (§6.3)
8 emptynoStill no_data after all retriesmake refetch
9 unresolvednoNeeds a person: a 400, a parse error, an unsupported unit or resolution, a parked chunk out of triesmake refetch
10 invalidnoThe MP's ID is refused (20003, 20004, 20008)A change of its master data
Item or request outcomeChunkMP
10000, validdone; a bootstrap chunk (purpose 2) without a delivered day: no_data (§6.3)A done chunk with a delivered day can set readable_from (§6.3)
30015no_data, next_try_at by the schedule–
A refusal: 30018, 30017, 30010, 30016 (the request's dates); 20010, 40014, 20012 (the relation or authorisation)outside; not_available when the chunk is a single local day; a bootstrap chunk: no_data (§6.3)None, whichever of the seven codes it is (C8, N2): a refused chunk never revokes current access (§6.3). Only the daily window can (§6.5 step 4)
20003, 20004, 20008invalidStatus 4, listed
20011Stays pending; it counts as an attempt, and at attempts = 8 the chunk is parked–
Validation failure (§4.3)unresolved–
HTTP 503, a timeout, or a request that left no response (a crash)The ladder, driven by attempts alone: a chunk still open at attempts = 3 becomes solo; one still open at attempts = 5 and longer than one local day is split once at its middle day, and the children inherit attempts = 5, solo and the lineage; one still open at attempts = 8 is parked. So: 3 requests in the batch, 2 alone, 3 per child. A chunk that has a parent is never split again by this rule–
HTTP 429Unchanged; the attempt is given back–
HTTP 400unresolved with the code–

One rule for access (N2). A chunk asks about a past window, so its answer sets that chunk's state and nothing else. What the seven codes of a refusal mean is R1 §3.3: 30017 (ToDateCutOff) says the end date is on or before the oldest supported date (also R1 §6.6), so it is a code about the request's dates, as it was; 20012 (Unauthorized) says the user is not authorised to perform the operation for the metering point, so it stands with 20010 and 40014. R1 lists 20012 for no time series call (R1 §4.4 expects it of relation/add), so it is placed by its meaning. A wrong placement would cost little: a refused chunk can still be searched and re-fetched, and the daily window revokes access only after three consecutive days (§6.5 step 4).

The first load of an MP is complete when none of its chunks is open. make status then reports, per series: the days loaded, and every window in outside, not_available, empty or unresolved with its code.

#FromGivenExpected
CT-01A2x-02The 503 ladder splits [2025-01-01, 2025-04-01) of MP 1Three rows with three chunk_ids: the parent in split, children [2025-01-01, 2025-02-15) and [2025-02-15, 2025-04-01), same lineage_id; the statements run in the order of C3 and the constraint holds after each
CT-02A2x-02The process dies during the splitEither the parent is pending and has no children, or the split is complete
CT-03A2x-02One response for 10 MPs: seven 10000, two 30015, one 30018Seven done, two no_data with a try one day later, one outside. The seven are not requested again
CT-04A2x-02Every request of a lineage answers 5033 in the batch, 2 alone, 3 for each of two children: 11 requests; both children parked at attempts = 8; no grandchild exists
CT-05A2x-02, A2x-17The worker is restarted ten times while a chunk's request is in flightattempts rose by one before each send and the ladder advanced on it: at most 11 sends for the lineage, then parked
CT-06A1x-16A batch answers 429The same batch is sent again after the cooldown; attempts unchanged; nothing split
CT-07A2x-02Rows for the same MP and window under accounts 1 and 2Both accepted by the constraint (used from phase 2)
CT-08A2x-02The planner runs twice on the same day; one parent is split with one child doneNo row is added; the split parent is not requested; the done child is not requested
CT-09A1x-10A parked chunk keeps failingTries after 1 hour, 6 hours, 1 day, then daily; unresolved after the eighth
CT-10A1x-10A chunk answers 30015 every timeTries after 1, 7 and 30 days; then empty; nothing stored is touched
CT-11R1 §9.2A request answers 400 with #30002:Never sent again; its chunks unresolved with 30002
CT-12A2v-1230 daily runs succeedNo row is added to ingest.chunk
CT-13N2Three MPs with current_access = true. A first-load chunk of each is refused: 20010, 40014, 20012. A single-day chunk of the first answers 20010The three chunks outside, the single day not_available; current_access and the status of all three MPs are unchanged
CT-14N2The daily item of MP 1 answers 20012 on two days and 10000 on the third, then 20012 on three consecutive days. The daily item of MP 2 answers 30017 on three consecutive daysMP 1 keeps its access through the first sequence (daily_failures = 0 after it) and after the second has current_access = false and status 3, asked again weekly. MP 2 has daily_failures = 3 and keeps its access. Stored data untouched throughout

6.3 Access edges

What is known (R1 §3.3, §6.6): a dateFrom before the MP was registered, or a window wholly outside the available period, refuses the whole item with 30018; the answer does not say which, and whether the owner's access begins before 2021 is unknown (consumerStartDate was empty in L1).

Decision: three levels. The third is run by hand in the worker and always by the capture.

LevelRule
1 Every chunk aloneEvery chunk of the window is requested and judged by its own item (C6). No result is used to skip another window, so readable windows that contain a whole chunk are found wherever they lie, also when there are several
2 The edge searchAn outside chunk longer than one day whose neighbour on one side is done is a bracket in which the direction is known: the readable days, if any, adjoin that neighbour. The chunk is split at its middle day; the child that adjoins the done neighbour becomes pending, the other stays outside without being requested (both become pending when both neighbours are done). The rule applies again to whatever results; a refused single day is not_available. Today is a search hint for an MP's newest chunk while the list shows the MP with a relation and not moved out: a listed MP is probably readable now, so the search of its refused newest chunk starts from today's side, and an MP registered inside its newest chunk is found. The hint is not an observation of data: a search that ends with yesterday refused revokes nothing (A3x-02; the MP is then awaiting first data, below). A bracket costs at most ⌈log₂ days⌉ + 1 requests: 8 for a quarter, 6 for a month. Every success is an ordinary response and loads its days
3 The exhaustive searchEvery refused window is halved and both halves are requested, down to single days; at most 2n − 1 requests for n days. The capture (B06b) runs it, before it may call the owner's history complete, over every chunk that levels 1 and 2 left outside (A3x-01), oldest first, because the oldest year is the one that leaves the API's window. Nothing excludes a day from it but the API's window itself (§6.1): not a refused neighbour, not the owner's recollection, not today's hint. An outside chunk of n days costs at most 2n − 2 further requests when its own request is recorded and 2n − 1 when it was never requested; chunks of several MPs with the same window share a request (§6.1). A day whose request ends neither done nor refused (a transient failure out of tries, an unsupported answer) keeps the capture incomplete and is listed. The owner's customer-since date (§14) is a check on the result, not a condition of the search. In the worker the lead runs it for a named range: make probe-window MP FROM TO

An outside chunk that no search has resolved stays outside and is reported as "refused as a whole, not searched day by day". It is never reported as "not available" (C7, A2x-03). A first load by the worker, which stops after level 2, can leave such chunks; a complete capture has none. The simulated source of these tests refuses with 30018 every window that is not wholly inside a readable range, the strictest reading of R1 §6.6.

The readable anchor (A3x-02). Whenever a chunk becomes done, the MP's anchor is its newest done chunk that delivered at least one day and has no outside or not_available chunk after it. If there is one, ingest.mp_state.readable_from is set to the first day of the unbroken run of done chunks that ends with the anchor, when it is NULL or that day is earlier; it is never moved later. An item that answers 10000 without a delivered day establishes nothing.

An MP awaiting first data. An MP that the list shows with a relation and not moved out, and that has no readable_from, is awaiting first data: current_access = true, status 1, shown as such by make status and D1. A refusal does not end that state, whatever its code: no chunk's answer changes current_access (C8). Only the daily run disables an MP (§6.5: step 1 on the listing, step 4 on the daily window), and an invalid ID gives status 4 (§6.2). While it lasts:

  1. Each daily run plans every uncovered local day up to yesterday as a one-day bootstrap chunk (purpose 2) and moves first_load_to to today. 2. A bootstrap chunk that is refused, answers 30015, or answers 10000 without a delivered day becomes no_data and keeps the retries of §6.2 (after 1, 7 and 30 days, then empty). It is never outside or not_available: for a listed MP, a day on or after its listing that cannot be read yet means "not yet". 3. The first bootstrap chunk that becomes done with a delivered day is the anchor, also when newer days have no data yet, and sets readable_from by the rule above. A not_available day directly before it becomes pending once more (it was refused before the MP had any data), level 2 continues on the older side from there, and the ordinary daily request starts with the next run (§6.5 step 3). Bootstrap chunks that are still open keep their retries.

The cost is one chunk row and at most four requests per awaiting MP and day. The owner's four MPs are not in this state; it exists so that a new or restored MP cannot be shut out before its first reading (§6.5 step 1).

#FromGiven (what the source can read)Expected
AT-01A2v-02Hourly MP, readable from 17 May 2023Chunks from Q3 2023 on done; Q2 2023 searched in at most 8 requests; stored from 17 May; 16 May not_available; the untested older pieces outside; readable_from = 2023-05-17
AT-02A2x-03Quarter-hourly MP; of the 71 months only months 3–8 are readableMonths 3–8 done and stored. Months 2 and 9 adjoin them and are searched: 28 February and 1 September 2021 not_available. The newest month is searched from today's side and yields nothing; if the list shows the MP with a relation it is awaiting first data, not "no current access". Every other month is outside and reported as not searched; no month's request was skipped because another was refused
AT-03A2x-03The same readable range, March–August 2021, for an hourly MPQ2 2021 done; Q1 searched from its newer side: March stored; Q3 searched from its older side: July and August stored
AT-04A2x-03Readable only in months 60–65Found exactly as AT-02
AT-05A2x-03Two readable windows: months 3–8 and months 40–71Both stored
AT-06A2x-03, A3x-01Hourly MP readable only 10–20 May 2021; its neighbours refusedAfter levels 1 and 2, where a first load by the worker stops: Q2 2021 is outside, reported as not searched, not not_available; make probe-window over Q2 stores 10–20 May in at most 181 requests. In the capture the exhaustive search runs before completion: 10–20 May stored, in at most 180 further requests for Q2; every other day of every chunk that was outside is individually refused (not_available) or listed as unresolved, and one unresolved day leaves the capture incomplete
AT-07A1x-09Hourly MP readable only January–June 2026 (moved out)Q1 and Q2 done; Q3 searched from its older side, 1 July not_available; the newest chunk outside and not searched, because the list shows the MP as moved out; the MP is "no current access"; January–June stay stored
AT-08A2v-02An MP registered ten days agoIts newest chunk is refused and searched from today's side: stored from the registration day; readable_from is that day; the daily request starts there, not 14 days back, and succeeds
AT-09R1 §6.6On 1 January 2027 the oldest chunk answers 30017That chunk outside; nothing else changes
AT-10A3x-02An MP is registered on day D and listed with a relation from D on; the readings of a day arrive three days after it; the list never changesOn D the newest chunk is refused and searched from today's side; D − 1 is not_available; the MP is awaiting first data and nothing is disabled. Each run from D + 1 on plans yesterday as a bootstrap chunk. Day D answers "no data" on D + 1 and D + 2 and is stored by its retry on D + 9. Then readable_from = D; D − 1 is asked once more and stays not_available; the ordinary daily request starts with the next run and loads the days since D
AT-11A3x-01Hourly MP readable from 1 March 2026 on and, apart from that, only 10–20 May 2021; the owner has given no dateLevels 1 and 2 store everything from 1 March 2026 and leave Q2 2021 outside. The capture's exhaustive search stores 10–20 May 2021 as well, and the capture is complete when every other day of the chunks that were outside is not_available

6.4 The capture (B06b) and its replay

The capture is the first load in the sense of the deadline: it is the only step that depends on what the API still has. Loading it into a database is a replay and can be repeated.

StepWhat the tool does
1Token; list; getdetails and getcharges for all MPs of the tree in one request each
2The planner of §6.1–§6.3 over the whole window, Actual, newest first, with the edge search
3The exhaustive search of §6.3 level 3 over every chunk left outside, oldest first. The capture is complete when every day of the window lies in a chunk that is done, not_available, no_data, empty or invalid; a chunk that is pending, parked, outside or unresolved leaves it incomplete (A3x-01)
4Month aggregation per calendar year inside each MP's readable range (at most 6 requests per group of MPs with the same range): the control values of §9.4
5A report without figures: whether the capture is complete and, if not, every window that keeps it incomplete, with its state and code; per series the first readable day and the code the API gave for the day before it; consumerStartDate if the API delivered one; calls by kind, those of the exhaustive search apart, and the days it found; latency per call (median, 95th percentile, maximum); whether Retry-After was seen (R1 open question 11); every window not done

Files, under data/capture/<run>/: manifest.json (the capture_id, a UUID given when the run is created, and per MP its capture-local number and its first_load_to, written when the planner tiles the MP, §6.1; N8), requests.jsonl (sequence, endpoint, window, requested_at, completed_at, status, item codes, body file, SHA-256; no header and no token), chunks.jsonl (the columns of ingest.chunk, with capture-local chunk IDs and MP numbers), one compressed body per response, except a token response, which is never written (§5.2 step 1), and report.md. A run can be resumed: it continues from chunks.jsonl.

Replay (make load-capture), in this order (A3x-06):

  1. Master data. The captured list and getdetails responses go through §7, so every MP has its mp_id. 2. The checkpoint, once per capture, in one transaction. Insert ingest.capture_import with the capture_id, the SHA-256 of chunks.jsonl followed by requests.jsonl, the map of capture-local MP numbers to mp_id, and the map of capture-local chunk IDs to new chunk_ids taken from the table's identity (parents and lineages rewritten through the map, so no sequence is reset). Insert the chunks in their captured states. A captured chunk whose window overlaps an existing chunk of the same MP in any state but split is not imported and is mapped to null: the live checkpoint stands. first_load_to is read from the capture's manifest.json, per MP (N8), and written to ingest.mp_state only where it is NULL. 3. Content. Every captured time series response, in the order of requested_at, through the ordinary path (§4.3) with raw.fetch.source = 8 and the captured requested_at; each response's transaction advances applied_through. The planner is not consulted and no transition of a chunk or of ingest.mp_state is run again: the imported chunks are the checkpoint. 4. Close. Set readable_from by the anchor rule of §6.3 where it is NULL; set completed_at.

A capture that was imported with the same hash is skipped whole when completed_at is set (RT-14, RT-15), and otherwise resumed after applied_through with the stored maps. The same capture_id with another hash is refused: a capture that grew after its import is loaded into an empty database (make purge, make up, make load-capture). The lead therefore loads the live database when the capture is complete; make validate always starts empty (§9.4). Afterwards the live planner plans the days since the capture (§6.5 step 2).

What a replay equals. A replay reproduces the content of a first load: the readings and day summaries that the live load of the same responses stores. It does not reproduce live absence handling: a replayed absence never marks and never withdraws (step B3, RT-23), so a day that a live sequence withdrew keeps its captured values after a replay. That is the safe side, and it wins over equality.

#FromGivenExpected
LT-01A3x-06A completed replay is run againIt reads the import row and stops; no row is written in any table
LT-02A3x-06The replay is killed after the checkpoint and some of the responsesThe next run imports no chunk again and continues after applied_through; the stored state equals that of an uninterrupted replay and no raw.fetch row exists twice
LT-03A3x-06chunks.jsonl has changed since the capture was importedRefused, with the explanation; nothing is written
LT-04A3x-06The database holds live chunks of the MP, one split with its children, and a manual re-fetch chunk. The capture is then replayed for the first timeNo live chunk changes; a captured chunk that overlaps a live chunk other than a split one is not imported; the exclusion constraint holds; captured days older than the stored watermark are stale
LT-05A3x-06A stored day is missing in two live responses 25 hours apart. The same responses, captured, are replayed into an empty databaseLive: withdrawn. Replay: the day keeps its values. Both are right; B08b's equality is asserted on the content of first loads only
LT-06N8A capture tiled on day C is replayed 30 days later. MP 1 has no ingest.mp_state.first_load_to; MP 2 has one from a live loadMP 1 gets first_load_to = C, the value of manifest.json, so the next daily run plans the days from C on (§6.5 step 2); MP 2 keeps its own. The value is never derived from the captured chunks

6.5 The daily run, the weekly run, the status

Step of the daily runRule
1 ListAn MP not seen before gets its rows and its chunks; an MP no longer listed gets status 2 and is not requested; an MP listed without a relation or as moved out gets current_access = false and status 3: its history is loaded, its daily request is not made. An MP that was so listed and is now listed with a relation and not moved out is restored to access discovery (A3x-02): current_access = true, status 1, daily_failures = 0, readable_from = NULL, and its days after max(first_load_to, daily_ok_through) are tiled as first-load chunks up to today (first_load_to = today), which levels 1 and 2 of §6.3 search. An unchanged listing changes no state; in particular it does not end a suspension of step 4
2 GapsIf today − 14 lies after max(first_load_to, daily_ok_through) for an MP, the days between are planned as purpose-1 chunks and first_load_to moves to today − 14. This is how an outage of more than 14 days, and the days since a capture, are loaded; in normal operation it adds nothing. For an MP awaiting first data the run plans its bootstrap chunks instead (§6.3)
3 RequestFor every MP with a readable_from and current_access: one Actual request for [max(readable_from, today − 14), tomorrow), MPs with the same window batched by 10. The API moves dateTo back to today (R1 §6.1). The owner's four MPs share one window: one request. Transaction A of the request (§5.2) records each MP's attempted window in last_daily_requested_at, last_daily_date_from and last_daily_date_to, whatever the outcome will be (§4.3)
4 Per item10000 → applied (§4.3), daily_ok_through = today, daily_failures = 0, and a suspension by this step ends (current_access = true, status 1). Any other code → daily_failures + 1, last_daily_code; stored data untouched. This is the only place where an error code changes current_access (C8 of §6.2, N2): three consecutive days of an access code set current_access = false and status 3; the MP is listed and, while it has a readable_from, asked again once a week. The access codes are those that, of a window that ends today, say the account cannot read the MP now: 30018, 30010, 30016, 20010, 40014 and 20012 (not authorised for the metering point, R1 §3.3). 30017 is not one of them: it says the end date is on or before the oldest supported date (R1 §3.3, §6.6), which the end of the daily window never is; like every code outside the six it counts as a failure and never changes access
5 ChunksOpen chunks that are due are worked by the backfill job

Why 14 days: values are typically 2–4 days late, the portal says up to 7 calendar days, and the drafted collection rule spans 12 calendar days across Easter (R1 §6.5, unverified). A day that arrives later is a hole, and make refetch MP FROM TO plans a purpose-3 chunk for it. Corrections older than 14 days are not found in phase 1; the sweeps that find them are phase 2. Weekly: getdetails for all MPs, one request per 10 (§7).

make status prints, without any quantity: the account's state and the refresh token's expiry; the owner of the egress (§5.2); the last runs with calls, 429 and 503 counts and items by outcome; per MP the readable range or "awaiting first data" (§6.3), the latest day with data, chunks by state, days not confirmed with their reason and days observed absent (§4.3), and holes (days inside the readable range, older than 14 days, without a ts.day_load row), and whether it lacks a price area (§7); the dataset's latest hour, pending hours and notices; unknown fields; partitions left.

6.6 The numbers for the owner's install (A2x-18)

One account, one tree: three hourly series and one quarter-hourly. Counts are base calls; overheads are listed separately; the times are throughput, not elapsed time.

RunBase callsOverheads, counted separately
Capture1 list + 2 (details, charges: four IDs in one batch each, resolutions mixed) + 24 quarters + 71 months = 981 token; isalive once and every 5 minutes; the edge search, at most 8 per access edge of an hourly series and 6 of the quarter-hourly one = 30 for one edge each; the exhaustive search (§6.3 level 3): at most 2 requests per day left outside, per group of MPs with the same chunks. With an access edge at 17 May 2023, 866 older days: at most 1 732 for the three hourly series together and 1 732 for the quarter-hourly one; Month controls, at most 6 per group; retries
First load by the worker, without a capture1 + 1 (details) + 24 + 71 = 97The same, without the exhaustive search
Daily (weekly: 1 more, getdetails)1 list + 1 time series request = 2At most 1 token call (the token of the day before has less than 30 minutes left). The bootstrap chunks of an MP awaiting first data and the chunks of a restored MP (§6.3, §6.5) are counted apart; the owner's established tree has none
Declaration, first load18 data requests (§8), at least 17 minutes1 metadata request per run
Declaration, daily / monthly1 / 4 to 6 (from 367 days on 2 January to at most 702 on 2 December, in windows of 121)1 metadata request per run

Time: with one request in flight and the spacing counted from completion (§5.2), the capture's base calls take 98 × (the latency + 1 s): 51 minutes if a call takes 30 seconds, which nobody has measured. The exhaustive search of the example adds up to 3 464 × (the latency + 1 s): 30 hours at 30 seconds, 6 hours at 5 seconds; a refusal is probably quicker than a delivery. B06b measures both, and the run can be resumed.

7. Master data and the allowlist

**Decision: list and getdetails responses pass an allowlist in the typed models before anything is hashed, stored or logged. A field is kept, known and discarded, or unknown; an unknown field is discarded and only its JSON path is counted in ingest.unknown_field.** Reason: a deny-list keeps whatever Energinet adds next (A1x-06).

ClassFields (names as in docs/sources/eloverblik/samples/)
Kept, as the columns of core.mp_versionsubTypeOfMP, physicalStatusOfMP, netSettlementGroup, mpConnectionType, disconnectionType, settlementMethod, meteringGridAreaIdentification, gridOperatorID, gridOperatorName, municipalityCode, postcode, cityName, streetName, buildingNumber, floorId, roomId, locationDescription, darReference, balanceSupplierId, balanceSupplierName, balanceSupplierStartDate, consumerStartDate, consumerCVR, dataAccessCVR, assetType, mpCapacity, meterReadingOccurrence, energyTimeSeriesMeasureUnit, product, taxReduction, meteringPointAlias, meterNumber, protectedName, protectedAddress, occurrence; and for the tree, as the columns of core.metering_point, meteringPointId, typeOfMP (type_code), parentMeteringPointId, childMeteringPoints[].{meteringPointId, typeOfMP, meterReadingOccurrence}, hasRelation, isMovedOut
Known and discardedcontactAddresses[], firstConsumerPartyName, secondConsumerPartyName (the account is private or unclassified in phase 1, so no name is ever stored), and every other field of the saved samples not listed above
UnknownAnything else: discarded, its path counted

Rules: a GSRN is stored in core.metering_point only. The allowlist keeps the ID fields, because parsing matches on them, so it is not the allowlist that keeps a GSRN out of raw.*: the recorder replaces every ID by its mp_id before it stores a body or a request key (§3.1, A3x-12). protectedAddress sits inside contactAddresses[] (R1 §7.1): it is read as a flag, true if any entry has it, and nothing else of those entries is kept. The address is withheld unless the name is known to be unprotected (N4): the six address columns of §3.3 are stored only when protectedName is false and protectedAddress is not true. A protectedName that is absent, null or "" is unknown: it is stored as NULL in protected_name bool NULL, never as false, and it withholds the address exactly as true does. The list response carries no protection flag, so an address from the list is never stored; addresses come from getdetails, where the flag is sent. Reason: a missing flag is not consent, and storing false for it would invent knowledge. A version row is written only when the allowlisted content's hash differs from the current version's; the old row gets observed_to. The tree is parent with typed children; a child is requested by its own ID. Price area: core.mp_geo is derived from grid_area through ref.grid_area; a grid area that is missing or not in the table leaves the MP without a price area, visibly, until make set-price-area MP=<mp_id> AREA=DK1 writes a rule-3 row. Whether Eloverblik's meteringGridAreaIdentification is the three-digit code of the public datasets is checked on the first real response (R2 open question 5).

Sentinel test (B04a on the models, B07 through ingestion): responses with sentinel values in every contact field, in both name fields, in a nested unknown field, in an errorText and in a stackTrace are ingested; afterwards no sentinel occurs in any column or in the captured logs. The same run asserts that no metering point ID of the fixtures occurs in any column or stored body of a raw table (B03 on the recorder, B07 through ingestion).

8. Emission factors: the declaration loader

Phase 1 loads DeclarationGridEmission only (R2 §2.2.3): one row per UTC hour, price area and allocation (Total, 125%, 200%), 144 rows a day.

RuleDetail
PaceAt most one call to the service, of any dataset and any process, per ELO_EDS_SPACING_S (60) seconds, reserved in ingest.service_pace before the call, as §5.2 (B51; phase 2 §2.2; it was one data call per dataset per minute, reserved in ingest.dataset_state.next_start_at); Retry-After honoured with a 10-second margin; back-off doubles after a 429 (R2 §1.6)
Requesttimezone=UTC, the UTC key column, explicit sort, limit=0 with a time window; a row budget of 17 500 rows per call (the largest response R2 saw without error had 17 520): windows of 121 days, halved if a response reaches the budget
First load and dailyFrom the first local hour of the API's window (2020-12-31T23:00Z on 15 November 2026): 2 144 days, 18 requests. Daily: the last 120 days, 17 280 rows, one request
Monthly re-pullOn the 2nd of each month, from 1 January of the previous year: picks up the Final version (by 1 June) and any revision older than 120 days (R2 §2.2.2). Without it the owner's hours of 2026 would never become Final (A2v-06)
Applying a windowOnly a complete response is applied (its total equals the number of records and is below the budget). Upsert on the key; a row whose values or version differ goes to history first (cause 1); a key of the window that the response no longer contains goes to history and is deleted (cause 2). One transaction per window; ops.data_version incremented when anything changed
ColumnsA column the loader does not know is kept in extras and reported by make status; an expected column that is missing stops the dataset (status = 2) with a notice. Never a silent default
MetadataEach run reads /meta/dataset/DeclarationGridEmission; a changed lastMetadataUpdate or caution text is stored and shown
Hours without a rowStay without one. Nothing is estimated from another dataset (§9.3)
From filesThe loader reads the files tools/snapshot_declarations.py writes (<dataset>/<yyyy-mm>.json.gz and <dataset>/_meta.json) through the same code; used by the validation (§9.4) and for the frozen factor extract (below)
AttributionEvery page that shows these data carries "Kilde: Energinet (www.energidataservice.dk)" (R2 §1.9)
The change of 24 November 2026A new method with a backfill from 17 September; the dataset ends at 4 November until then (R2 §2.2.1). The rolling 120 days cover it without a special case. Once, after the first load that follows 24 November, elo_devtools.validate compare-declarations compares the live rows of 1 January 2025 to 4 November 2026 with the snapshot of 15 November (data/validation/declarations-2026-11-15/): rows changed per month and version, the largest absolute and relative difference per gas. The lead records the result as docs/adr/ADR-003-declaration-restatement.md. It answers whether history was recalculated (R2 §7 question 1) and whether the owner's screen and a report made before the change can still agree

The frozen factor extract (N5). The demo organisation and CI need factors and must not depend on Energi Data Service. The extract is a set of files in the loader's file format (the row "From files"), kept in the repository under fixtures/factors/ (fixtures/factors/DeclarationGridEmission/<yyyy-mm>.json.gz with its _meta.json). It covers the demo organisation's period for DK1 and DK2, in the three allocations. Its values are generated and have the shape of real ones: the columns and units of the dataset (§3.4), 144 rows a day, the versions Initial, Preliminary and Final by the age of the hour, and, as in the real dataset, no row yet for the latest days, which gives the demo the pending hours of §9.3. They are marked as generated: _meta.json says so and names the seed, and a load of the extract is recorded with raw.fetch.source = 9 (demo), so every generated factor row is told from one of Energinet's by its fetch_id.

WhoWhat
B04bThe generator makes the extract with the demo organisation: same seed, same bytes
B11The loader loads it in file mode, through the same code as a snapshot
B09, CImake demo and CI load it and never call Energi Data Service: in the demo stack the jobs eds-load and eds-monthly-repull (§1.2) do not run

9. Calculation

9.1 Nothing derived is stored

**Decision: phase 1 stores no emission fact and no aggregate beyond the day summary of ts.day_load. Every figure is computed when it is asked for, from stored readings and stored factor rows, by SQL views and functions.** Reason: a figure can then never disagree with its inputs: no queue to drain, no trigger to forget, no state "being recomputed"; and one MP tree needs no materialisation (a year of one hourly series is 8 760 rows). D11 is kept in full: both methods are available on every page and down to one interval, the method is a parameter and never baked into a number, and every figure states its method. The cost at 5 000 MPs is in §1.4. The rules exist twice, as SQL (what runs) and as pure Python in elo_core (what a reviewer reads and the golden cases are written against); a test asserts that both give the same result to the last decimal.

9.2 The two price-area methods

Per interval i of the E17 root's series, with quantity q in kWh, the factor row f of dataset 1 for the UTC hour of the interval start, the MP's price area on that local day and the method's allocation (R2 §3.4.1; R3 §3.3.2):

QuantityFormulaUnit
CO2, CH4, N2Oq × f.co2_g; q × f.ch4_mg; q × f.n2o_mgg; mg; mg
Biogenic CO2 (memo, outside the scopes)q × (f.co2_origin_g − f.co2_g)g
Transmission loss, per gas and for biogenic CO2amount × (f.t_factor − 1)as the amount
Distribution loss, per gas and for biogenic CO2amount × (f.d_factor − 1). Additive, not compounded on the transmission loss (R3 §1.3)as the amount
CO2eco2_g + ch4_mg × GWP_CH4 / 1000 + n2o_mg × GWP_N2O / 1000, with the GWP set of the request (default AR5)g

calc.v_emission_interval returns one row per interval and method: the reading, the amounts above, and the factor's version and retrieved_at; all amounts are NULL and factor_version is NULL when the hour has no factor row. Amounts are numeric; nothing is rounded before display; tonnes = g ÷ 1 000 000. Emissions excluding losses are Scope 2; the two loss amounts are shown separately and never added to it; children and production never change the figure (L2: the report counts the parent only). Golden cases (B12a): 1 000 kWh at 100 g CO2, 0.5 mg CH4 and 0.1 mg N2O per kWh with 28 / 265 is 100.0405 kg CO2e; loss factors 1.0145 and 1.0387 give 1.45 % and 3.87 %, together 5.32 %, not 5.376 %; a quarter-hour takes its hour's factor; both DST days.

9.3 Hours without a factor, the data basis, and like-for-like comparison

An hour is pending for a method when it has no factor row. That is the normal state of recent days: the declaration ended on 4 November 2026 and is back-filled from 24 November (R2 §2.2.1). The data basis is a parameter: best (default) uses every hour with a factor, whatever its version; final uses only hours whose factor has version Final, and treats all others as pending.

FigureHours usedWhat the page says
Consumption (E01)Every stored hourCoverage of the period (Q01b)
Emissions total (G01), by gas, losses, biogenicHours with a factor under the basis"x % af forbruget (n timer) har endnu ingen emissionsfaktor". Pending hours contribute consumption and no emissions; a pending hour is never read as zero emissions per kWh
Intensity of one period (G16, g CO2e/kWh)Emissions and consumption of the hours with a factor onlyThe same note
Variance of emissions to the comparison period, absolute and relative; variance of intensityOnly matched hour cells: for each MP, the cells (§2) that are eligible (below) on both sides"Sammenlignet over h af H timer" (for instance 7.512 af 7.680): h matched cells, H cells with at least one quantity in the current period (the definition below); the note says how many were left out for missing readings and how many for a missing factor
The same when no cell is matched–i.r. (ikke relevant) with the reason (missing readings, or no factor), never −100 %
Factor status (Q04)–Shares of the period's consumption by Final, Preliminary, Initial, pending
An MP without a price area–Ikke tilgængelig with the reason "no price area", never zero

Eligibility (A3x-05). Before cells are matched, one row is built per MP and UTC hour. The hour is eligible when its stored intervals cover exactly its 60 minutes without overlap, each with a quantity (one hourly value or four quarters), none of them has quality A02 or A05, and it has a factor row under the basis. Its quantity is the sum of its own values; an hourly value is never split. A complete hour of estimated values (A03) is eligible and keeps its quality mark. Reason: "a reading and a factor on both sides" is not enough. An hour with one of its four quarters, against a full hour a year earlier, would show a fall of 75 % that is nothing but missing data.

calc.emission_matched(mp_ids, date_from, date_to, cmp_date_from, method_id, basis, gwp_set) (since B55 with a last parameter cmp: the correspondence is a parameter, and py keeps the rule of §2; docs/emission.md) returns for both sides the matched kWh and amounts, and h, H, excluded_readings and excluded_factor. H counts the current period's hour cells with at least one quantity, once per MP and hour; h counts the pairs eligible on both sides, in MP-hours when several MPs are selected. Of the other H − h cells, those with a counterpart whose readings are missing or incomplete on either side are counted in excluded_readings, those complete on both sides and without a factor on either in excluded_factor; the rest have no counterpart cell (§2). The intensity of one period, outside a comparison, keeps the rule of the table: every stored quantity that has a factor, with the note on incomplete data.

The like-for-like variance of consumption (B15b). The variance of E01 in overview.cards and per metering point in overview.mp_variance compares the consumption of the matched cells only: the hour cells that are eligible on both sides by the rules above, with no factor needed (calc.consumption_matched). Its basis is stated as h of H cells ("Sammenlignet over h af H timer"); where no cell is matched it is i.r. with the reason (missing readings, no counterpart, no data), never −100 %. The total variance (all days of both periods, which end at the frontier, §2) is returned beside it and named apart.

Tests (B12a, and through the queries in B15): a period whose last ten days are pending shows an unchanged intensity and a variance over the matched hours only, with h < H; basis=final on the running year answers "not applicable"; the 25-hour day's second 02:00 is unmatched against a 24-hour day; a period with 29 February counts its 24 cells in H and not in h; an hour with one of four quarters against a complete hour gives h = 0 and i.r. with the reason "missing readings", not −75 %; four complete quarters against one complete hourly value match once; an hour of A02 only never matches; a complete estimated hour matches; an A05 interval excludes its pair.

9.4 Validation against Eloverblik's own report (L2)

RuleDetail
EvidenceA report is evidence only together with a snapshot of the declaration datasets taken the same day. data/validation/targets.md names, for each report, its snapshot directory; elo_devtools.validate refuses a target without one. The snapshot of 15 November 2026 exists; a report made later comes with tools/snapshot_declarations.py run that day
Where it runsIn a throwaway database, never the live one: make validate creates a database, applies the migrations, replays the capture, loads the snapshot through the loader's file mode, runs the check and drops the database
What runsThe product's own named query report.footprint through the API's runner, with the parameters a user would set: period, MP, method, data basis
ConsumptionTwo checks: the footprint's consumption equals the report's to the last printed decimal; and for the E17 root the stored monthly sums of every captured year equal the API's Month values of the capture (§6.4). A difference for a child series is reported, not a failure: only the parent's equality is established (L2)
Emissions, price areaAfter rounding to the report's printed precision: emissions excluding losses, distribution loss, transmission loss, biogenic CO2, and the three gas intensities (CO2 in g/kWh, CH4 and N2O in mg/kWh, each Σ amount ÷ Σ kWh), for 125 % and for 200 %, with best and with final
Not in phase 1Renewable share, source and origin splits, the municipality report: they need datasets phase 2 loads
RecordThe lead records per block "match" or the relative residual, without any of the owner's figures. Without reports the price-area methods ship with consumption validated and emissions checked against the golden cases, and the pages say so in their footnote: every page that shows emissions says "checked against golden cases only" until a validation against an Eloverblik report has been recorded (§11.1, B16a; N6)

10. Serving

10.1 The contract

**Decision: named, parameterised SQL queries with a YAML catalogue, served by POST /api/query/{id}; the runner and catalogue code are copied from an earlier internal project/services/api/src/sop_api/analytics/ (D10), without audiences.** Each page directory has its own catalogue file and queries, merged at build. A page contains no SQL and no arithmetic beyond formatting: every figure, variance and ratio is a column of a query. A catalogue entry declares parameters with types and ranges, columns with unit and polarity, and the combinations that answer "unavailable". Each request runs in one REPEATABLE READ read-only transaction, so every figure of a response comes from one state of the data. There is no cache.

Parameters: p (an explicit range of local dates, or a preset resolved against the frontier), mp (MP IDs; default the account's E17 roots), m (LB-PA-125 or LB-PA-200; default the first), gwp (default AR5), basis (best, final), cmp (py previous year, none; since B55 also pp, the period before, and from:<date>, an earlier period from that day: phase 2 §3.4), g (grain), measure (A1: E01 or G01). Since B54 (phase 2 §3.5, §4): sel, the selection, an object of dimension key to a list of values, taken beside mp by the queries docs/queries.md names; and the measures E03 and ENET where a query takes measure.

10.2 The response

{ "queryId": "development.series", "columns": [{"name": "kwh", "type": "number", "unit": "kWh", "polarity": -1}],
  "rows": [], "grain": "day", "state": "ok",
  "method": {"code": "LB-PA-125", "gwp": "AR5", "co2eBasis": "gases", "dataBasis": "best"},
  "basis": {"dataThrough": "2026-11-12", "frontierState": "ok", "coverage": 0.998,
            "factorStatus": {"final": 0.0, "preliminary": 0.71, "initial": 0.21, "pending": 0.08},
            "matched": {"hours": 7512, "hoursInPeriod": 7680, "excludedReadings": 96, "excludedFactor": 72},
            "boundary": "physical"},
  "scale": {"kwh": {"max": 1234.5}}, "dataVersion": 4711, "calcVersion": "1.0.0" }

A column names its role (AC, CP, ΔCP, ΔCP %: the comparison period and the variances to it), which the charts draw by (notation manual §2, §3); the response names the comparison's code once, in comparison ({"kind": "py", "code": "PY", "from": …, "to": …}), and the comparison's columns are named cp… (B66; phase 2 §4). Where this document writes PY, ΔPY and ΔPY % for a column, that is the role CP with the code PY. state is ok, empty, unavailable (with a reason: no price area, no factor in the period) or too_large_for_grain. An unavailable figure is never a zero. Every response that carries emissions names its method, GWP set, data basis and factor status. scale is the maximum of each unit over the whole result.

Quality contributions (A3x-11). Every row of an aggregate chart query (a month, a day, a card) carries, for AC and for PY, beside its total: solid_amount and provisional_amount, which add up to the total, missing_minutes (no value, or A02), incomplete_minutes (A05) and pending_factor_minutes. For consumption the provisional amount is the estimated kWh. For emissions an interval's amount is provisional when its reading is estimated or its factor is not Final, counted once, so the hatched share of a mark is a share of the emission amount: 1 kWh at 100 g with a Final factor and 1 kWh at 900 g with a preliminary one are 90 % provisional, not 50 %. A scalar figure also carries provisional, true when more than 1 % of it is provisional (manual §9, rule 2). factorStatus (Q04) stays what it is, the shares of the period's consumption by factor version, labelled so, and is never used to draw a mark. All of it is computed in the query; nothing is stored.

Expected intervals (B15b). A figure of coverage counts missing minutes among the expected minutes only (calc.series_expected). A series is expected from the earlier of its first readable day and its first stored day to its expected end: for a metering point that is valid (status 1 and current access not known to be false: only the daily run writes it, so a point never asked is valid) its own last stored day or, when that is older, the day before the daily run's window (DAILY_WINDOW_DAYS, 14 days) starts; for another point its last stored day, or the day the database records that it ended when that is later. A series without a start has no end. Minutes outside the range are never missing and never silent: every aggregate returns them as not_expected_minutes, of which not_yet_delivered_minutes, and outside_range_minutes (the rest, computed in the query), and for every aggregate stored + missing + not expected = the minutes of its days. A period with no expected minute has no coverage (i.r., never 100 %). A hole between two stored days, and a series that stopped earlier than its neighbours while its point is valid and the day is older than the window, stay missing. today is the server's, in Danish time. A page says "Målinger forventet til og med <dato>" of the end of the expected range, and "Data til og med" of the frontier only.

10.3 Grain and budget

RuleDetail
g=autoThe finest grain with at most 750 points per series: quarter-hours up to 7 days (676 points when the window holds the 25-hour day), hours up to 31 days (745 points then), days up to 750 days, months beyond
An explicit finer grainAllowed up to 750 points; beyond it HTTP 422 grain_too_fine with the longest window that grain allows
Row budgetBefore it runs, a query's reading rows are estimated as Σ over its series of days × points a day; above ELO_ROW_BUDGET (2 000 000, about 228 series-years of hourly data) it answers too_large_for_grain. Day and month consumption read ts.day_load and are not affected. Since B77 the budget is a number per query, and since B55 it counts the period's rows plus the comparison period's own days, summed apart (docs/queries.md)
Interval series for a chartOne row per interval of the window, with NULL quantity where nothing is stored, so that a gap is drawn as a gap (A2v-04), and with expected saying whether the interval is inside the series' expected range (§10.2)
The grain is statedIn the response and in the third title line

10.4 The queries of phase 1

QueryPageReturns
meta.contextallFrontier and its state, the account's MPs as a plain list (mp_id, type, alias, address for the local user), the dimensions the roots fall into more than one value of and hasExport (B54; phase 2 §3.5), the two methods, GWP sets, the account's state (below; N6), and readingSource (below)
overview.cardsX1Per card: the figure, PY, ΔPY and ΔPY %, and the strip of monthly ΔPY %. E01 with its like-for-like variance (§9.3); G01 by the method with its like-for-like variance and matched, and G16; coverage, with the metering point that has the most missing expected minutes (lowest_mp_id) and its monthly strip (strip_delta_py, a difference of shares); factor status. Each figure with its quality contributions and the provisional flag (§10.2)
overview.monthsX1The measure of the chosen card by month: AC, PY, ΔPY, ΔPY %, with the quality contributions of AC and PY (§10.2)
overview.mp_varianceX1The E17 roots ranked by the like-for-like variance of E01 to the previous year (§9.3), with the total variance beside it (one row for the owner; several in the demo)
development.seriesA1The chosen measure by month or day, with the previous year and the variance; for G01 the like-for-like rule per point and matched for the period; the quality contributions of AC and PY per point (§10.2)
consumption.weekday_hoursA1The heatmap of weekdays by hours (B20): for each weekday and clock hour of the local day the mean consumption of that hour, per selected root its own mean over its own eligible hours (§9.3) and the cell the sum of the roots' means, with roots of roots_expected and root_hours of root_hours_expected; the 7 weekday and 24 hour margins by the same rule from their own hours, never from the cells. The period ends at the frontier. A function of a selection and a period alone (calc.weekday_hour_cells, migration 0188), so that a second period is a second call
mp.master, mp.treeD1Current master data and its versions; the tree with each child's role
mp.seriesD1One series of the tree by hour or quarter-hour with quality, one row per interval of the window; expected, not_expected_reason (before_readable, not_yet_delivered, ended) and the series' expected_from / expected_to say which intervals are expected (§10.2)
mp.emission_intervalsD1Per interval: kWh, the amounts of §9.2, the factor with its version and retrieved_at, or pending
mp.changesD1Rows of ts.reading_change for the window; withdrawn days
mp.ingestionD1Readable range or "awaiting first data" (§6.3), latest day, chunks by state, windows not done with their code, days not confirmed with their reason and days observed absent (§4.3)
report.footprintvalidationThe blocks of §9.4 for a period and method

Where the readings came from (B15b). meta.context returns readingSource, from the loads the database records: generated, eloverblik, mixed, unknown (a load whose origin the database does not record, alone or beside others) or none. A replayed capture is Eloverblik's only when it was made at the API's address, which the replay persists with its fetches (raw.fetch.origin); the generator's capture records an address of its own.

The daily run's state (B19). meta.context returns daily, {state, lastOkAt}, over the points the daily run asks (status active, a readable_from, access not known to be false): never when none of them has a success, failed when the latest daily run failed for one of them, late when any of them has no success in the last 26 hours (the oldest of the points' newest successes decides, and is lastOkAt), ok, or none (nothing is asked, or the readings are the generated demo's). Every page says the first three above the message. For the expected intervals of §10.2 a child point without an access state of its own follows its root's; the daily run, the account's state and D1 read the point's own.

The account's state (N6). The state no_access applies only where a daily run has ended every point's access. make status gives the token's days left as whole local days, flagged at 60 or fewer, as the pages. meta.context returns account.state and, when ingest.source_account.token_expires_at is known, account.tokenExpiresInDays: the whole local days from today to the refresh token's expiry. The state is the first of these that applies, and the comparison with 60 days is made in the query, not in the page (§10.1):

account.stateWhenThe pages say (§11.1)
token_neededThe account is invalid (§5.2: /token answered 401, 403 or 50001, or a second 401 on a data call), or the refresh token has expiredA new token is needed
no_accessThe account is active and none of its MPs has current_access (§6.5)No metering point can be read now
token_expiringThe refresh token expires within 60 daysA new token is needed in n days
okOtherwise, also when the expiry is not known (the demo source has no token)Nothing

It is read from ingest.source_account and ingest.mp_state afresh by every request, like all ingestion progress (§3.1).

11. The web app

One single-page app, web/apps/elo-web: React, TypeScript, Vite, React Router, TanStack Query, plain CSS from the three packages, a static build served by Caddy. **The pages follow docs/design/notation-manual.md, and docs/design/prototype/ is their visual reference** (design task A2, committed; the owner's decisions D12–D17).

11.1 The three pages

PageThe questionContent in phase 1Drill
X1 Overblik (prototype/index.html)Do we use and emit less than last year, and can the figures be trusted?Three plain cards (D15): Elforbrug, Scope 2 el (the method switch) with its like-for-like variance and hours, Datadækning; each with figure, ΔPY and the strip of monthly ΔPY %. Per month: AC columns with PY behind, ΔPY bars, ΔPY % pins, for the measure of the chosen card. The MPs with the largest variance. No ΔPL and no production card: targets and production are later phasesCard → A1 with that measure; row → D1; the coverage card → D1
A1 Forbrug (analysis.html, its monthly part)When did it change, and against what?The measure, consumption or emissions (A2v-09), by month or day with PY and the variances; the provisional share of a column hatched to scale, by amount (§10.2); pending hours and the matched hours stated. The heat map of weekdays by hours (D6, D17) below the monthly chart: seven rows by 24 hours, one ramp of ink in at most seven equal classes between round limits, a legend with the lowest and the highest mean, the cell's mean, hours and roots by pointer, keyboard and table; the title is the sentence "Forbruget ligger højest … kl. …" from the highest block, absent when the period holds fewer than 14 days with data; a cell that rests on fewer than two hours carries the missing symbol. The load duration curve is phase 2Period → D1 for that window
D1 Målepunkt (detail.html)What exactly was measured, with which quality, and how was the emission of each interval computed?For a chosen week (up to 31 days): three tiers on one time axis, consumption per interval, the emission factor, emissions per interval (§11.2); the interval table; master data and its versions; the tree with each child's role; changed values; ingestion state–
Rule for every pageSource
The message first, then three title lines (who and filters; measure, unit, method; period, grain, comparison), caveats, and notes with source, data-through date and factor status. The message is a sentence built from query columns by the page's strings module; no page computes a figureManual §7
Codes in charts and tables (AC, PY, ΔPY, ΔPY %), Danish words in sentences, and the key ("Signaturforklaring") at the foot of every pageD12; manual §2, §16
Polarity comes from the API per column: consumption, emissions and intensity −1, coverage +1; the impact colours are the retuned pairManual §3; D13
One grammar of certainty: solid is final, hatched is provisional (an estimated reading, a non-final factor), empty is absent. A missing interval is an empty band with mangler, a pending hour an empty band with afventer faktor; an unavailable figure reads Ikke tilgængelig with its reason, an inapplicable variance i.r.; a relative variance with a reference ≤ 0 is i.r.; nothing missing is drawn as zeroD14; manual §9
Danish formats from one module: 1.234,5, −6,2 %, 12.11.2026, kl. 08:00–09:00D4, D16; manual §6
The method switch Opgørelsesmetode on every page that shows emissions, the choice in the address; every figure states its method; emissions are labelled "Scope 2, el"; every figure is physical (no boundary weights before phase 3); nothing is called "CO2-neutral"D11; manual §8
The account's state: when meta.context returns a state other than ok, every page says so in a notice above the message: a new token is needed; a new token is needed in n days (the token expires within 60 days); no metering point can be read now. The page compares nothing: the state and n are columns of the query§10.4, §5.2; N6
The emission footnote: every page that shows emissions says that the figures are "checked against golden cases only" until a validation against an Eloverblik report has been recorded (§9.4). In phase 1 it is a fixed text of the strings module; the lead removes it in the change that records the validation§9.4, §14 row 2; N6
URL state holds every filter. All text is Danish, in one strings module per page; identifiers and documentation are English–

11.2 What is copied and what is new

Copied from an earlier internal project by git archive at the commits R4 §3.2 records, each with a VENDORED.md and a row in THIRD_PARTY.md (D10): web/packages/…-charts at ddceb13 as @elo/charts (Apache-2.0; its 634 tests pass after the rename); …-tokens at 74da52a as @elo/notation-tokens, which stays CC BY-SA 4.0 with its licence, the attribution to the [standard] Association and the statement of adaptation in the package and in every generated file (D5's one exception), and without the sentence that claims conformance; app-shell at fc333c0 as @elo/shell (layout, URL state, PageFrame, states, cards, the named-query hook and the auth seam kept; period, entity and comparison models replaced); web/tools/guard.mjs and the Vite notice plugin at ec82e50.

Renames: …Table, …ThemeProvider, use…Theme, [standard].ts → AnalyticalTable, ThemeProvider, useTheme, notation.ts; prefixes …-, --…-, data-…-theme → an-, --an-, data-theme; themes analytical-light, analytical-classic, analytical-dark; $extensions.… → $extensions.provenance. The rename is a deterministic script with a mapping table, kept in tools/ (A2v-15), so that a later upstream change can be imported and renamed again; a model is used only for prose the guard still flags, and that diff is reviewed.

Built new in phase 1Epic
Period model: local days, presets against the frontier; Danish formatting module (D4); URL state with method, GWP set and basis; method switch; a plain list of the account's MPs; local AuthClientB14
Dense time series chart (the tier chart of D1, as prototype/detail.html draws it and the manual §4 and §9 specify it): tiers that share one time-based x axis, true to time, so that the 23- and 25-hour days have their true width, the repeated hour is labelled 02A and 02B, and a missing interval keeps its place; grains hour and quarterHour with Danish local-time labels; marks by the manual's rule: columns while the window is short (the prototype's week of hours), one path per series without markers beyond that, up to the 750 points a query returns (§10.3), which includes the 745 hours of a 31-day window and the 676 quarter-hours of a 7-day window that hold the 25-hour day; quality states in the mark: hatched for estimated readings and non-final factors, the missing symbol for incomplete, empty bands for missing and for a pending factor; a factor line that is dashed where provisional and broken at a gap; energy unit scaling from a kWh base; the table view behind it. It exists because the copied line chart creates one DOM element per point and the copied packages stop at the day (A2v-04; the lead's ruling)B18

11.3 What phase 1 takes from the design task A2 (A2v-07)

Delivered by A2Phase 1 takesUsed by
notation-manual.md§2 scenario codes and fills (AC, PY); §3 variances and polarity; §4 axes, true to time, with 02A and 02B; §5 scaling; §6 formats; §7 message and titles; §8 the method switch; §9 quality states; §12 tables; §13 plain cards; §14 highlighting; §16 the key; §17 what is never doneB14, B15 (polarity, scenario code per column), B16a, B16b, B18
notation-manual.md §18, the checklist for accepting a pageThe acceptance of every page epic; its first block is checked by a script over the marks' rolesB16a, B16b, B17
direction.md§2 the one family Archivo (OFL-1.1, self-hosted, into the notice inventory); §3 colour tokens for light and dark, with the retuned impact colours of D13 replacing the copied token values; §4 grid and density; §5 the composition of the three pages; §7 motion and §8 the drill-down, with the reduced-motion fallback; §9–§12 hover, focus, states, widths, accessibilityB13 (font, tokens), B16a, B16b, B17
prototype/The visual reference at 390 and 1 280 px in both themes. It is hand-written SVG, not the chart package (direction.md §13); no code is taken from itB16a, B16b, B17, B18

Not taken in phase 1: the scenarios PP, BY, PL, BU and FC, the heat map (D17) and the load duration curve, small multiples, the site structure chart, pictograms. They are specified in the manual and built with the pages that need them.

12. Security and privacy of phase 1

12.1 The token, the local mode, personal data

RuleDetail
Refresh tokenOnly in the owner's git-ignored .env. Compose names it under environment: of worker alone; no service uses env_file. Test (B02): docker compose config shows the variable in no other service, and it is absent from the environment of the running api, migrate, caddy and postgres containers (A2v-11)
Access tokenThe worker's in data/state/eloverblik-access-token, mode 0600, in the private state directory (next row), which no service but the worker mounts; bound to the fingerprint of the refresh token that obtained it (§5.2). The capture tool's in data/state/capture-access-token, under the same rules (§5.2, N1). Never in the database, never logged, never under data/capture/ (§12.2)
State directoryA secret never lives in a directory that another user can write to (N9). data/state/ and every directory under it are 0700 and belong to the one user who runs both modes: the capture tool on the host, and the worker, whose container runs as that user's UID and GID (§1.2). Both modes refuse to start when the directory or a path component above it up to the repository root is a symbolic link, is not that user's, or is writable by group or others, and where a regular file under it has more than one link, in both installs (B101); the message names the path and the mode and never a secret (§5.2, PT-19…PT-22). In the packaged install a named volume the worker alone mounts, checked by the worker's half (packaging-and-setup.md §2.4, B101). Against other users of the host this is kept by the host's file system. Inside the VM of Colima on macOS ownership is not enforced on the mount (§5.2), so there the rule that no other service mounts the directory is what keeps another container out
Map background key (K3, docs/maps.md §6)MAP_BACKGROUND_KEY, the installer's own Datafordeleren key, a second line of the git-ignored .env (never .env.local, never the database). Compose names it under environment: of the service map-background alone (profile map, run once by make map-background, on a network of its own with no other service of the stack): never api, postgres, caddy, migrate or worker, never the browser; blanked in make demo. It is a URL parameter (apikey=), so no URL is ever logged, raised, stored or printed: one function strips it and every output goes through it (services/worker/tests/test_k3_fetch.py searches every output for a sentinel). The optional third outbound call, to wmts.datafordeler.dk, only on the owner's command: the key and the tiles over the install's municipalities' rectangles leave, never a point, an address or a figure. The tiles are in the volume map-tiles, which Caddy alone mounts, read-only
LoopbackOnly Caddy is published, on 127.0.0.1:8080; the API refuses to start in local mode with another public address
DNS rebindingCaddy and the API accept only the Host values elo.localhost:8080, localhost:8080 and 127.0.0.1:8080 and answer 421 otherwise; the API requires the header X-Elo-Client: web on every request, reads included, and sends no CORS headers. Tests in B02 (A2v-11)
JWT claimsOnly exp and tokenType are read; nothing else is stored or logged (both tokens carry personal data in clear, L1)
Repository.gitignore excludes .env*, secrets/, data/; the guard rejects JWT-shaped strings and GSRNs outside the anonymised 579999… range in tracked files, except Energinet's documentation examples beginning 571313 under docs/research/ and docs/sources/ (A2v-15)
Personal dataPhase 1's only account is a private person's, or unclassified, which is treated the same (party_kind 0 or 2). The allowlist of §7 applies before anything is written; no consumer name or contact detail is ever stored; a GSRN is in one table. Phase 2 (phase-2.md §6.3, B72, B75): several accounts, each with a party kind (1 a company's, 2 a private person's, 0 unclassified and treated as private); the rest of this row holds for every account; one account's data are removed by make account-remove, the first account's by make purge
RetentionThe exception phase 1 makes to the rule that a private account needs a retention period: the data are the owner's own, on his own machine, and are kept until he deletes them; make purge drops the database volume. make purge (B02) asks for a confirmation, stops the stack, so that the worker releases the egress and leaves its pacing history in the handoff record (§5.2), and drops the database volume and nothing else. data/state/ is therefore left as it is, private as the row "State directory" has it: the handoff record must outlive the database, and the access-token files stay the owner's 0600 files in the 0700 directory; since the worker runs as the owner (N9), nothing there belongs to nobody or root, and removing a file there needs no other user's rights. No install other than the owner's machine runs phase 1 (A2v-11, A2x-07) Phase 2 (phase-2.md §6.3, B75): one further account's data are removed by make account-remove LABEL=<label>, after a confirmation and with the worker stopped: everything of the account in the database in one transaction as elo_owner, then its three files in data/state/tokens/, then VACUUM (ANALYZE) of what it removed from, so that the planner's statistics hold none of its values (B75f2); the first account's (env) are removed with the database, by make purge, after its line is taken out of .env. Neither reaches the owner's own copies and backups; make account-remove does not reach the database's own files either (freed pages and WAL segments hold deleted rows until they are reused: the volume's, make purge) (docs/operations.md §7.8)
LogsNever Authorization headers, tokens, claims, request or response bodies, GSRNs, names, addresses, quantities or upstream error texts; log calls take structured fields from an allowlist (request, query, job and run IDs, mp_id, both correlation IDs of an Eloverblik call, outcome codes, counts, durations). The suite's captured logs are scanned for eyJ, for 18-digit numbers beginning with 57 and for the sentinel values of §7

12.2 The capture: a stated exception (A2x-07, A2v-11)

AspectPolicy
Contentdata/capture/ holds complete, unredacted responses: GSRN, address, any name and contact field the API returned, every reading. It is outside the allowlist by design, because it is the only copy of history that leaves the API's window on 1 January. It holds no token, no Authorization header and no claim; the response of the token endpoint is never written to a file
LocationThe owner's machine only; git-ignored; directories 0700, files 0600. Never copied into a worktree, an image, a volume or a fixture; no test reads it in CI
Into the databaseOnly through the replay source, which applies the allowlist exactly as for a live response
RetentionKept by the owner until he deletes it; make capture-purge (B06b) deletes data/capture/ after a confirmation and refuses while a capture owns the egress. It is the backup of phase 1: the owner keeps a second copy where he chooses
What a lost database costsNothing that cannot be rebuilt: the capture is replayed and later days are fetched again, as long as they are inside the API's window. The change log since the replay is lost

13. Delivery

13.1 Rules for every epic

Naming as orchestration/WORKERS.md: brief orchestration/tasks/b<nn>-<slug>.md, branch build/b<nn>-<slug>, worktree ../eloverblik-wt/b<nn>-<slug>, review B<nn>v by another model family ("x" = Codex · xhigh).

Definition of done: reviewed; unit tests and the epic's acceptance tests pass in CI; migrations forward-only inside the epic's block; the epic creates only what §13.3 assigns to it; copied files are in the notice inventory with a VENDORED.md; no token, real GSRN or metering data in the repository; behaviour documented under docs/.

Generated data and real data. A worker builds and tests on generated data only. Where a criterion names the owner's data, the lead runs that step on the owner's machine and records the result without figures (A2v-05). Size: S = half a session, M = one session; no epic is larger.

13.2 The epics

EpicScopeAcceptance criteriaDepends onSizeAgent · model · effortReview
B01 Repository and toolinguv and pnpm workspaces with every dependency of phase 1 (httpx, zstandard, apscheduler, pydantic beyond S&OP's); Makefile; ruff, mypy, Biome, tsc; licence policy, notice inventory, THIRD_PARTY.md; naming and secret guard; CI; README.md in line with D5make check passes on a clean checkout, including with docs/research/ as it is (the 571313 examples). On a branch with deliberate violations CI fails on: a disallowed licence, a generated token file without its notice, the guarded string in a guarded path, a JWT-shaped string, a GSRN outside 579999…–SClaude · Sonnet · mediumAgy
B02 Stack skeletondeploy/: PostgreSQL, migrate, API in local mode with /healthz, worker with the job queue and job discovery, Caddy; migration runner; three roles; make purge; for §5.2 the worker's mount of data/state/ (as built from version 1.3: mode 0777, for the image's nobody; B02b makes it private, N9), its single instance (fixed container_name) and stop_grace_periodmake up serves on loopback only; the API refuses a non-loopback address; a wrong Host gets 421 and a request without X-Elo-Client is refused; the token variable is in the worker's environment only; elo_api is not an owner and has NOBYPASSRLS; job discovery and dispatch run a job of a fake queue once (the tables are B03's); two migration heads fail CI; make purge asks for a confirmation, stops the stack and drops the database volume and nothing else; a second worker container cannot be started; mkdir of one directory under data/state/egress/ from the container and from the host at once has exactly one winner in each of 100 roundsB01SClaude · Sonnet · mediumCodex high
B02b Private state directoryN9 (§5.2 "the state directory is private", §1.2, §12.1). For the worker: Compose user: from ELO_UID and ELO_GID, HOME, the two writable paths, no passwd entry needed. make up: sets the two variables, refuses UID 0, creates data/state/ and egress/ 0700, runs the host half of the start check and the mount check, sets ELO_STATE_MOUNT. The start check as one function in elo_sources.eloverblik, called by the client before it acquires the egress in either mode, by the worker's process at its start and by make up. The files of B05 under the directory not writable by group or others. The stack check's cases. No table, no migrationPT-19…PT-21 pass for each mode, with no call sent and nothing in the directory changed; the message holds the path, the fault and the mode and no secret; a refused worker exits non-zero and make up fails with that message. On the live stack (PT-22), on a state directory of the check's own, never the owner's data/state/: a file made by the host is read by the worker container, and a file made by the container is read by the host and is the host user's, mode 0600; after make up on a clean checkout the directory and egress/ are 0700 and nothing under them is nobody's or root's; a 0777 directory is refused by both modes, and so is a directory of another owner (live where the mount enforces ownership, by the worker started under another UID; by PT-21 where it does not); the worker runs with a UID the image has no passwd entry for, and /data/state and /tmp are its only writable paths; docker compose up without the two variables starts nothing; B02's criteria still pass, the mkdir race of 100 rounds and the single worker among them, and so do PT-01…PT-18. CI runs the live check on Linux and the lead runs it on the owner's machine (macOS, Colima); the report gives the kind of mount each foundB02, B05 (both merged)SClaude · Sonnet · highCodex high
B03 Storage and reference dataEvery table of §3 with keys, checks, the exclusion constraint and the month partitions 2020–2031; ingest.reserve_start() and ingest.finish_call(); the recorder with its projection of IDs to mp_id; seeds; the calendar; the grants of §3.4 with empty function bodies for ts.apply_day and ts.observe_absenceEvery key is accepted by PostgreSQL 18 (btree_gist available in the image); 29 March 2026 has 1 380 minutes and 25 October 1 500 with the UTC bounds of §2; 45 grid areas, each in one price area; a March partition has the bounds of §3.4; elo_worker cannot write ts.reading directly; PT-02, PT-04, PT-05, PT-09 and PT-13 pass against ingest.reserve_start() and ingest.finish_call(); CT-01 (in the statement order of C3) and CT-07 pass against the constraint; a job enqueued in ops.job is run once; after the recorder has stored list, details and time series responses no column or body of a raw table holds a metering point IDB02, B04aMClaude · Opus · highCodex high
B04a Payload models, allowlist, contract fixtureselo_core typed models of the Customer API payloads and of the declaration rows; the allowlist of §7; fixtures/contract/ generated from the shapes of the saved samplesThe fixtures have the structure, keys and value types of docs/sources/eloverblik/samples/ (compared locally; the samples are not an input of CI); string-typed scalars, "", null and null arrays parse; the sentinel test of §7 passes on the models; the same seed gives the same bytesB01MClaude · Opus · highCodex high
B04b Generator and sourceselo_devtools.synth with a revision clock and the cases the test tables need (DST days, gaps, quality, corrections, withdrawn positions and days, a resolution switch, a P1M MP, MWH and KWT series, duplicate and conflicting periods in one item, hours with missing quarters, the access cases AT-01…11, the tree of L1); demo and replay MeteringSource; the demo organisation (6 sites); the frozen factor extract of §8 under fixtures/factors/Every case exists in the demo organisation and is asserted; the replay source serves a directory in the format of §6.4, first_load_to in the manifest included; the factor extract has the file format of §8, covers the demo organisation's period for DK1 and DK2 and is marked as generated; fixed seed, same bytes, the extract includedB04aMClaude · Opus · highCodex high
B05 Eloverblik clientelo_sources.eloverblik: the calls and parsing of §5.1; PaceStore (reservation, completion, recovery) with the file store and an in-memory store; the egress ownership and handoff; token file (in data/state/ as B02 built it; the start check that refuses an unsafe directory, PT-19…PT-21, is B02b's, N9); the response table of §5.2Contract tests on the generated fixtures, including 23, 25, 92 and 100 points and mixed resolutions in one response; PT-01…PT-18 against the file store, asserting sent starts, with the in-memory store as the other mode in PT-10 and PT-15…PT-18; of PT-11 the half that needs no database (the token file is deleted, the first call is /token with the new credential, no data call carries the old access token); a 400 is never resentB04aMClaude · Opus · highCodex x
B06a Plannerelo_core.plan: tiling, batches, the state table and ladder of §6.2, the edge search, the exhaustive search and probe-window, the anchor rule and the bootstrap chunks of §6.3, as pure functionsCT-03, CT-04, CT-06 and CT-08…CT-13 and AT-01…AT-11 pass against a simulated source; property test: after any sequence of outcomes the non-split chunks of an MP never overlap and cover the planned windowB04aMClaude · Opus · highCodex x
B06b Capture of the owner's historyelo_devtools.capture (§6.4): client, planner with the exhaustive search, file store, egress ownership, manifest, report; make capture-purge. Run by the lead on the owner's machineOn the demo source the capture equals the generator's truth, AT-06 and AT-11 included, and a resumed run makes no request twice; PT-10 and PT-15…PT-18 through the tool, and PT-19…PT-21 (N9): on an unsafe state directory the tool exits before any call; no body file of a token response exists, and the tool's access-token file is under data/state/, so that no file under data/capture/ holds a token (PT-12); manifest.json holds each tiled MP's first_load_to; make capture-purge deletes data/capture/ only after a confirmation and refuses while a capture owns the egress. Run on the owner's token by 15 December 2026, and in any case before 31 December 2026: the capture is complete in the sense of §6.4, with no chunk left outside: every day of the window of all four series is stored, individually refused, or reported with its code; it holds the charges and the Month controls; the report states per series the first readable day and the code for the day before, the calls (those of the exhaustive search apart), the latency and whether Retry-After was seen; the lead has compared the result with the owner's answer (§14), as a check and not as a condition; the owner has a second copyB02b, B04b, B05, B06aSClaude · Sonnet · medium for the tool; the lead runs itCodex high
B07 Master data ingestionThe PostgreSQL PaceStore with the egress ownership and handoff of §5.2, and the worker's side of step 0 there (the fingerprint compared with ingest.source_account, the generation); list and getdetails through the recorder; tree, versions, price area; make set-price-area; the weekly jobThe PostgreSQL store passes PT-02, PT-09 and PT-13 through the client, and PT-10 and PT-15…PT-18, all five, with the file store as the other mode; the database half of PT-11: after a restart with a different refresh token ingest.source_account holds the new fingerprint, its credential_generation is one higher and is on every later raw.fetch row; the demo tree is stored as parent with typed children; a second identical fetch adds no version; the sentinel test finds nothing in any column or log, and no metering point ID in raw.*; a protected address is not stored, and neither is the address of a version whose protected_name is not known (the list response), which is stored as NULL and never as false (§7); an unknown field is counted by name only; an unknown grid area leaves the MP without a price area, which make status lists (§6.5, B09). On the capture (the lead): the tree is stored and the grid-area code matches the reference table, or the difference is reportedB03, B04b, B05; B06b for the last criterionMClaude · Opus · highCodex high
B08a The merge functionsts.apply_day, ts.observe_absence, the validation V1–V6 and the merge transaction of §4.3; make verify; make withdraw-dayRT-01…RT-25 and UT-01…UT-06 pass; make verify recomputes every summary and hash from the rows and finds no difference after a randomised sequence of responses (R1, R5)B03, B04b, B06aMClaude · Opus · highCodex x
B08b Runner, first load, replayThe chunk queue in ingest.chunk driven by the planner; the backfill job; make load-capture, make refetch, make probe-windowA load of the demo source killed at random points resumes without duplicate or gap (CT-02, CT-05); every state of §6.2 is reached; a replay of a demo capture gives the same content (readings and day summaries) as the live first load of the demo source; LT-01…LT-06 (§6.4). On the capture (the lead): the owner's history is loaded and the E17 root's stored monthly sums of every year equal the Month values of the captureB06a, B07, B08a; B06b for the last criterionMClaude · Opus · highCodex x
B09 Daily run, scheduler, statusThe daily run of §6.5, the scheduler, make status (§6.5), make demoOn the demo source over simulated weeks: late days arrive and are loaded; a correction inside 14 days is applied once; a 20-day outage is repaired by planned chunks; CT-12; CT-14; AT-10 through the daily run; an MP that loses its relation and gets it back is restored to discovery and loads again; after two failed runs the days of RT-11 are listed as not confirmed; make demo brings up the generated organisation with the frozen factor extract of §8 from a clean checkout, without a call to Energi Data Service. With the owner's token (the lead): a run makes exactly 2 data calls and at most 1 token call, and the latest day with data that make status prints advancesB08b, B11SClaude · Sonnet · highCodex high
B10 Time functions and frontierSQL and Python: local day, expected minutes, hour cells and their correspondence (§2), the frontierSQL equals Python on both DST days and across a year boundary; with one hour never delivered the frontier still advances; no qualifying day gives low_coverage with the best day; an MP with no access is not activeB03SClaude · Sonnet · highCodex high
B11 Declaration loaderelo_sources.eds; the loader of §8 with history, file mode, the daily job eds-load and the monthly job eds-monthly-repull (§1.2); compare-declarations, the first command of elo_devtools.validate (§8)Against a local replay server: at most one call a minute, Retry-After honoured; a changed value, a changed version and a vanished row write history; an incomplete response is not applied; an unknown column lands in extras, a missing one stops the dataset; the monthly re-pull replaces a changed row older than 120 days; the frozen factor extract of §8 loads in file mode without a network call, and its rows lead to a raw.fetch row with source 9. Live (the lead): loaded from 1 January 2021; ADR-003 written after 24 NovemberB03, B04a; B04b for the extractMClaude · Sonnet · highCodex high
B12a Emission calculationcalc.v_emission_interval, calc.emission_matched, the Python reference, golden casesThe golden cases of §9.2; SQL equals the reference on the demo organisation to the last decimal for both methods; the tests of §9.3, eligibility included; a factor row changed in fx.factor_hour changes the next query's result with nothing recomputedB08a, B10, B11MClaude · Opus · highCodex x
B13 Web packages copied and renamedThe three packages at the recorded commits; the rename script; token generator and notice; one page with one chartThe upstream suites pass after the rename (634 and 75 cases, R4 §3.3, §3.5), adapted where D13's impact colours and D15's plain cards change a token or a style; Archivo is self-hosted with its licence; running the script twice gives the same tree; generated files carry the attribution and no claim of conformance; make guard passesB01MClaude · Sonnet · mediumAgy
B14 Shell IThe items of §11.2 for B14Presets resolve against the frontier, with tests on both DST days and across a year boundary; method, GWP set and basis round-trip through the URL; numbers and dates follow D4 and D16 from one module; the shell's adapted tests passB13MClaude · Opus · highCodex high
B15 Runner, catalogue, queriesThe runner and catalogue adapted (§10.1); the response of §10.2; grain and budget; the queries of §10.4 except report.footprint (B12b)An unknown parameter gets 422; g=auto never returns more than 750 points; a query over the budget answers too_large_for_grain; every emission response names method, GWP set, basis and factor status; mp.series returns NULL for a missing interval; an MP without a price area answers unavailable; meta.context returns each of the four account states of §10.4, token_expiring at 60 days and ok at 61; the like-for-like tests of §9.3 through overview.cards; every aggregate row carries the quality contributions of §10.2 and its two amounts add up to its total; 1 kWh at 100 g (Final) with 1 kWh at 900 g (preliminary) returns a provisional emission share of 90 % while Q04 says 50 %; g=auto returns 745 hours for 1–31 October 2026 and 676 quarter-hours for a week that holds 25 October 2026B12aMClaude · Sonnet · highCodex high
B12b Footprint query and validationreport.footprint; the validation of §9.4 in elo_devtools.validate (the module exists since B11) and make validateOn the demo organisation the footprint equals the Python reference; the tool refuses a target without a snapshot of its day and never touches the live database. Run by the lead on the capture and the snapshot: the result per block is recorded. If the owner's reports have not arrived, this stays the open item of the phase's exitB15, B08b, B11SClaude · Opus · highCodex x
B18 Dense time series chartThe chart of §11.2A week of hours renders as columns in three aligned tiers; up to 750 returned points render as one path per series, tested with the 745 hours of 1–31 October 2026 and the 676 quarter-hours of a week that holds 25 October 2026; the 23- and 25-hour days have true widths and 02A, 02B; a NULL is an empty band, never a zero or a bridged line; every quality state of the manual §9 is drawn as specified; the table view exists; layout tests on the marks' roles as in the packageB13MClaude · Opus · highCodex high
B16a Pages X1 and A1The two pages on the queries of §10.4Playwright on the demo organisation through Caddy at 390 and 1 280 px without console errors or horizontal overflow; the method switch changes the figures and every label; A1 shows consumption and emissions; a period with pending hours shows the note and the matched hours; the hatched part of a column is the query's provisional_amount; an MP without a price area shows Ikke tilgængelig; with the account in each state of §10.4 the page says when a new token is needed or will be within 60 days (with the days), says when no metering point can be read, and says nothing when the state is ok; the emission footnote says "checked against golden cases only" until a validation against an Eloverblik report has been recorded (§9.4, §11.1); the notation block of the manual's checklist (§18) passes by script. There is no sign-in step (A2v-15)B09, B14, B15MClaude · Sonnet · highAgy
B16b Page D1The page of §11.1The checks of B16a; the series of a DST day shows 23 and 25 intervals; a withdrawn interval is in the change list; a missing day is a gap; D15 is not drawn as a load; the windows not done are listed with their codeB09, B14, B15, B18MClaude · Sonnet · highAgy
B17 Design application IThe three pages brought to the direction: typography, grid and density, motion with the reduced-motion fallback, the drill-down, hover and focus, both themesEvery line of the manual's checklist (§18) is true for the three pages; axe reports no serious finding; screenshots at 390 and 1 280 px in both themes are reviewed by the lead and shown to the ownerB16a, B16bMClaude · Fable · highThe lead; then the owner's view

13.3 Ownership, migrations, waves

B03 creates every table of §3; no other epic creates a table, and an epic that needs a further column adds it in its own block and says so in its brief. The runner copied from an earlier internal project applies one chain of revisions, each executing one SQL file. Blocks of 20 numbers: B03 0001–0019, B07 0020–0039, B08a 0040–0059, B10 0060–0079, B11 0080–0099, B12a 0100–0119, B15 0120–0139, B12b 0140–0159. The lead sets the parent revision when merging; CI fails on two heads (A2v-05).

Wave1a1b1c1c+1d1e1f1g1h
EpicsB01B02 · B04a · B13B03 · B04b · B05 · B06a · B14B02bB06b · B07 · B08a · B10 · B11 · B18B08b · B12aB09 · B15B12b · B16a · B16bB17

Wave 1c+ (N9) holds B02b alone, and no other wave is renumbered: it needs B02 and B05 merged, and it comes before B06b, because the capture of the owner's history writes a token into data/state/. B02b has no migration block: it creates no table.

The capture's path is B01 → B04a and B02 → B04b, B05 and B06a → B02b → B06b: five waves, none of them needing a table (B02b's stack check starts the stack and writes no row).

13.4 Exit of phase 1

  1. The owner runs make up and sees his own consumption and hourly price-area emissions on X1, A1 and D1. 2. His history, every day of each series that the API could still read, was captured before 31 December 2026 (the capture is complete, §6.4) and is loaded; the parent's monthly sums equal the API's Month values. 3. The price-area figures agree with his price-area reports on the snapshot of their day, or the residuals are recorded and the lead has decided what follows. 4. The same pages pass on the generated organisation in CI.

Phases 2 to 4 are then re-planned from solution.md, its appendix of open findings, §1.4 of this document and what phase 1 measured: the latency of a call, the size of a response, the access edge, the restatement of 24 November.

14. Requests to the owner, and what phase 1 does not know

#Request or unknownWhy, and what happens without it
1Since when has the owner been the registered customer on the metering point, and when was the solar plant connected? (A2v-17)The searches of §6.3 find the readable days without it; the answer is a check on their result, not a condition of the exhaustive search. Without it the capture's report stands alone
2Price-area reports from Eloverblik: 2025 with 125 % and with 200 %, final and preliminary data, each with a snapshot of its day (§9.4)Exit criterion 3. Without them the emission figures are checked against golden cases only, and the pages say so in their footnote (§9.4, §11.1)
3Confirm that every method is computed, in phase 1 at query time, and available down to one interval (§9.1; D11 as narrowed in solution.md §1.6)The lead has accepted it on the owner's behalf
4Unknown, and measured or checked in phase 1: the exact cut-off of "5 years + current year", the latency of a call, whether Retry-After is sent, how the API answers at an access edge; whether Eloverblik's grid-area code is the public datasets' code; whether the declaration's history is recalculated on 24 November 2026B06b reports the first four; B07 checks the code and make set-price-area is the remedy; ADR-003 records the last (§8)
5A bill for a month with a DST day (A2v-17, second request)Needed for cost; asked for in phase 2

Appendix A – Round 2 findings: what was done

"Resolved here" means the finding has a rule, and where it concerns stored data a test row, in this document. "Moved" means it is a row of the appendix "Open findings for the re-plan of phases 2 to 4" of solution.md. Every finding was checked against the evidence it names. None is rejected: for none of them could a counter-example be constructed; where the remedy differs from the one advised, the row says so. Of the 35 findings, 23 are resolved here (9 of them have a later part that is also moved) and 12 are moved whole.

FindingDispositionWhere, and in what form
A2x-01 (blocker) Stale responses and absent daysResolved here§4: one watermark advanced by every accepted observation, equal hashes and absences included (RT-03, RT-05, RT-09); 30015 and edge days are not observations (RT-11, RT-13, RT-22); a wholly withdrawn window keeps its values, shown as not confirmed. One request in flight removes the reordering itself
A2x-02 Chunk key and splitResolved here§3.2, §6.2: surrogate chunk_id, exclusion constraint over open chunks with the account, split as a state, inherited attempts committed before each send, a ladder with a stated total (CT-01…CT-12)
A2x-03 Access-window searchResolved here for the first-load path; multiple windows by search moved to phase 2 (B27)§6.3: every chunk judged alone, the edge search only inside a bracket with a done neighbour, outside never reported as not_available, an exhaustive manual search (AT-01…AT-09). Built into the capture tool
A2x-04 Fixed and calendar readingsResolved here by having one store; the calendar path moved to phase 2§4.5 (UT-01…UT-06)
A2x-05 Lock barrier; as-of misses first loadsThe seam resolved here; the barrier moved to phase 3§3.4: first_loaded_at is immutable and every later change is logged in order (RT-18)
A2x-06 Lock inputs insufficientMoved, phase 3–
A2x-07 Removal does not reach packages and capturesThe capture's policy and the private-account exception resolved here; the removal workflow moved to phases 2 and 3§12.1, §12.2
A2x-08 Claim keys across wrappersMoved, phase 3–
A2x-09 Market-based facts not invalidatedMoved, phase 3–
A2x-10 Method per allocated partMoved, phase 2–
A2x-11 Node-hours lose weights and methodsMoved, phase 3 (kept physical in phase 2)–
A2x-12 Mix coverage denominator and membershipMoved, phase 2–
A2x-13 Cost observation versionsMoved, phase 2–
A2x-14 Supplier declarations per contractMoved, phase 3–
A2x-15 Early rounding of weighted aggregatesMoved, phase 2Phase 1 stores no weighted aggregate
A2x-16 Credential replacementResolved here for phase 1's replacement by restart; replacement during a call in the sealed store moved to phase 2§5.2 step 0, P6, PT-11
A2x-17 Call spacing across restartsResolved here§5.2: every start reserved in a committed row before the call, for all kinds of call; Retry-After on 503; the capture tool's separate store and its guard (PT-01…PT-10)
A2x-18 Elapsed time and the owner's call countResolved here; the timing of large runs moved to phase 2§6.6: base calls and overheads apart; batches may mix resolutions; the daily run is 2 data calls and at most 1 token call; throughput is not called elapsed time
A2v-01 The rule that deletes readingsResolved here§4.3: only 10000 observes; absence is judged on the union of an MP's items and inside the delivered range; 20 hours between sightings; a replay never counts; the watermark moves on confirmation (RT-06…RT-14, RT-19, RT-23). The advised 24 hours became 20 because two daily runs can be 23 h 50 min apart
A2v-02 Access edges needed in phase 1Resolved here§6.3, §6.4; in the capture tool and the worker through one planner
A2v-03 Hours without a factorResolved here, in the lead's form§9.3: matched hour cells on both sides, with their count, instead of the advised day threshold; the intensity divides by the consumption of hours with a factor
A2v-04 D1 has no chart for its hoursResolved here, in the lead's form§11.2, B18: the dense, time-true tier chart of the prototype's detail page is built in phase 1, with the quality states in its marks, instead of only adding quality marks to the copied column chart; mp.series returns one row per expected interval
A2v-05 The phase 1 planResolved here§13: B04, B08, B12 and B16 split; the pace store named (§5.2); the recorder and job discovery owned (§3.1, §1.2); no backup or partition job, partitions created ahead, the capture as the backup (§1.4, §12.2); migration blocks for every epic with SQL (§13.3); the sentence on real data (§13.1)
A2v-06 A report belongs to the factors of its dayResolved here§9.4, §8 (ADR-003, monthly re-pull in B11)
A2v-07 What the design task is not asked forResolved here§11.3: A2 has since delivered the checklist as §18 of the notation manual, and B16a, B16b and B17 are accepted against it; X2 is not a phase 1 input; B17 on Fable
A2v-08 Frontier edgesResolved here§2; calendar-resolution series are not stored and therefore not active
A2v-09 No page shows emissions over timeResolved hereA1 takes the measure as a parameter (§10.4, §11.1)
A2v-10 What phase 1 does not needResolved here: cut§1.4. Beyond the four advised items, the stored facts, the dirty queue, the month tables, the cache and the export are cut as well
A2v-11 Security and privacy of phase 1Resolved here§12, all five items
A2v-12 Keys and partitionsResolved here for the tables of phase 1; the rest moved§3: ts.reading_change unpartitioned with one key; ingest.chunk by surrogate key, daily success in ingest.mp_state; ts.day_load sized; §3 is the list of phase 1 tables. core.mp_access, calc.dirty, agg.node_hour, rpt.locked_fact, calc.v_emission_day and the anomaly table do not exist in phase 1: moved to phases 2 and 3
A2v-13 Four things the scale gate should knowMoved, phase 2The off-peak window is not in phase 1
A2v-14 The business-login run comes lateMoved, phase 2Made possible earlier: the capture tool of B06b runs on any Customer API token
A2v-15 Texts left behindThe three that concern phase 1 resolved here; the rest movedNo sign-in in phase 1's end-to-end test (§13.2 B16a); the rename is a deterministic script (§11.2); the guard allows the documented 571313 examples (§12.1, B01)
A2v-16 Later phasesMoved, phases 2 and 3–
A2v-17 Two requests to the ownerThe first resolved here; the bill moved to phase 2§14

Round 3 findings: what was done

The final review reviews/architecture/codex-3.md (A3x-01…12; five major, seven minor, no blocker), applied in version 1.1 by worker elo-a1f-phase-1-fixes. Each finding was checked against this document and the evidence it names. All twelve hold and all twelve are applied; none is rejected and none is still to do. Where the review stated a contract and left the mechanism open, or where the simpler of two adequate fixes was taken, the row says so. The rows of A2x-03, A2x-17 and A2v-01 above are read together with A3x-01 to A3x-04 and A3x-07.

FindingDispositionWhere, and in what form
A3x-01 (major) Capture completion promises history the search leaves unsearchedApplied§6.3 level 3: the capture runs the exhaustive search over every chunk left outside before it is complete, bounded only by the API's window; §6.4 step 3 defines "complete", step 5 reports it; AT-06 changed, AT-11 added; costs in §1.4 and §6.6; B06a, B06b, exit criterion 2, §14 row 1. Added beyond the review: oldest first, because the oldest year leaves the window first
A3x-02 (major) A new MP can be shut out before its first readingApplied§6.3: today is a hint, not an observation; the anchor rule for readable_from; "awaiting first data" with one-day bootstrap chunks (purpose 2, §3.2); §6.5 step 1 restores an MP whose relation returns, step 4 ends a suspension on success; §6.2 state and outcome tables; AT-10; B04b, B06a, B09. Added beyond the review, because the API's answer for a day without data yet is unknown (§14 row 4): a refused bootstrap chunk and an empty 10000 are no_data with its retries, and a not_available day directly before the anchor is asked once more
A3x-03 (major) The capture/worker guard neither excludes nor hands overApplied; the mechanism is this document's§5.2: one egress ownership (a directory made with mkdir under data/state/egress/), release by the owner only, a handoff record of deadlines and counters, takeover after a crash by the same mode only, the other mode fails closed; PT-10 replaced, PT-15…PT-18 added; B05 (mechanism), B02 (mount, single worker, grace period, the mkdir race test), B07 (PostgreSQL store), B06b (capture). The waits after a handoff also cover the two clocks
A3x-04 (major) A reserved start is not a sent startApplied§5.2: ingest.finish_call() spaces the next call from completion; in_flight_kind (§3.2) and the recovery of step 0; P1, P2, P4 restated on sent calls, P7 added; the caller holds elo.ingest through the whole call; PT-13 added, PT-01, PT-02, PT-04 assert sent starts; §1.4 and §6.6 carry the cost; B03, B05, B07
A3x-05 (major) A matched hour can hold different durationsApplied§9.3: eligibility per MP and UTC hour (60 minutes with quantities, no A02 or A05, a factor), h, H, excluded_readings, excluded_factor; five tests added; matched in §10.2; B12a, B15
A3x-06 (minor) Replay import and its acceptanceApplied, with one simplification and one addition§6.4: manifest.json with a capture_id; ingest.capture_import (§3.2); import once, skip when complete, resume when partial, refuse on another hash; no chunk transition is replayed; LT-01…LT-05; B08b's equality is on content. Simpler than advised: imported chunks take new IDs from the identity, so no sequence is reset. Added: applied_through, so that a resumed replay writes no request row twice. Stated cost: a capture that grew after its import needs an empty database
A3x-07 (minor) The unconfirmed-day predicate and the data versionApplied§3.2: last_daily_requested_at, last_daily_date_from, last_daily_date_to, written for every attempt (§6.5 step 3); §4.3: "not confirmed" defined against the latest attempt, with verification failed, not delivered and observed absent apart; merge step 4 and ops.data_version (§3.1) agree; RT-11 changed, RT-25 added; B08a, B09. Ingestion progress is stated as not versioned
A3x-08 (minor) Duplicate series-days inside one itemApplied§4.3: V6 over all periods of all items, ts.apply_day once per series-day; A5 and §3.4 log deletions before insertions; RT-01 and RT-19 changed, RT-24 added; B04b, B08a
A3x-09 (minor) Statement order of a splitApplied§6.2 C3: lock the parent, UPDATE to split, INSERT the children, commit, for every kind of split; CT-01; B03
A3x-10 (minor) Retry-After shortenedApplied§5.2 response table: greatest of the existing deadline, Retry-After and the local back-off; the cap on the local back-off only; the fifth-503 pause as a lower bound; both header forms; PT-06 reworded, PT-14 added; B05
A3x-11 (minor) Quality contributions and chart limits across DSTApplied§10.2: solid_amount, provisional_amount, missing, incomplete and pending-factor minutes for AC and PY, the provisional flag, Q04 kept as a consumption statistic; §10.3, §10.4; §11.1, §11.2 and B18: up to 750 points, 745 and 676 tested; B15, B16a
A3x-12 (minor) Obligations without an ownerAppliedThe queued-job criterion moved from B02 to B03; make purge to B02 (§12.1), make capture-purge to B06b (§12.2); B09 added to B16b's dependencies; the projection of IDs to mp_id owned by B03's recorder and tested on raw.* (§3.1, §7); the token response is never a capture file (§6.4, PT-12)

Also changed, from the review's part "What I checked": the first row of §1.4 now names its workload, 5 000 L1 sites (20 000 MPs). Not changed, because they are remarks and not findings, and left for the briefs of B08b: a manual re-fetch that overlaps open work must reuse or split that work (C2), and recovery after a crash must advance the ladder on the committed attempt before it reserves again (CT-05).

Epics whose scope or acceptance changed in version 1.1: B02, B03, B04b, B05, B06a, B06b, B07, B08a, B08b, B09, B12a, B15, B16a, B16b, B18. No wave and no migration block changed.

Consistency pass: what was repaired (version 1.2)

Version 1.1 was edited in fifteen epics and not re-read as a whole. Worker elo-a1c-phase-1-consistency (brief orchestration/tasks/a1c-phase-1-consistency.md) read it end to end on 16 November 2026, as an editor and not as a designer. A repair makes two places of this document say the same thing, in the direction that the more specific or the later of the two already pointed. Where that needed a choice, nothing was changed and the point is in the list "Needs a decision" below. Checked by script as well: every section reference; every row of the six test tables (RT, UT, PT, CT, AT, LT: contiguous, none twice, none referenced that does not exist); every finding ID, epic ID, command, setting, job, table and column that the text names; the dependencies of §13.2 against the waves of §13.3; the arithmetic of §1.4, §3.4, §5.2, §6, §8 and §9.2. These checks found nothing beyond the rows below.

#WhereWhat was inconsistentWhat it says now
1§0, conventionsEight findings of round 1 are cited (A1x-02, -05, -06, -08, -09, -10, -15, -16), and the conventions named only rounds 2 and 3"A1x-02" is a finding of reviews/architecture/codex-1.md
2§0, conventionsThree kinds of ID exist twice: R1–R9 are invariants of §4.2 and R1–R4 research documents; D1, D14 and D15 are decisions of the owner and also a page and two MP types; B22, B27, B28 and B44 are cited and are no row of §13.2The conventions say how each is told apart. No ID was renamed
3§1.4, last row"Not built at all: … calc.emission_*" also covered calc.emission_matched, which §9.3 defines and B12a builds"the stored fact tables calc.emission_*", and the function is named as built
4§3.1, the recorder"B07, B08b and B11 call it": the merge transaction, which completes raw.fetch and inserts raw.fetch_item (§4.3 step 1), is B08a's, and the daily request is B09'sEvery epic that makes or applies a request calls it: B07, B08a, B08b, B09, B11
5§4.2, R4"loses all of them only through two absence observations", while the decision of §4.3 and RT-22 let make withdraw-day remove a named dayR4 names that exception and its path, step B6
6§5.2, step 1"only exp is read", while §12.1 says exp and tokenTypeStep 1 gives both claims and points to §12.1
7§5.2, step 2Transaction A did not write the attempted daily window, which §6.5 step 3 and §4.3 say it writesStep 2 writes it for the daily request
8§5.2, test cases"one recorder of outbound starts" used the name of the recorder of §3.1 for a test double"one log of outbound starts (a test double, not the recorder of §3.1)"
9§6.1, tiling"Later it adds chunks only for a gap (§6.5 step 2)", while §6.5 step 1 tiles a restored MP, §6.3 plans bootstrap chunks and make refetch plans a purpose-3 chunkAll four are named
10§6.2, state tableno_data meant "the item answered 30015" and empty "30015 after all retries", while the outcome table below it and §6.3 also make a refused or empty bootstrap chunk no_dataBoth meanings follow the outcome table
11§6.5, make status; B07An MP without a price area is "visible" in §7 and "listed" in B07's criterion, and no list had it; B07 cannot list in a command that B09 buildsmake status says per MP whether it lacks a price area; B07's criterion points there
12§6.6, declaration"4 to 7 (367 to 730 days)" for the monthly re-pull does not follow from its schedule (§1.2, §8: on the 2nd, from 1 January of the previous year): the longest run, on 2 December, is at most 702 days, which is 6 windows of 121"4 to 6", with the two ends of the range
13§6.6, after the tableThe paragraph "Time: …" followed the table without an empty line and rendered as a row of itAn empty line
14§7, kept fieldstypeOfMP stood among "the columns of core.mp_version", which has no such column: the type is core.metering_point.type_code (§3.3)typeOfMP is with the tree fields, as a column of core.metering_point
15§9.3, table"H cells with a reading", while the definition below it counts cells with at least one quantity (a point of quality A02 is a reading without one)The table uses the definition
16§10.4, mp.ingestionD1 shows the reason of a day not confirmed, the days observed absent (§4.3) and "awaiting first data" (§6.3); the query that feeds it returned none of themThe row returns all three
17§13.2, B03Its criterion stores list, details and time series responses after the allowlist, which is B04a's; it depended on B02 onlyDepends on B02, B04a. The wave is the same
18§13.2, B07Its last criterion runs on the capture and named no dependency for it, where B08b names "B06b for the last criterion"The same note as B08b. Both epics are in wave 1d: the builder does not wait for the capture, the lead's run does
19§13.2, B08aThe merge transaction sets chunk states (§4.3 step 3, C6, UT-01) by the planner, which is B06a's; it depended on B03 and B04b onlyDepends on B03, B04b, B06a. The wave is the same
20§13.2, B09"the data-through date advances": that date is the frontier (§2), which B10 computes and meta.context returns; B09 depends on neither and make status does not print it"the latest day with data that make status prints advances"
21§13.2, B11§1.2 has two declaration jobs; the scope named the monthly one only, so no epic built eds-loadBoth jobs are named
22§13.2, B11 and B12bcompare-declarations is a command of elo_devtools.validate (§8) and is B11's, while B12b's scope was the whole moduleB11 begins the module with that command; B12b adds the validation of §9.4
23§13.2, B15"the queries of §10.4" included report.footprint, which B12b builds"except report.footprint (B12b)"

Epic rows changed in version 1.2: B03, B07 and B08a (a dependency), B07 and B09 (the wording of one criterion), B11, B12b and B15 (the wording of the scope). Three repairs spell out work that the text already asked for and no row carried: B09's make status says which MPs lack a price area (11), B15's mp.ingestion returns three more things (16), B11 builds the daily job as well (21). No wave, no migration block, no table and no test row changed.

Needs a decision

Each of these needed a choice between designs, so version 1.2 left the text as it was. **The lead decided all eight on 16 November 2026; version 1.3 writes each decision in at every place it touches** (the second table below). The first table is as version 1.2 had it.

#WhereWhat disagrees, or is missingThe choices
N1§5.2 (after the egress table), §12.2, PT-12The capture tool keeps its access token in data/capture/.access-token. §12.2 says data/capture/ holds no token, PT-12 scans the capture's files for one, and the owner keeps a second copy of that directoryMove the file out of data/capture/ (under data/state/, as the worker's); or name it in §12.2 and PT-12 as the one exception and keep it out of the second copy
N2§6.2 outcome table, §6.5 step 420010, 40014 and 20012 set current_access = false "at once" when a chunk's item answers them, but only after three consecutive days when the daily request does, and there 20012 is not named at all (nor is 30017). State 6 outside names only the four date codes as its causeOne rule for both paths, or the reason why a chunk's answer weighs more than the daily window's; where 20012 and 30017 belong in step 4
N3§5.2 test cases, B07The line above the PT table has B07 run PT-10 and PT-15…PT-18 with the PostgreSQL store; B07's row has PT-15, PT-16 and PT-18 (and PT-02, PT-09, PT-13 through the client). And the database half of PT-11 (the generation on ingest.source_account and on every later raw.fetch row; the comparison of step 0) is asserted by B05 alone, which has no database, and no epic is named for the worker's side of step 0Which of the two lists is B07's; whether B07 also takes PT-11 and step 0's comparison
N4§3.3 core.mp_version, §7protected_name bool is not nullable and the address is withheld "when a flag is true". The list response carries no protection flag (B04a's report, point 1), so a value from it is unknown, neither true nor false; B04a withholds the address then, and the review B04av asks this document to say bool NULL and to state that ruleprotected_name bool NULL with "withheld unless known to be unprotected"; or master data versions from getdetails only
N5B09make demo brings up the demo "with the frozen factor extract". No section defines it: which hours, where it is kept, which epic makes it, and how the demo in CI has factors without calling Energi Data ServiceDefine it in §8 (a file in the loader's file format under fixtures/) and give it to B04b, B11 or B09
N6§5.2 response table, §9.4, §14 row 2The pages are to say that a new token is needed, and to say in a footnote that emissions are checked against golden cases only. No query of §10.4 returns the account's state, and no page epic has a criterion for eitherAdd the account's state to meta.context and both texts to B16a's criteria; or leave both to make status and strike "and the pages"
N7§3.1 raw.fetch_item, §4.3Five day counters for eight results of the two functions: noted and nothing have none, and days_written is not said to be loaded plus changed. RT-24 asserts on these countsState the mapping; say where noted is counted
N8§6.4, replay step 2"first_load_to is taken from the capture", and none of the capture's files holds it (chunks.jsonl has the columns of ingest.chunk; manifest.json the ID and the MP numbers)Put it into manifest.json; or derive it as the latest date_to of the MP's captured chunks

Decided, 16 November 2026 (version 1.3). Written in by worker elo-a1d-phase-1-decisions (brief orchestration/tasks/a1d-phase-1-decisions.md). Where a decision left a detail open that the text needs in order to be exact, the row says what was taken and marks it "taken here": the lead can change it without touching the decision.

#Decided 16 November 2026Where it is written
N1No exception: the capture tool keeps its access token under data/state/, as the worker does, never under data/capture/. §12.2 and PT-12 stay as they were§5.2 (after the egress table), §12.1 row "Access token"; B06b's criteria. Taken here: the file is the tool's own, data/state/capture-access-token, not the worker's file, because PT-15 has the worker start "without a token file" after the capture's token call
N2One rule: current_access describes the present and is changed only by the daily path; a chunk's answer sets that chunk's state and never current_access. 20012 and 30017 are placed by what R1 §3.3 says they mean§6.2: invariant C8, state 6, the outcome table (the two refusal rows are one, with no effect on the MP) and the paragraph "One rule for access"; §6.3 (awaiting first data); §6.5 step 4; CT-13 (B06a), CT-14 (B09). R1 settles both codes, so neither is treated as unknown: 30017 is a code about the request's dates and never an access code; 20012 is an access code with 20010 and 40014. Following from the one rule: a single local day refused by 20010, 40014 or 20012 is not_available, and a bootstrap chunk so refused is no_data, as C7, state 7 and §6.3 already said of every refusal
N3B07 is the first epic with the PostgreSQL store and takes PT-10 and PT-15…PT-18 with it, the database half of PT-11 and the comparison of step 0 on the worker's side. B05 keeps the halves that need no database§5.2: step 0, the line above the PT table, PT-11; the rows of B05 and B07
N4protected_name bool NULL; the address is withheld unless the name is known to be unprotected; NULL withholds it§3.3 core.mp_version; §7 (the rule and its reason); B07's criteria. B03 creates the column as §3.3 has it
N5The frozen factor extract is defined in §8: files in the loader's format under fixtures/factors/, the demo organisation's period, DK1 and DK2, generated values marked as generated; B04b makes it, B11 loads it, make demo and CI use it and never call Energi Data Service§8 (the row "From files" and the paragraph "The frozen factor extract"), §1.3; the rows of B04b, B09 and B11 (B11 now depends on B04b for the extract; the wave is the same). Taken here: the mark is in _meta.json and, once loaded, raw.fetch.source = 9; the latest days have no row, as in the real dataset, because B16a needs pending hours in the demo; in the demo stack the two declaration jobs do not run
N6The pages show it: the account's state in meta.context, and two criteria of B16a (a new token needed or needed within 60 days; the footnote "checked against golden cases only" until a validation is recorded)§10.4 (meta.context and the paragraph "The account's state"), §11.1 (two rules for every page), §5.2 response table, §9.4 row "Record", §14 row 2; the rows of B15 and B16a (B16b takes B16a's checks). Taken here: "no access" means that no MP of the account has current_access; the states have an order of precedence; the 60 days are compared in the query (§10.1); the footnote is a fixed text that the lead removes when the validation is recorded, so no query carries a validation state
N7days_written = loaded + changed; noted has its own counter; nothing is counted nowhere and is the remainder of the item's days§3.1 raw.fetch_item (the new column days_noted); §4.3 (merge step 2 and the table "The day counters of an item"); RT-08, RT-24. Taken here: with a repeated ID a series-day is counted once, on the first item of its MP that delivers it, and an undelivered day on the MP's first item
N8first_load_to is written into the capture's manifest.json, per metering point, and the replay reads it from there§6.4 (the files; replay step 2); LT-06; the rows of B04b, B06b and B08b

Epic rows changed in version 1.3: B04b (scope and criteria: the factor extract, the manifest), B05 (its half of PT-11), B06a (CT-13), B06b (the token file, the manifest), B07 (scope: step 0; criteria: PT-10, PT-15…PT-18, PT-11, the unknown protected_name), B08b (LT-06), B09 (CT-14, the demo without Energi Data Service), B11 (the extract; a dependency on B04b), B15 (the account's state), B16a (the account's state, the footnote). Changed without a change of their row, through a section they build from: B03 (raw.fetch_item.days_noted, core.mp_version.protected_name bool NULL), B08a (the day counters; RT-08 and RT-24), B16b (B16a's checks). New test rows: CT-13, CT-14, LT-06. No wave and no migration block changed; no table was added.

Decision N9: the state directory is private (version 1.4)

N9 did not come from the consistency pass. The review of the Eloverblik client found that a token write in data/state/, which the build of version 1.3 made mode 0777, can be redirected by another local user through a symbolic link (reviews/build/B05-codex.md, B05v-01, blocker). The fix round hardened the client, and its report (docs/build/B05-report.md, the open point on directory modes) showed that the directory is the cause: without the sticky bit another user can still delete, replace or block the files. **The lead decided on 16 November 2026: a secret never lives in a directory that another user can write to.** Written in by worker elo-a1e-state-directory-decision (brief orchestration/tasks/a1e-state-directory-decision.md). "Taken here" marks a detail the decision left open and the text needs; the lead can change it without touching the decision.

N9Decided 16 November 2026Where it is written
1The worker container runs as the host user's UID and GID (Compose user:, from the environment, set by make up), not as nobody. data/state/ and everything under it is created 0700 and owned by that user; a file with a token 0600. No 0777, no group trick§1.2 (the worker's row; "The worker's user"); §5.2 (the decision "the state directory is private": rows "One user", "Modes"; step 0); §12.1 (rows "Access token", "State directory"). Taken here: the variables are ELO_UID and ELO_GID, without a default, so that Compose starts nothing when they are unset; make up refuses UID 0, because nobody used to guarantee that the process holding the token is not root; nothing changes the mode or owner of a directory that exists; no file under the directory is writable by group or others
2Both modes refuse to start when data/state/ or a path component above it up to the repository root is a symbolic link, is not owned by the current user, or is writable by group or others; the message names the path and the mode, never a secret§5.2 (rows "The start check", "The worker's two halves"); §12.1 "State directory"; PT-19, PT-20, PT-21. Taken here: data/state/egress/ is examined as well; the message also says what is wrong (the link, the owner's UID, the bits), so "the mode" is read as the refusing mode and the permission bits are named too; the refusing process exits non-zero before any call, lock or file. Taken here, and the lead should look at it: the container sees none of the components above the mount, so the worker's check has a host half, run by make up, and a half in the container
3The mkdir ownership mechanism of §5.2 and the rule that a mode never takes over the other mode stay as they are; only who may write the directory changes§5.2: the egress table is unchanged, and the row "Unchanged" of the decision says so. B02's mkdir race criterion stays and is repeated by B02b
4The image must still run when the host UID is not known to it (no passwd entry): the service definition says what that requires§1.2 "The worker's user" (the table: a home, no user name, writable paths); B02b's criteria; PT-22. Taken here: HOME is /tmp. Measured on 16 November 2026 in the image's base (python:3.12.16-slim-bookworm, run as 501:20): no passwd entry, HOME is / and not writable, getpass.getuser() raises, /tmp is writable
5On Linux hosts and on macOS under Colima the bind mount must behave the same; the specification says what make up checks§5.2 (row "The mount check of make up"; the paragraph "Linux and macOS under Colima"); PT-22; B02b's criteria. Not as decided, because the mount does not behave the same, and the lead should look at it. Measured on the owner's machine (Colima profile elo, virtiofs): permission bits and links pass truthfully, and files made in the container are the host user's on the host; ownership is neither reported dependably nor enforced inside the VM (a container of another UID read a 0600 file in a 0700 directory; the owner reported for one directory changed between reads). What is the same on both platforms is therefore the outcome and not the mount: every one of the three conditions is judged where it can be read truthfully. Taken here: make up tells an enforcing mount from a pass-through one by whether a container of another UID can read the host's 0600 probe file, and passes the result in ELO_STATE_MOUNT; on a pass-through mount the worker's half in the container leaves the owner to the host half. The Linux side is expected, not measured: B02b's stack check in CI measures it

New epic: B02b "Private state directory" (§13.2), in the new wave 1c+ between 1c and 1d (§13.3); no other wave was renumbered. Epic rows changed in version 1.4: B02 (scope: how the directory was built, and that B02b changes it), B05 (scope: whose the start check is), B06b (criteria: PT-19…PT-21 through the tool; a dependency on B02b). Changed without a change of its row: B07, whose worker starts through the check that B02b puts into the worker's process. New test rows: PT-19, PT-20, PT-21, PT-22. No migration block changed; no table was added.

The three built epics against version 1.1

B02, B04a and B13 were built from version 1.0. This is what version 1.1 asks of each beyond that build, read from the specification, the reports in docs/build/ and the branches, and their state on 16 November 2026. It is not a review of their code: that is B02v, B04av and B13v. Version 1.2 asks nothing further of the three, and neither does version 1.3: N4 states what B04a built, and N1 needs nothing of B02 beyond its mount of data/state/. Version 1.4 (N9) changes what B02 built there, the directory's mode and the worker's user, and gives the change to the new epic B02b, not to a fix round of B02.

EpicWhat version 1.1 asks that the build from 1.0 did not doState on 16 November 2026
B02 (build/b02-stack-skeleton)Four things, from A3x-03 and A3x-12. (1) make purge: a confirmation, the stack stopped, the database volume dropped and nothing else (§12.1); the build had up, down and stack-check only. (2) For the egress ownership of §5.2, the worker's bind mount of data/state/, a fixed container_name and stop_grace_period: 150s, with the criterion that a second worker container cannot be started; the build had none of the three. (3) The test that mkdir under data/state/egress/ from the container and from the host at once has one winner in each of 100 rounds. (4) Discovery and dispatch against a fake queue, with the tables and the database-backed "run once" criterion left to B03; the build created ops.job and ops.job_run in revision 0001_ops_queue, inside B03's block, and tested against PostgreSQL. Its report had seven criteria; the row has tenNot merged. The fix round B02f (dba9b38) has all four on the branch and no table or revision. Still open there: the live checks of (2) and (3) and of the purge are written and were not run (make stack-check); the container_name is derived from the Compose project name, where §5.2 rests its proof of a single worker on a fixed one; B03 starts the chain at 0001 without a parent
B04a (merged, 2c346c9)Nothing. Its row is unchanged, and so is every rule its models implement. The new sentences of §3.1 and §7 give the projection of metering point IDs to mp_id to B03's recorder and the assertion on raw.* to B03 and B07; the models keep the IDs at fixed paths, which is what the recorder needsMerged after its review. Its report's open point, N4 above, is decided as the models already behave (version 1.3). Repair 14 moves typeOfMP to where the models already have it
B13 (build/b13-web-packages)Nothing. Its row is unchanged; the change of §11.2 (745 and 676 points) is in B18's chart, and §11.3 is unchangedNot merged; the fix round B13f is about D5 and D13, not about version 1.1. One number of this document waits for it: §11.2 and B13's row say the chart package has 634 cases at the pinned commit (R4 §3.3), and the build counted 673 with none removed. It is to be corrected here when the count is confirmed

Kilde: docs/architecture/phase-1.md i løsningens repository.