Skip to content

Invent tree aniket - Pumphouse estate: live Cosmos telemetry, Performance tab, and a reproducible bootstrap - #3

Merged
aniketdev2018 merged 71 commits into
IOTfrom
inventTree-aniket
Sep 27, 2026
Merged

aniketdev2018 merged 71 commits into
IOTfrom
inventTree-aniket

Conversation

@aniketdev2018

Copy link
Copy Markdown
Collaborator

Migrates ten days of PH_2/PH_3/PH_7 pumphouse history from the Cassandra export into Cosmos and switches the dashboard to reading that account live, adds a Performance tab for pumps and stations (KPI strip, time-range control with live/pause/zoom, and one section per engineering group) backed by a new series/ endpoint that samples a long window into a few hundred real snapshots rather than reading seventeen thousand, and reviews the estate dictionary into 1,452 approved points carrying their catalogue mapping, unit and the note recording each decision plus 743 withheld with their reasons — including Maple Grove Pump 02, whose remaining channels report a constant zero for the whole recorded window, so their unit cannot be settled and a borrowed one would draw a freezing machine. onboard_pumphouse_estate now takes a deployment from nothing to a drawing dashboard in one command, documented in .azure/deployment-plan.md section 14. Note that roughly 91,000 of the 131,000 added lines are generated data — the review packs and forty locale catalogues — so the ~50,000 hand-written lines are the ones worth reading; 818 backend tests, 6 Performance component checks, tsc and biome are green, and all 33 machines were swept against the live source with zero unit mismatches. The Azure rollout itself is still blocked on RBAC and has not been run.

Section 3 of the Cosmos handoff. The plant supplied the untrimmed Cassandra row;
this imports it and produces the file-based review pack, so unit decisions can be
made against real coverage instead of a 17-tag excerpt.

The snapshot is an envelope (station_uuid + snapshots[]) but plan_dictionary reads
{"rows": [...]} with Cassandra-shaped rows, so make_rows.py moves the keys across.
It is a pure transform: the -242.1 and 3276.7 style readings are carried through
untouched, because clamping them here would launder a data-quality question into a
plausible-looking number. Its output hash is asserted and pinned, since the import
refuses a file whose bytes differ from the one previewed.

Station 17 now holds 905 dictionary points: 606 exact catalogue matches, 252 by
alias, 47 unresolved, and zero owner/parameter conflicts. The 31 excerpt-era points
and their 25 approvals were preserved untouched. The exported pack has 25 approve
and 880 pending entries and was dry-run back through apply_dictionary_review as a
clean no-op, because an export that cannot be replayed is a report, not a review.

Nothing is approved from this snapshot. The 880 pending points collapse into 108
families, and the real decisions are few: 609 already carry a proposed unit and
need confirming rather than inventing; vibration is mm/s for motor DE/NDE per the
reference images but the pad channels are a different instrument and stay
unresolved; reactive power is MVAR but blocked on `var` being absent from the unit
registry; and 70 points were observed only as null, so approving one would fix a
type and a unit on no evidence at all.

Coverage is ragged in a way worth recording. Forty-nine families cover all fourteen
bays and twelve cover thirteen - every one of those twelve missing pump 7
specifically, its discharge-pressure transmitter and all eleven winding RTDs. That
is a coherent physical story rather than noise, and it is the shape a fabricated
transcription would not have, since filling the last entry is what pattern
completion does. P7 appears in the other forty-nine families, so the bay exists.
Missing stays unknown; it must not become zero.

Also records the trend-UI gap before it is lost. The backend already serves bounded
federated reads - GET machine/<pk>/trend/, capped at 2000 samples and 30 days, the
client naming a binding and never a tag - but the frontend is a 135-line sparkline
with no picker, range, axes or units. Section 5a notes it is worth doing after this
review, since until units are approved a correct chart would still look broken, and
that `truncated` must stay visible because silently clipping a window misleads
about what the plant did.
Reviews the full dictionary from the data rather than from plausible-sounding
labels, and applies the result: 581 approved, 264 withheld with the reason written
onto the point, 60 left pending. 581 bindings now exist. Reasoning in
contrib/pump-cassandra/UNIT_REVIEW.md, decisions in PH_3.unit-review.json.

No network access was available, so this argues from two things that are available:
the actual values in the snapshot, and the conventions governing this machine class.
A unit is a claim about magnitude, so the data can confirm one or refute it.

The governing finding is that the reference snapshot was taken with the station shut
down. Every bay reports st=I and MOTOR_ON_STATUS=0, with zero active power, current
and voltage. Roughly a third of the dictionary only has a magnitude while running,
so it reads zero or transmitter noise, and volts versus kilovolts is indistinguishable
from a zero reading. Those tags were withheld rather than guessed - a unit fitted to
noise looks identical to a real one in the UI. A snapshot taken while pumping settles
most of them in a single reading and is now the most valuable thing to obtain.

Confirmed: degC for 479 temperature points, since a machine soaking at ambient reads
about 40 and the same body would read ~104 in degF or ~313 in K. Hz for 14, because
six bays sense 50.0 at the breaker while stopped, which fixes the scale outright.
percent for 28 valve positions clustered at the end stops. Unitless for motor status
and power factor, which are dimensionless by definition.

Also corrects something wrong in the previous commit. I recorded 70 points as
"observed only as null". The snapshot contains no nulls at all - all 845 dex values
are JSON strings. Those points are match_method exact, so the type came from the
catalogue, which deliberately declares the pad and spiral-case channels unknown and
asks for the quantity to be confirmed. The open question was never the unit, it was
what the instrument measures.

On that question the data now has something to say. The pad channels read 20 to 37
while stopped, where every genuine vibration channel on the same machine reads about
zero, and one bay reads -41.9, matching the open-circuit signature of the RTDs
elsewhere in the payload. That argues temperature. SPIRAL_CASE1 separates cleanly at
about 0.01, which is pressure behaviour. Both stay withheld with the argument
attached, because a resting proximity probe can also read tens of micrometres.

Records sensor faults found on the way, as value-quality findings that change no
unit: 3276.699951171875 on four temperature channels is exactly 32767 x 0.1 in
float32, the signed 16-bit maximum at 0.1 resolution, so it is a saturated register
and not a temperature. Under-range readings at -242.1, -118.5, -50.1, -47.9 and
-41.9. P9's valve positions at -118.5 and 141.8, outside 0-100 travel. And P6
reporting 1048 A of field current with its motor off, which is why excitation
current is withheld rather than approved in amperes.
…ion 4

The reviewed dictionary changed what the schematic can show, and exposed that the
schematic was pointing at things the review could not approve. Three of the five
drawn elements referenced unapproved points, which is what strict layout validation
was failing on.

One of the three has an approved twin. The forebay was drawn from /sl, which is
unresolved and has no catalogue parameter, while /dex/COMMAN_FORBAY_LEVEL is
approved in metres and is bit-identical to it across all four samples. Repointing
draws the reviewed point rather than merging two bodies of water, so it is a
correctness fix and not a plant-acceptance decision. It now resolves: 132.11 m,
quality good, where it previously rendered as null.

The other two cannot be fixed the same way. pump-power and pump-flow reference
/pd/{pump}/pmw and /pd/{pump}/dv, both unresolved with no catalogue parameter, and
the nearest equivalent - ACTIVE_POWER - is still draft because kW and MW cannot be
told apart from a shut-down plant. Both elements were left in place rather than
deleted: they record intent, and totals.power and totals.flow correctly report null
with reason incomplete instead of inventing a sum from bays that are not running.

Also records that the drawing now leaves 59 approved families undrawn, every one of
them repeated per bay, and why the ordering matters. Placing them before a running
snapshot arrives would mean laying out a diagram whose two headline numbers are
still blank for reasons the layout cannot fix.

The SVG and the layout JSON are updated together, since an element's SVG node must
carry the identical id and data-point template. All 187 machine_health tests pass;
the remaining /sl references are in the connector's flattening and its tests, which
are unchanged and still correct.
Takes the two remaining blockers as far as they can go without someone else, and
states exactly what is left so neither stays a vague request. New file:
contrib/cosmos/BLOCKERS.md.

Ask 1, the running snapshot. Before asking the plant, every payload in the
repository was scanned for a bay at st=R. One matched - and its own note says it
was synthesised for the tests. Its ACTIVE_POWER of 8.75 and PUMP_CURRENT_AVG of
412.5 were authored, not measured, so approving a unit from them would confirm the
fixture author's choice rather than the plant's scale.

That is worth more than a negative result, because the same file seeds the local
emulator. The dev mimic therefore shows a running station with plausible power and
current, and anyone eyeballing that screen to sanity-check a unit would be reading
invented numbers. Recorded in both BLOCKERS.md and the handoff: use it to check
layout, never as evidence about scale. value_ranges.py now takes a path argument so
the real snapshot can be analysed the moment it arrives.

Ask 2, the Cosmos grant. The blocker turned out to be earlier than the item said.
There was no application identity to grant anything to: zero managed identities in
the subscription, and the only data-plane assignment was Data Contributor - which
can write and delete - held by a human account at whole-account scope.

So a dedicated service principal aimms-pumphouse-connector now exists, with no
credentials and no permissions, inert until both are supplied. The Data Reader
assignment itself failed: the developer holds Cosmos DB Operator, and that role
lists sqlRoleAssignments/write and /delete under notActions by design, so that an
operator cannot grant itself data access. It needs Owner, Contributor or DocumentDB
Account Contributor, and it is one command.

The grant is scoped to /dbs/aimms/colls/pumphouse_readings rather than the account,
because the same database also holds telemetry and conversations containers that
this connector has no business reading. Role 001, Data Reader, not 002 - the
connector has no write path at all.

Also notes that a successful read probe does not prove the absence of write
permission, so least privilege should be checked by attempting a write and
confirming it is refused.
Builds the parameter-and-range chart the trend endpoint was written for. New
SignalTrendChart.tsx: a searchable picker over the machine's bindings, preset
ranges of 1 h, 6 h, 24 h, 7 d and 30 d - capped at the server's 30-day maximum
so the axis cannot claim a window the server silently shrank - axes labelled with
the reviewed unit, and a distinct message for every way a window comes back empty.
Wired into the health panel beneath the signal table.

Building it surfaced three defects, each of which made the chart misrepresent the
plant rather than merely look wrong.

Samples were drawn backwards. The old sparkline asserted the historian returns
newest-first and reversed them. It does not: read_window walks hour buckets
forwards and queries each with ORDER BY sub_time_period ASC. Checked against the
emulator - 591 samples, strictly ascending - so the reverse is removed. Time was
running right to left.

truncated could never be true for a real connector. read_trend asked for exactly
the number of samples it would return, so a connector that honours the cap - as
the Cosmos one does, returning as soon as it has enough - always looked like a
complete window. The flag only fired for a connector that ignored the cap, which
is precisely what the single existing test did, so the suite passed while the
feature was inert. read_trend now asks for one sample more than it returns and
trims the extra, making an overflow detectable; bounded_window gained a ceiling
argument to let that probe past the clamp. Two regression tests cover it and both
were confirmed to fail against the old code before being kept.

Truncation drops the newest data, not the oldest. Verified rather than assumed:
with a cap of 10 over 24 hours, the retained samples span 10:16 to 10:25 and the
following 24 hours are simply absent. The warning therefore says the most recent
part of the range is missing and suggests narrowing it. A chart that hid this
would assert the plant did nothing during a period nobody actually looked at.

The chart also declines to smooth over what it does not know: connectNulls is off
so gaps stay gaps, non-numeric samples are counted and excluded rather than
coerced to a number, a lone sample is called out as not being a trend, and
available: false is reported in the source's own terms - no connector, cannot
serve history, and could not be reached are different problems with different
fixes and should not share one message.

189 backend tests pass, up from 187. Type-check clean, catalogs extracted and
compiled so the new strings do not render as message hashes.
…re it survives

The trend picker built in the previous commit listed 581 parameters, but only 36
of them could ever plot. That was not a chart bug: the freshness loop rebased the
trimmed pilot excerpt, which carries ~31 tags, so 545 bindings had never received
a sample. An empty chart behind a confidently populated dropdown reads as broken
software rather than as an unpopulated fixture.

refresh_samples.py now takes --source/--target and the loop defaults to the full
845-tag snapshot. The loop also names the snapshot it used in its log; it
previously reseeded silently, so feeding the wrong payload left no trace.

The tooling moved from data/ to contrib/cosmos/devtools/, because data/ is
gitignored. Every one of these scripts, and the handover text pointing at them,
would have been lost on clone. For the same reason the loop now rebases the
tracked, hash-pinned snapshot under contrib/pump-cassandra rather than a second
untracked copy under data/ - duplicates of one artefact drift apart.

Verified against the live emulator: 581/581 bindings populated, fresh and good;
previously empty bindings return real windows in strictly ascending order, which
also re-confirms the sample-ordering fix on live data. 189 machine_health tests
pass.

Two things this surfaced, both recorded rather than papered over:

- The full snapshot is a single instant replayed once a minute, so most traces
  are a flat line of identical values. That is the fixture repeating, not a
  stable plant, and it is now stated in the handover.
- Nine channels draw confident lines that should not be believed: four pegged at
  32767 x 0.1, the float32 register maximum, and five under-range. All nine
  classify as unknown because no limits are set, so nothing in the UI marks them.
  A straight line at 3276.7 degC is a more persuasive way to be wrong than the
  same number in a table cell. No threshold was invented to hide them.

The saturation sweep itself is worth a caution, left in its docstring:
MachineSignalState.value is a dict, not a scalar, and the first version called
float() on it, skipped all 581 rows and reported "0 pegged" - a sweep that
inspects nothing looks exactly like a sweep that finds nothing. It now refuses to
report a result if it read no values.
The loop ran under `set -e`, so a single failing cycle terminated it. This was not
hypothetical: it happened during the previous change, when a transient error in
the refresh script ended the loop outright. Nothing announced it. The only symptom
was a log that stopped, and five minutes later every reading in the UI was stale -
which is precisely the "indistinguishable from a broken connector" state this
script exists to prevent.

A supervisor that dies on the first error is worse than no supervisor at all,
because a process list and a log file both suggest one is running.

Cycles are now independent. Consecutive failures are counted and reported, a
recovery is stated explicitly, and a missing snapshot is fatal at startup rather
than a silently ineffective loop. The script also logs its snapshot and interval
when it starts, so a log tail says what is actually being replayed.

The staleness warning is derived from INTERVAL rather than hardcoded. The first
version said "~5 min" after five failures, which is only true at the default 60 s
interval - at INTERVAL=1 it announced a five-minute outage five seconds in.
Verified across intervals of 1, 60 and 100 s: it fires exactly once, at 300 s of
real staleness, which is the freshness window it refers to.

Survival verified by forcing an unwritable target: the loop logged seven
consecutive failures and kept running where the old one would have exited after
the first.

Also fixes the two encoding warnings that surfaced once these files moved under
contrib/ and became subject to repository linting, which data/ had exempted them
from.
The window ceiling and the sample cap were two statements about one bound,
and they disagreed. PH_3 writes a snapshot every five seconds - measured,
not assumed: consecutive sub_time_period values in the pilot excerpt are
exactly 5000 ms apart. At that cadence the old pair (30 days, 2000 samples)
meant a "last 30 days" request returned the oldest 2.8 hours and stopped.

That is the worst failure direction available here. read_window fills from
the oldest bucket forward, so the cap drops the *newest* readings: the chart
comes back full, the axis says 30 days, and the part you opened it for is
the part that is missing.

So the cap is now derived from the window rather than set beside it -
MAX_TREND_SAMPLES = MAX_TREND_WINDOW_SECONDS // EXPECTED_SAMPLE_INTERVAL_SECONDS
- and a test asserts the two cannot drift apart again. A sample cap below
what the window implies is not a safety margin, it is a promise the server
cannot keep.

Six hours replaces thirty days. This is a narrowing, and it leaves a real
gap: there is no longer any way to look at yesterday. Doing that honestly
needs server-side decimation, which does not exist yet; widening the cap and
letting the truncated flag carry the bad news would have been the dishonest
version.

Consequently:

  - MAX_BUCKETS_PER_READ drops 24*31 -> 7, the most hour boundaries a six
    hour window can straddle.
  - The default window drops 24 h -> 1 h. This is what every unparameterised
    caller gets, including each sparkline on the machine page, and each of
    those samples costs a whole-station snapshot fetched and parsed for one
    tag.
  - Sparklines now ask for 10 minutes explicitly. The *window* is shortened,
    never max_samples - capping samples would trim the newest end and show
    the oldest ten minutes, backwards for a "recent trend".
  - The AI tool clamps hours to the ceiling instead of passing it through,
    so "last week" comes back shortened rather than as "trend unavailable",
    which would read as the source being broken.
  - Presets become 15 m / 1 h / 3 h / 6 h plus a custom range, refused
    client-side past six hours. The server check stays; the client is not a
    trust boundary.

machine_health 193 tests OK, assets 204 tests OK.
The custom range picker was written and type-checked but could not be used,
for two separate reasons, both of which are about the gap between source and
what is actually served.

First, nothing rebuilds the frontend automatically here. No Vite dev server
is running and only port 8000 is published, so Django serves the prebuilt
bundle under web/static, which was last built on 17 September. Every
frontend change since then - the 6 h ceiling, the reworked presets, the
custom From/To pickers - existed only in source. The UI was not wrong, it
was old.

Second, and the reason this needs a commit rather than just a build: the
"Custom range…" label had no catalog entry. Lingui generates hashed message
IDs and the production build strips the fallback message field, so a label
missing from the catalogs does not degrade to English - it renders as the
raw ID or as nothing. "Last 6 hours" happened to be extracted earlier and
so would have appeared, which is the confusing part: the Range dropdown
would have looked populated and correct while the one entry that opens the
pickers was unreadable or absent.

So the catalogs are re-extracted. Note this was done *without* `--clean`.
The cleaning run removed ~112k lines of existing translations across 39
locales, stripping entries merely not detected in this pass; additive
extraction is 3.3k insertions against 1.7k deletions, nearly all of it
line-number references moving.

Build output is not committed - web/static is gitignored (.gitignore:125) -
so this must be rebuilt wherever it is served:

    npx lingui compile --typescript && npx vite build --emptyOutDir

Verified: "Custom range…" and "Last 6 hours" are each present in 38 compiled
catalog chunks, "Last 30 days" is absent, and tsc --noEmit is clean.
"Is there any data in Cosmos?" could not be answered from this repository.
The fixtures under contrib/ describe what would be written; only the
container says what is there, and the two had drifted apart without anyone
being able to see it.

A document count alone is misleading in both directions, which is why this
reports four things rather than one:

  - The dev reseed loop writes a fresh document every cycle, so a large
    total can be one logical sample replayed thousands of times. The
    emulator currently holds 4813 documents that are, in content, a single
    snapshot.
  - The trend chart reads at most six hours, so a corpus can be large and
    still empty as far as the UI is concerned. Here: 4810 documents within
    30 days, 189 within the six hours anything can actually plot.
  - The cadence line distinguishes a slow feeder from a broken one. A
    median gap of 60 s against a source that samples every 5 s says the
    emulator is fed by a once-a-minute loop, not that the connector is
    dropping readings.
  - A max gap far above the median is the signature of a feeder that
    stopped and restarted. The current 7863954 ms is the container restart
    that killed the freshness loop for two hours.

Placed under contrib/cosmos/devtools/ rather than data/, for the reason
already recorded in refresh_samples.py: data/ is gitignored, so nothing kept
there can be handed over. Two throwaway versions of this did live in data/
while I was answering the question; they are deleted rather than left to rot.

Read-only - it issues SELECTs and nothing else. Defaults to the emulator;
reaching a live account needs a data-plane read role, which per BLOCKERS.md
Ask 2 has not been granted, so the live account's contents remain unverified
from here.
…attempt

Answers "can we put this data in Azure and read it back on the dashboard?"
with tooling plus a precise account of which half is blocked.

The write half works. The signed-in developer holds account-scoped Data
Contributor, so push_to_live.py can copy the emulator's accumulated readings
into the live container. It defaults to a dry run: the target is shared
infrastructure, and this is the only operation in this repository that a
container restart cannot undo.

Every copied document carries synthetic=true and a note. Without that these
would be indistinguishable from telemetry to whoever queries the container
next - and they are not telemetry. They are one PH_3 snapshot, captured per
Ask 1 while the station was **shut down**, replayed onto later timestamps by
the freshness loop. Unmarked, they would read as a pump that ran for six
hours at standstill values. The fields are additive, which the schema
permits (plan.md:490), and are not indexed, so they cost bytes and no RU.
--purge-synthetic deletes exactly those documents, matched on the marker.

The read half does not work, for two independent reasons, and BLOCKERS.md
records the second because granting the first would not have been enough:

  - The app identity still has no role. Confirmed structural rather than
    transient: Cosmos DB Operator, which the developer holds, lists
    sqlRoleAssignments/write under notActions. No retry will succeed.
  - Even with the role, the container has no credential to present. Every
    entry in the DefaultAzureCredential chain fails inside the dev server -
    no environment variables, no IMDS, no token cache, no Azure CLI on
    PATH. The connector refuses a key against a real account by design
    (cosmos_pumphouse.py:283-289), so there is no fallback.

Installing the CLI and mounting ~/.azure would satisfy the chain, and is
called out in BLOCKERS.md as a thing not to do: it authenticates as the
human, who can write to the whole account, handing the application exactly
the privilege the read-only design exists to withhold.

inventory.py gains the same COSMOS_ACCESS_TOKEN path so it can inspect a
live container from inside the dev container, which has the SDK but not the
CLI. Used here to establish that the live container holds 4 documents, all
dated 2025-07-18, and nothing within 30 days - so the dashboard would have
drawn an empty chart even if it could authenticate.

Verified: both scripts compile; live read returned the 4 documents; the copy
dry run selected 279 documents spanning 5.74 h; the purge path queries
successfully and reports 0. Nothing was written to the live account.
…t back

287 documents copied from the emulator into aimms/pumphouse_readings on
epconchatcosmos9d6b, covering the last ~6 hours at the emulator's one-a-minute
cadence. The live container now holds 293: the 4 original pilot snapshots from
2025-07-18, plus 289 recent ones. Before this it held 4, none within 30 days,
so a dashboard pointed at it would have drawn an empty chart even with working
credentials - which would have been indistinguishable from an auth failure.

Every copied document carries synthetic=true. They are not telemetry, and
BLOCKERS.md now says so next to the count: one snapshot taken with the station
shut down, replayed onto later timestamps. Verified removable - the purge query
matches exactly 289 and nothing else, so this is reversible in one command.

The reading procedure is now written down, because the shape of the remaining
work was not obvious. Only step 1 needs somebody else:

  1. The Cosmos data-plane role assignment. Still blocked, still structural -
     Cosmos DB Operator lists sqlRoleAssignments/write under notActions.
  2. A client secret. Not blocked: the developer owns the app registration
     (verified - owner Aniket, passwordCredentials 0), so this needs no favour.
  3. Three environment variables. EnvironmentCredential is first in the
     DefaultAzureCredential chain, so this needs no code change and no CLI in
     the image.
  4. Repoint the source - and clear secret_ref. Leaving the emulator's key
     reference set does not degrade to Entra ID, it raises CosmosConfigError,
     because the connector refuses a key against a real endpoint by design.
  5. check_pumphouse_readiness --source 1 --probe, before trusting the
     dashboard. A blank chart and a failed auth look the same on screen.

Flags checked against the command's own add_arguments rather than copied from
prose.
The remaining blocker is a role assignment somebody else must grant. That is
worth waiting on only if nothing else is also broken - otherwise the grant
lands, the dashboard still shows nothing, and the next problem starts from
zero having burned the wait.

So the real connector was run against the live account with the credential
substituted and nothing else changed:

    check():  ok=True detail='OK'
    read_latest(): 905 readings
    read_window(6h): 273 samples

That is the connector's own partition-key construction, paging, parsing and
flattening, against the documents actually in the live container - not a
reimplementation that might agree with it by accident. The role assignment is
the only missing piece.

prove_live_read.py builds the source in memory rather than saving it. Writing
the live endpoint onto HealthSource pk=1 would leave the dashboard pointed at
an account it cannot authenticate against the moment the script exits, which
is a worse state than the one it started in.

Two further things now settled and recorded:

  - Account keys are not a way around step 1. disableLocalAuth is false, so
    keys would work at the Azure level, but listKeys sits in the same
    notActions list as sqlRoleAssignments/write. Both doors are shut to this
    role, and checking cost one command.
  - The chart will draw a flat line. Every /dex/COMMAN_FORBAY_LEVEL sample in
    the live container is 132.0436248779297, because the 289 synthetic
    documents are one snapshot replayed. Worth writing down next to the
    success, or the first person to look will read a correct render of
    fabricated input as a broken axis.
The write landed and the data is intact - 293 documents, defaultTtl -1, so
nothing expired. What fails is the portal, and it fails quietly enough to look
like the write did not happen.

Data Explorer authenticates to the data plane with an account key, which it
fetches by calling listKeys. listKeys is in Cosmos DB Operator's notActions,
alongside sqlRoleAssignments/write. So the same role that cannot grant data
access also cannot read documents in the portal - the same wall met from a
different direction. The pane renders empty rather than reporting a credential
problem, which is the part worth writing down: an empty Data Explorer is not
evidence about the data.

Recorded with the SDK command that does work, because the developer holds
account-scoped Data Contributor at the data plane and Entra ID therefore reads
what keys cannot. Also recorded: the Data Explorer setting that switches it to
Entra ID, and the exact navigation path, since aimms holds three containers and
only pumphouse_readings has readings in it.
A single push_to_live run is a point-in-time copy, and your own inventory
caught it decaying: 54 minutes after the write, "last 10 minutes: 0". That
matters in two stages, and only the second is obvious.

At 300 s - the source's freshness threshold, confirmed as the configured
value on source pk=1, not the model default of 900 - every reading in the
copy starts reading as stale. On the dashboard that is indistinguishable
from a broken connector. At six hours the trend window has moved past the
copy entirely and the chart is simply empty. So a copy made in the morning
misreports as an outage by lunchtime.

keep_live_fresh.sh re-copies the tail every 60 s, which holds both open.
It invents nothing: it forwards what keep_emulator_fresh.sh produces, and
if that loop is dead this one will cheerfully re-copy an unchanging tail.

Two structural choices:

  - It runs on the host. The Azure CLI is here, the Cosmos SDK is in the
    container, and neither side has both. The token is minted here and the
    work is done there.
  - It re-mints every cycle. A token lasts about an hour, so minting once
    would survive a demo and then fail overnight - with stale readings as
    the only symptom, which is the exact failure this exists to prevent.
    One CLI call a minute removes the whole class.

No `set -e`, for the reason already recorded in keep_emulator_fresh.sh: a
supervisor that dies on the first transient 429 is worse than none, because
it still looks like one is running. Failures are counted and announced, and
crossing 300 s of consecutive failure is called out explicitly.

The overlap window is re-upserted each cycle rather than tracking a cursor.
Upserts are idempotent - the id is the sample time - so this rewrites ~15
documents per cycle instead of accumulating duplicates, which is affordable
against 400 RU/s and self-heals a missed cycle.

Verified running: five consecutive successful cycles, and the live account
went from a latest sample 54 minutes old to one 103 seconds old, inside the
300 s threshold.
Data Explorer reads documents with an account key via listKeys, which
Cosmos DB Operator cannot call, so the Items pane renders empty rather
than reporting a credential problem.
Separately, the container excludes /* from indexing, so ORDER BY is only
valid on the five indexed paths, and there is no sample_time field at
all - sample time is sub_time_period/egt in epoch ms. A query against
c.sample_time returns nulls without erroring.
The Data Reader grant landed, scoped to the readings container. Wires the connector identity into the dev stack and repoints the health source.

The credential is an optional env_file (required: false) so an ordinary checkout is unaffected and still uses the emulator. It is gitignored via *.env; docker.dev.env is tracked and must not hold it.

prove_live_auth.py injects nothing - the connector resolves its own credential, as the dashboard does - and probes a write, which is rejected. A working read proves authentication; only the rejected write proves the grant is scoped read-only.

repoint_source.py switches the source either way, because a source left pointing at an unreachable account reports as a dead connector.
No migration pipeline exists: there is no cassandra-driver dependency, no CQL execution and no write path to Cosmos outside tests. The plan defers it (plan.md:10-13, D2). So the question is a sizing one, and sizing it needed measurement rather than assumption.

Measured against the live container: a document is 97,243 B and costs 96.76 RU to write, and the aimms database is on 400 RU/s shared - the minimum.

The stated 25 GB and the observed 5 s cadence disagree by 24x: 13 stations for 30 days is 6.74M rows, which at the measured document size is 610 GB, not 25. The document stores data1_raw (50,066 B) and the parsed 845-tag dex (45,676 B), so it near-doubles the payload Cassandra holds once, compressed.

Both scenarios are reported rather than one being picked, because the answer moves from 18.5 h to 18.9 days depending on which holds.
AIMMS_MAINTENANCE_SCOPE_RESOLVER is read from the environment, so anyone
with it exported ran the whole suite against their deployment's resolver
rather than the test actors: 279 failures that read like permission bugs
and are nothing of the sort. Ignore it under TESTING, where the actors are
the thing being tested.

Also split fork_apps() out of builtin_apps() - byte-identical, so upstream
behaviour is untouched - so the fork's suites can be addressed without
naming upstream's, and give the work-order RBAC test the two asset tables
it actually reads.
Reads the local Cassandra export and writes the same snapshots to the live
Cosmos container, keeping every observation at its true timestamp: the
record has to stay reconcilable against the source, and that is what caught
three separate classes of silent loss which the migrator itself reported as
success.

Three properties the runs were rebuilt around:

* Reconciliation is mandatory, not a formality. A range read that stops on
  its end boundary misses the hh:59:59.999 row of every range, and the run
  reports success either way. The reader now takes one partition past the
  end and filters, and counts are checked against Cassandra afterwards.
* Documents omit the parsed `dex` map. flatten_snapshot re-parses data1_raw
  anyway, so inlining it doubled every document for nothing - and bytes on
  the wire, not provisioned throughput, was the real limit. Raising RU/s
  bought about 1.1x until the documents were halved.
* Throughput is restored from a trap, not from the end of the happy path. A
  raised shared throughput is a standing charge, so "we forgot to lower it"
  is the expensive failure, not a slow migration.

estate.json records the fifteen stations with their observed pump counts and
ratings, and marks which figures are documented and which are inferred -
`discharge_per_pump` carries no confirmed unit, and saying so is the point.
Three findings from reviewing the migrated dictionaries, and the machinery
one of them needed.

ACTIVE_POWER is MW, not kW. At Saraswati under load the tag, the station's
own /pmw field (documented MW) and the nameplate all read 24.5 against 40 MW
rated. Correcting it exposed a second problem: the approval guard checks
that a point's unit is *reconcilable* with the catalogue's, not equal to it,
and kW converts to MW - so a stale kW would pass validation and then read a
thousand times low wherever a total is summed.

The pd block now resolves `dv` as well as `st`. That block is a per-bay
summary of measurements the dex block also carries, so resolving it
wholesale would give one catalogue parameter two dictionary points and the
clash guard would reject whichever was approved second - `pmw` duplicates
ACTIVE_POWER and `pmvar` duplicates REACTIVE_POWER. `dv` has no dex
counterpart, so excluding it left the station flow total with no contributor
it could ever bind. It now has a catalogue parameter, deliberately carrying
no unit.

A withheld point may now carry a mapping. Recording what a tag *is* and
approving it were previously the same act, so the only way to give `dv` a
catalogue home was to assert a unit nobody has: it reads the stated design
discharge while a bay runs and zero while it does not, and the station /dv
is the exact sum of its bays in every sampled snapshot, but no source states
its unit and hydraulics only narrow it. Mapped points that are not approved
are never bound, so nothing is published either way.
The estate holds ten days of real plant history at its true timestamps, and
the dashboard renders *now*: the mimic marks anything past the source's
freshness threshold as stale, and trend panels ask for the last hour. Aimed
at a fourteen-month-old window every panel was empty, and correctly so.

CosmosPumphouseReplayConnector closes that gap without touching the record.
It reads the same container as the live adapter and applies one affine map,
source = window_start + (wall - anchor) * speed, re-stamping readings to
wall time on the way out. Nothing is written and no stored timestamp is
rewritten; delete the adapter and the record is unchanged. The checkpoint
stays in source time, so it keeps meaning "the last real sample accepted"
and stays forward-only - only the readings are shifted, not the documents
that advance it. The replay ends rather than loops, because looping would
mean rewinding a forward-only cursor on every lap, which is an
administrative act and not something an adapter should do to itself.

Because what it shows is not the true observation time, it is a separate
registered connector rather than a mode of the real one: a source is either
replaying or it is not, and which one is visible on the source itself. That
meant generalising five places that named the single connector key - the
polling sweep's filter and its constructor, activation's source validation
and picker, ingestion's station-scope guard and the freshness default. The
ingestion one mattered most: it forces Cosmos ingestion to name an explicit
station, and a replay source slipping past it would have allowed unscoped
ingestion.

The station power total now sums the reviewed ACTIVE_POWER tags instead of
the pd block's /pmw, which review never approves and which therefore could
only ever report "incomplete". Flow still reports incomplete, honestly: its
contributor exists and is identified, but carries no confirmed unit.

read_trend also now distinguishes a timeout from an unreachable source.
Both leave the trend unavailable, but they send an operator to different
places - a timeout usually means the window asked for more than the source
could return in time, not that anything is down.
Ranganayaka Sagar resolved 310 of its 371 points to no catalogue parameter at
all. That was not a mapping bug: it is a 134 MW machine where the other two
are 40 MW, and it carries instruments they do not have - upper and lower
guide bearing pads, oil reservoirs, stator core RTDs - under its own tag
spellings. The catalogue simply did not model that plant.

Twelve parameter series are added for it, expanding to 68 templates, hung on
components that already existed (GUIDE-BRG had been carrying none at all).
Nothing existing is altered: converting a scalar parameter into a channel
range would change its stored ownership definition and the loader would then
refuse to run, which is the failure the ACTIVE_POWER correction had already
caused once.

The unit could then be settled, but only for temperature. The station never
ran in the migrated window - zero running bays across 13,492 per-bay samples
- so nothing evidences power, current, voltage or discharge, and those stay
withheld. An idle machine still soaks at ambient, though, and ambient is
readable: medians of 28-29 with maxima around 31-34 are degC, not degF (28F
is below freezing) and not K (28K is cryogenic).

Each RTD is judged on its own samples rather than by family, because whether
one is wired varies by bay: 164 read a plausible band and are approved, and
105 sit at a constant -1, 0, 7.2 or 9.1 across thousands of samples and are
withheld as dead channels. Those are not evenly spread - Pump 2 accounts for
64 of them against 5 on Pump 1, which is an instrumentation finding in its
own right.

Coverage goes from 13 of 371 points to 185.
Saraswati ran one bay throughout the migrated window, so its tags can be read
twice - at rest and under load - and that splits the temperature channels
into three groups which are indistinguishable if you only ever see them
stopped:

* clean in both states, so the unit is confirmed under load and approved;
* sane at rest but pinned to the 3277 over-range sentinel whenever a bay
  runs. The unit is degC and the instrument is broken, which are separate
  findings: these are mapped so the tag resolves, and withheld, because
  approving them would publish a fault code every second a pump works;
* resolving to no catalogue parameter at all, which thirteen new series fix.

The sentinel verdict is reached per family and applied to every bay. Only one
bay ran, so eleven of twelve have no load samples of their own - but the
sentinel is a property of the channel, not of the bay that happened to be
running, and approving the other eleven would publish channels that pin the
moment those bays start.

Parvathi never ran at all, so only the at-rest band is available there. That
settles a unit - an idle machine soaks at ambient, and a median of 28-29 is
degC, not degF and not K - and it is what clears its four pad families, which
had been withheld as "source data type is unknown" when the measurements show
a clean ambient band. Their notes carry the sister-station caveat, because a
channel Parvathi has never seen run cannot be called sound under load.

Saraswati goes from 242 approved points to 367, Parvathi from 621 to 676.
Ingestion issued a SELECT ... FOR UPDATE and then an INSERT or UPDATE for
every single reading. A pumphouse snapshot is around 700 readings, so that is
~1,400 round trips per snapshot, measured at 8.6s to apply one - about 79
readings a second. Multiplied by the polling sweep's 50s budget it capped the
whole pipeline at roughly 3,900 readings a minute, which is why three
stations could not be replayed at once: their speeds had to be cut to 0.1x
and they still drifted stale.

The rows taken are exactly the same. They are simply taken once, and written
back with bulk_create and bulk_update. The same snapshot now applies in 1.0s,
about 676 readings a second.

Three things the loop was getting for free and now does deliberately:

* Rows are locked in primary key order, so concurrent batches acquire them in
  the same sequence. Holding many rows at once is a deadlock risk the
  one-row-at-a-time form did not have.
* A second reading for the same binding within one batch is still compared
  against the first. Previously the first had already been saved, so the
  second simply read it back; now the unsaved row is registered before the
  write so the replay rule still sees it.
* bulk_update does not run pre_save, so auto_now never fires on updated_at.
  It is set explicitly and listed among the updated fields.

With this the three replays hold 1x together - ages of 14 to 66 seconds over
eight minutes with no errors - where before they sat at a tenth of that speed
and still fell behind.
A pump's signal table draws a sparkline per bound parameter: thirty on
Saraswati, sixty-eight on Ranganayaka. Each fetched its own window, and
because a snapshot is a whole-station document that ``flatten_snapshot``
parses in full, the source read and parsed the same documents once per line
and discarded every tag but one. Measured at 6.4s a line - 192s for a
thirty-line table, 449s for a sixty-eight - against a 400 RU/s account.

Connectors gain ``read_windows``, which takes several keys over one window.
The default implementation loops ``read_window`` so existing adapters keep
working unchanged; the Cosmos adapter overrides it to collect every requested
key as each document goes past, and the replay adapter maps and re-stamps the
batch the same way it does a single window. It stops when every key has
filled rather than when the first has, because tags do not share a cadence.

``read_trends`` and a ``trends/`` endpoint expose it, grouping bindings by
source so each source is read once. Failures are reported per binding instead
of raised, so one unreadable tag leaves the rest of the table drawn rather
than blanking it.

The table now fetches once and hands each row its trend. A sparkline given
one makes no request; one standing alone still fetches for itself, so nothing
outside the table changes.

Saraswati's thirty-line table: 192s to 5.1s. Ranganayaka's sixty-eight: 449s
to 5.2s. Same samples, same windows.
Two defaults combined into a failure that looked like a React bug. The shared
axios instance times out at 5s, and a trend is a federated read of a historian
window - measured at 6.6s for a single sparkline. Every one of those requests
therefore timed out, and React Query's default of three retries for any
failure turned each into four. A pump's signal table draws a sparkline per
mapped signal, so a page that had held three of them before the dictionary
review now held sixty-eight: something near 270 doomed requests, each
resolving into a state update, which is what tripped "maximum update depth
exceeded".

The query client now declines to retry a definitive answer. A 400, a 403 or a
404 will say the same thing next time, so retrying only multiplies load on a
backend already in trouble and delays the error the user needs to see. A
timeout or a rate limit still gets another attempt, because both mean "not
now" rather than "no", and the delay backs off instead of hammering.
Mutations are not retried at all: a write is not safe to repeat blindly.

The three trend requests carry their own timeouts, following the pattern the
codebase already uses for slow calls elsewhere. The 5s default is right for an
ordinary API call and wrong for a read that crosses to Cosmos; the server
bounds these windows itself, so the client's job is to wait for them.
The chart asked for "now minus a window" and the date picker stopped at
today. This source stores readings at their own observation times - fourteen
months back - so every default window addressed a stretch the source was
never going to have anything in, and drew an empty chart with nothing to
explain it. The replay adapter had been papering over that by pretending the
past was the present, which broke date selection outright: a typed date got
mapped and clamped, so asking for a real day returned nothing.

Instead the span each station holds is recorded and used. A new
discover_data_range command probes hour buckets and stores the edges on the
source; the container is partitioned per station-hour with cross-partition
queries disabled, so the edges can only be found by probing, which is far too
slow to do on a page load and perfectly fine to do once. A data-range
endpoint serves it, the chart anchors its presets to the last reading that
exists rather than to the wall clock, and both date pickers are bounded by
the real edges, with a badge saying where the data ends.

The default window drops from an hour to ten minutes. A snapshot is a
whole-station document of ~55KB, so an hour is ~720 of them - roughly 39MB
pulled across for a line a few hundred pixels wide, which is what made these
requests time out. Ten minutes is ~120 samples, more than the chart can
distinguish, and 5- and 10-minute presets are offered first.

Probing is per hour bucket rather than sampled, because the gaps are real:
one of these stations holds data in only 50 hours of the 288 probed, so a
coarse scan would have reported edges that do not exist.

Measured after: 99 to 120 samples in 5 to 10 seconds per station, where the
same charts returned nothing at all.
Two changes that together make the migrated estate readable as a live board.

The dashboard now shows each station's ten days of history as the last ten
days. One offset is derived per station - enough to bring its newest reading
up to the present - and applied at the edges only: a window the operator picks
is moved back before it reaches Cosmos, and the timestamps that come back are
moved forward before they reach the browser. What is stored, queried and
reconciled stays on the plant's own clock, which is what keeps the migration
checkable against Cassandra. The offset is derived per request rather than
stored, so the newest reading stays "just now" instead of receding a day every
day, and every response carrying shifted times says so and by how much, with
the real edges alongside. This replaces the replay adapter, which had to be
re-anchored by hand, drifted whenever ingestion fell behind, and broke date
selection outright by clamping any date the user typed.

Separately, the per-request timeout to Cosmos is configurable. It was five
seconds, which suits an application deployed beside its account and fails
about half the time from a developer machine reaching one across the internet:
measured, a single partition query takes three to nine seconds there. It was
not volume - the same queries are charged ten to thirteen RU - it was
round-trip latency, and charts failed with SOURCE_TIMEOUT on windows as small
as two minutes. The default is unchanged at five seconds, so a nearby
deployment sees no difference; this one is set to thirty.

Before: Parvathi and Saraswati returned nothing at any window size. After:
120 and 99 samples for the default ten minutes, and Ranganayaka 104.
…ment

Five search angles and two adversarial passes. Neither ask was resolved, which
was the likely outcome, but the negative is worth keeping so nobody spends the
afternoon again.

The control is what makes it meaningful: the seven tags return nothing anywhere,
and so do the *already-catalogued* spellings - MTR_NDE_BRG_VBRTN,
PMP_THRST_BRG_VBRTN, THRST_BRG_THRST_PD_RTD - with GitHub code search returning
zero for each. The whole vocabulary is absent, not just the unexplained part.
Where a published convention does exist for this machine class it is IEEE C37.2
device numbers (38GT, 38THT, 71QBH/L, 26GS), which is a different scheme
entirely.

Two findings argue *against* the obvious expansions, which is the useful part.
Every source consulted treats bearing-oil-reservoir level as a high/low switch
rather than a continuous analogue, so OL_SMP_BRG_LT varying smoothly over 40-79
fits degC at least as well as a level; and in Indian lift-irrigation language
"sump" means the intake water sump, not an oil sump. Convention supplies
competing readings for exactly the fragments in question.

Two corrections are recorded because the first pass got them wrong and the
adversarial pass caught them. The Telangana portals are not DNS-blocked - that
was this machine's stub resolver, and through a public one eProcurement serves
its real front page; the documents are simply behind bidder login, so the route
is an RTI request or a bidder contact, not a search engine. And the ask must not
be redirected to ABB on the strength of "37 motors covers 12+14": MEIL's own
release puts 43 machines of 40 MW across those three houses and names BHEL,
Andritz and Xylem.

Measurement settled what naming could not. WT_CLR_CLD_INLT_WT_RTD2 is constant 0
across 524 samples on running and idle bays alike - dead, so what it was meant
to measure is beside the point. Its 12 points now say so, and Ask 3 is six tags
and 72 points rather than seven and 84.

One hypothesis is recorded as refuted. Four of the six sit on the recurring
plant constants 18.96, 118.5, 7.111 and 59.257 with perfectly symmetric ranges,
which looked like register aliasing. Tested by asking how often another tag on
the same bay holds the identical value in the same snapshot: 8% to 30%, not the
~100% aliasing needs. Written down so the appealing half of that is not
rediscovered and believed.

447 tests.
You asked whether the data can tell um from mm/s. It cannot, and finding out why
is more useful than the answer would have been.

Both candidates are magnitudes. Neither displacement amplitude in um nor
velocity RMS in mm/s can be negative, and 10-34% of these readings are - straight
from the payload at full float precision, not a sentinel and not a parse
artefact:

    PUMP12_MTR_NDE_BRG_VBRTN1_PROCESS_VALUE = '-0.12116609513759613'
    PUMP14_MOTOR_DE_VIBRATION1              = '-0.1519097238779068'

So the channel is not emitting a vibration magnitude in either unit, and the
unit was never what blocked it. The old reason - "ISO 20816 admits both um and
mm/s" - framed this as a standards decision someone here could take by picking
mm/s and recording why. That would have put a velocity on an operator's screen
that goes negative. It is an instrumentation question: is the signal rectified
or RMS-converted at all, or is this a raw signed analogue word?

158 points move from Ask 3's neighbourhood into Ask 1, which goes from 62 points
to 220 and is now the larger of the two open asks.

The half that is real is kept so it is not re-derived and half-believed. At 474
rpm the factor is 2*pi*f = 49.6, so one motion reads about 20x larger in um than
in mm/s; medians of 0.035-0.21 on stopped machines fit a velocity transducer's
noise floor rather than a proximity probe's resolution, which would favour mm/s
if anything had to be chosen. Nothing can be, because the reading that settles
it is one loaded machine and none exists in usable form - the estate's only
running bay holds its whole block frozen at 59.257, itself a sentinel.

447 tests.
You asked me to approve on your behalf. Of the 904, this is the part that a
decision actually unblocks - three points - and it is worth saying why it is
only three. The rest are not waiting on authority: 593 need someone to say
whether an instrument is wired, 72 need the integrator to say what a tag
measures, and 69 are deliberately unmapped and would become *less* correct if
approved, because the pd block restates what dex already carries and a second
dictionary point on one parameter makes approval ambiguous.

`/pc` is different in the way that matters. Its meaning comes from the payload
with no appeal to the tag name: it equals the number of pd entries reporting
st=R in 72 of 72 sampled snapshots across all three stations, and Saraswati
supplies the discriminating case - 1 while one bay runs, 0 while none do - so it
tracks the count rather than sitting on a constant. A count is unitless, so
there is no magnitude left to confirm, which is exactly what blocks its
neighbours.

Three changes, because the point was blocked in three places. The catalogue had
no parameter for it, so STATUS gains `Running Pump Count`. The importer never
offered a station-level field other than `st` to the matcher, so
`TOP_LEVEL_MAPPABLE_TAGS` now names `pc` as well - on the same rule the pd-block
gate uses, and `pc` is the only station field that passes it, since `pmw` and
`pmvar` restate the summed dex tags, `dv` is the exact sum of the per-bay
discharge, and `sl` has nothing to resolve to. Then the three points are mapped
and approved.

It renders: 0 at Parvathi, 1 at Saraswati, 0 at Ranganayaka - which is the
running-bay count at each.

1294 approved of 2195. The catalogue test's hardcoded template count moves 152
to 153 for the added parameter.

464 tests.
A "Pumps running" tile at (420, 155), below the discharge pipe and under the
station-status tile it pairs with. Reads 0 at Parvathi, 1 at Saraswati, 0 at
Ranganayaka - the running-bay count at each.

Three files, because the layout is a contract rather than a config. The element
goes in pumphouse.layout.json; the matching `data-point` annotation goes in
pumphouse-overview.svg, which `validate_assets` requires to agree with it
element for element; and `elementLabel` gains the translated caption. The role
is `value`, which `load_layout` accepts, and `/pc` carries no placeholder so
`expand_pointer` passes it through unchanged.

The i18n catalogs are regenerated, which is the step this needed and which I
first forgot: adding `t\`Pumps running\`` mints a new message id, and the browser
said so - "Uncompiled message detected: 9z2/7c". Shipping the bundle without
`extract && compile` is how the range dropdown once rendered as `PEGxvo`.

Verified through the payload and the render path rather than a screenshot. The
mimic query is deliberately `enabled: inViewport && visibility === 'visible'` so
it does not poll every five seconds off-screen, and the automated browser pane
reports `document.visibilityState === 'hidden'`, so the panel sits on its
spinner there however long it is given. What is checked: the element resolves in
the payload at all three stations, `valueText` applied to that payload yields
"0", "1" and "0", and the layout/asset contract test passes - it fails loudly if
the SVG and the layout disagree, which is the failure this change could
plausibly have introduced.

464 tests.
Drafting temperature thresholds turned up two defects that had to be fixed
before any threshold could be trusted. Both were invisible while no threshold
existed, which is why they had survived: with every binding unbounded,
classify() returns unknown and nothing downstream runs.

**The over-range marker was a first-class reading.** 3276.7 is the signed 16-bit
maximum at 0.1 resolution, 32767/10, and it reaches 3.3% of readings on approved
temperature points - 8.2% on cooling water inlet. It parses cleanly as a float,
so _coerce() called it GOOD. The first threshold set would have turned roughly
one reading in thirty into a critical anomaly about a measurement that never
happened, and no limit could have helped: nothing plausible sits above 3276.7.

Matched with a tolerance rather than by equality, because the peg arrives in two
float32 encodings one ULP apart - 3276.699951171875 and 3276.7001953125 -
carried by disjoint tag populations, so an equality test catches one and misses
the other. Kept rather than dropped or zeroed, for the reason the function's own
docstring already gave about unparsable values: "pegged" and "zero" are
different facts about a plant.

**Two of the three classify() call sites ignored quality.** The mimic refused a
reading whose quality was not good; summary.py gated on staleness alone and
anomalies.py checked nothing at all - and that one writes a *persistent*
anomaly. So a pegged channel could drive a machine's condition on the Health
blade while the same row displayed "Unusable or unknown" next to it. The same
shape as the sparkline that ignored plot_value while the chart honoured it: a
guard in one place and not its siblings.

The anomaly guard holds the fingerprint instead of skipping the state. Dropping
it would let auto-resolution close an open condition with "Signal returned
inside its configured limits" - a different and untrue claim from "the sensor
stopped reporting". A test pins that specifically, because the naive fix is a
bare continue.

The deep negatives are deliberately left alone. -118.5, -59.3, -592.6 and -853.3
are each the exact negative of a value the plant also reports positive, so they
are a sign fault on real channels rather than a marker, and suppressing them at
coercion would hide the fault rather than show it.

**The draft itself is in contrib/cosmos/THRESHOLDS.md, applied to nothing.** Two
adversarial passes over it both returned "disagree", and it is recorded with
their objections against it rather than tidied up. One row survives: stator
winding, 318 points, from IS/IEC 60034-1 Table 7 and IEEE 3004.8 cl. 8.5.2.1 -
and even that is conditional on a nameplate nobody has confirmed, which swings
it 25-30 K. The cooling rows would fire on a stopped plant today. normal_max is
unset everywhere on purpose: the estate is idle and the one running bay is
frozen on sentinels, so nothing here establishes where a healthy loaded machine
sits. Sixteen questions are listed that would settle it, and five families are
recorded as having no defensible limit at all.

472 tests.
warn_max 125 and critical_max 145 on 274 winding points, from IS/IEC 60034-1
Table 7 item 1a (85 K rise by embedded detector, thermal class 130(B), 40 degC
reference coolant) and IEEE Std 3004.8-2016 cl. 8.5.2.1 for the trip, 5-10 degC
below the class 155(F) insulation maximum.

Setting it on all 318 would have raised alarms on a stopped plant, and the
sentinel fix did not prevent that. With 3276.7 marked bad, 41 of 7,573 sampled
winding readings still breached - 12 above 145, including 191 and 192.8 degC in
a 29 degC hall.

They are not spread across the fleet. Six channels at Saraswati produce every
one of them, four of those in every sample taken (73/73, 73/73, 71/71, 12/12).
So the channels are classified from the data before any limit is written, and
the devtool sets limits only where a channel has at least 20 usable samples and
none of them impossible. That is 274 points; the six faulty ones are an
instrumentation question rather than a limit question, and 38 more - mostly
Ranganayaka, which holds 50 hours of data - have too few samples for silence to
count as evidence.

274 points now classify, 0 anomalies raised, 0 open.

No minima of any kind, and no normal_max. normal_max raises a warning and
nothing here establishes where a healthy loaded machine sits, every bay being
stopped. A normal_min or critical_min would be a quality gate written into a
threshold field, which fires on exactly the readings it exists to suppress - the
adversarial pass caught that in the draft and it is not repeated here.

The nameplate is still unconfirmed and the assumption is stated on the devtool.
It is not symmetric, which is why proceeding was acceptable: full class F rise
would put the true limits at 150/155, so 125/145 warns early. Class B insulation
would put them near 110/125 and this would warn late - unlikely for a 2019 BHEL
40 MW machine, and one nameplate photograph settles it.

Also corrected in THRESHOLDS.md: 318 is the number of points, but only 197
distinct tag paths, because the same tag exists at more than one station. The
draft said 318 channels and so did I; any per-channel analysis has to key on
(station, path) or it clears a point at one station on another's evidence.

472 tests.
Question 1 decides whether the 274 winding limits now live are right, and it is
the only item on the list that costs five minutes rather than a document request
to MEIL. It was sitting in a numbered list of sixteen, phrased for a reader who
already knows what a temperature rise is.

Now it is a short message ready to forward, saying what to photograph, which
machine, and why it matters - that the alarm points move by up to 25 degC if the
plate disagrees with the assumption, quiet in one direction and noisy in the
other.

Two things it asks for that the numbered version did not. The whole plate rather
than the two lines: a rating plate carries insulation class, rise, rated voltage,
rated current, duty and design ambient, so one photograph answers questions 1, 2
and 3 and part of 8 for the same errand, where asking for "the insulation class"
returns exactly one of them. And a second plate from Ranganayaka, flagged as not
urgent - those machines are a different rating and carry no limits today, all 38
of their points having fallen below the sample count needed to judge a channel.
The repair blade renders three timestamps through dayjs() and new Date():
the packet history's event time, and the finding and approval times on both
investigation panels. All three came from ModelSerializers, which build their
fields from the model and so fall back to the project-wide DATETIME_FORMAT -
"2026-09-26 10:48", space-separated, truncated to the minute, no offset. Both
functions read a string of that shape as local time, so every client outside
UTC misplaces the instant by its own offset.

Mixing InvenTreeIsoDateTimeModelSerializerMixin in fixes it the same way
machine_health already does, and keeps fixing it when a datetime field is
added to one of these models later.

Scoped to repair on purpose. The AI-chat and risk-radar timestamps the same
sweep turned up already serialise with .isoformat(), and the approvals app
has no frontend consumer to misread anything - a wider change would rewrite
endpoint contracts with no defect behind it.
apply_winding_thresholds.py sampled each station's span at hours // 70, which
is a reasonable stride where most hours hold data. Millbrook and Cedar Creek
hold about 80% of theirs, so every channel cleared the 20-sample bar. Maple
Grove (Ranganayaka) holds 50 of 288, and the same stride landed on about a
dozen - so 32 real channels were reported as "too few samples to judge" and
left unlimited. The plant was not sparse in a way that mattered; the sampler
was coarse in a way that did.

Each pass now covers the whole span at the current stride, and the stride
halves only while some channel is still short. A dense station is read exactly
as before, with no extra requests. Halving rather than stopping at the first
20 samples is deliberate: an early exit would judge every channel on the
opening hours of the span and miss the intermittent faults this classification
exists to catch - two of the six known-faulty channels are intermittent.

307 of 318 points now carry 125/145, up from 274. The six faulty channels came
back identical under the denser walk, which is the evidence that coverage, not
classification, is what changed. The remaining five are a different finding and
are now named rather than counted: approved, bound tags at Millbrook that
returned zero samples in all 288 hours, so those bindings will read unknown
whatever the limits say. Recorded with Ask 1.

Also corrects the earlier report: the 38 were 32 at Ranganayaka and 6 at
Millbrook, not 38 at Ranganayaka.
A trend reads every snapshot in its window, which is what a sparkline wants
and what makes anything longer than six hours impossible: the source writes a
whole-station document every five seconds, fifty kilobytes each, and an hour
of them takes thirty-five seconds to fetch. A performance page that shows a
shift, or a day, cannot be built on that read.

This adds a second shape of read, a series. The caller names how many points
it wants and the window is cut into that many slots, each answered by the
first snapshot in it - a TOP 1 query per slot, run eight at a time, so a day
costs a few hundred small documents whatever its length. Nothing is averaged:
every point is a reading the plant wrote, at the instant it wrote it, and a
slot the source has nothing for stays empty. A window short enough to read
whole is read whole, and the response says which of the two it did, with the
measured cadence when it was complete.

Connectors without a native sampler get the base class's default, a full
read that keeps one reading per slot, bounded at six hours like any full
read. The replay connector maps and restamps the way it does for trends.

The scope is the machine and its station: a station may read its bays and a
pump its station's forebay level, neither a sibling. Keys are accepted as an
alternative to binding ids and resolved inside that scope, so a page that
knows the tag need not look the binding up first. The signals list now
carries each binding's mapped key for the same reason - the mimic already
exposes it as the pointer.

Also names the poll interval, since a page that calls itself live has to say
how live: the plant writes every five seconds; this reads it once a minute.
Health says whether a machine is all right; this says how it is running, what
its parameters have done over the last hour or shift, and which of them move
together. It is drawn from two reads - the machine's current signals and one
sampled series read for every chartable parameter over the selected window -
and arranged by the questions an operator asks in order: what is happening
now (eight KPI tiles), is anything unusual (limits crossed, stale or poor
readings, and how much of the machine has limits at all), what changed (a
trend section per engineering group), where (each sensor family as one card
with a shared axis, a sensors-by-time heatmap and a comparison of current
readings) and how they relate (scatter views of pairs that are read together,
titled as relationships and captioned as patterns, not causes).

A station gets the same page at its own scale: forebay level and running
count, calculated plant totals, per-bay power and flow on one axis each, and a
bay table that links to each pump's tab.

Three refusals shape it. Units come from the reviewed dictionary point behind
each binding, never from this page, so an unconfirmed tag is absent and the
vibration section says so in words rather than drawing a line with a guessed
unit. Limits are the ones configured on the binding; a parameter without one
is drawn without a verdict. A missing reading is null and a gap in the line,
never zero - a stopped pump reading 0 MW is a fact, a pump with no reading is
not. Everything derived - cooling rise, air rise, spread across a family,
plant totals - is computed only where every input exists at the same instant
and labelled calculated wherever it appears.

Tag names differ by station, so the tab knows parameters, not tags: a
catalogue maps tag patterns to canonical parameters with a category, a family
role, precision and preferred chart. A new station's naming is a pattern in
that file, and anything unmatched lands in an "Other signals" table as the
cue to add one.

Live means re-reading on the cadence at which new data can appear; the
indicator is green only when the page follows the clock and the newest
reading is inside the source's freshness budget, and it states the cadence
facts - source writes every 5 s, read here every minute, last poll, whether
the window was read whole or sampled and at what resolution. Zoom is a drag
across a chart and a refetch at finer resolution, not a rescale; charts share
one crosshair. Point counts are sized to the window because a sampled read
costs its point count - each point is a 50 KB snapshot - and the sampler's
pool is widened so those round trips overlap.

Two Mantine chart facts found the hard way and pinned in comments: the left
Y axis is Recharts' default axis and has no id, so a series told 'left' binds
to nothing and the axis loses its ticks; and a brush on every chart sharing a
syncId makes them re-synchronise without end, which is why zoom is a drag.

Component checks run against fixtures shaped like a Cedar Creek pump in a
standalone harness (playwright.performance.config.ts): the tiles show fixture
values and state what they cannot show, families come out as sections with a
heatmap and calculated rises, the range control changes what is asked of the
server, live can be paused and says so, a failed history read keeps the
current values, and a drag zooms.
The over-range rule added this morning applies to every reading ingested
from now on, and to none of the readings already cached. MachineSignalState
is a current-value cache, and for a station whose history is a recorded
window it is a cache that is never rewritten: every snapshot up to the
recorded end was ingested yesterday, so fourteen pegged winding channels at
Cedar Creek and Millbrook kept "3276.7 degC · Good" on the Health blade
indefinitely, beside a rule that now says otherwise.

A data migration applies the same rule to the cache once. Copied constants
rather than an import, so the migration stays what it was when it ran; not
reversible, because the old value was wrong rather than different.
The day-based duration, the retry and clear-selection actions and the
status-code tile were added after the last extract, so the served bundle
showed a message id where the display-shift caption should have said
"441 d".
The signed-in account cannot read or update the Container Apps, so the
rollout is written down commit-pinned in the recipe sections 4 and 11 use,
with the rights an operator needs, the migrations it applies, and the
worker's stale image called out.
…lues

Two things the Performance tab hid. A parameter's decimals were fixed by the
catalogue, so a stopped pump's -0.0012 mH2O printed as "0" and a speed
wandering between 745.1 and 745.4 rpm printed as one unchanging "745" while
the line beside it moved. Precision now follows the data: the catalogue's
decimals are a floor, a small value keeps three significant figures, and a
value from a series whose whole range is narrower than that floor resolves
gets enough decimals to tell its ends apart, capped at five. Tooltips use
each line's own range, tiles the window's, families their spread.

The vibration section was an empty state because the 158 vibration points
were withheld: neither candidate unit can be negative and a third of the
readings are, so no unit could honestly be written on them. The operator
asked to see them anyway. They are approved the one way that asserts nothing
false - unitless raw source values, no threshold - by a devtool that keeps
the measured finding on every point and appends the decision. The section
and the KPI tile say in words that the value is the plant's raw word, may be
signed, and is not a magnitude to judge against a standard. Ask 1 stands.
The poller reads strictly after its checkpoint, which is the right rule for a
live source and a dead end for a recorded one: every snapshot up to the
recorded end was accepted long ago, so a point approved in a later review is
bound but never receives a value, and the Health blade shows "No reading"
beside it for good. This reads each activated station's newest snapshot once
and hands the readings for state-less bindings to ingest_readings - the
poller's own door, so coercion, the over-range rule and freshness apply -
and leaves bindings that already hold state alone. Used for the 158 vibration
channels approved today; recorded with the decision in BLOCKERS.md.

Also carries the extracted catalogue strings for the vibration caveats.
Marking the over-range marker bad quality fixed the Health blade and left
the Performance tab believing it: the winding tile picked 3276.7 degC as the
highest sensor and called it Normal, the family card averaged it in, and the
series layer would have drawn it. One rule now, the same the Health blade and
the mimic apply - only a good-quality number is a value; everything else is a
gap. Tiles carry the reading's quality and say "Bad quality" instead of a
limit verdict, the family card's highest, mean and spread use good readings
only and grey the rest at zero, and every series helper - rows, statistics,
heatmap, relationship pairs, calculated differences - skips samples whose
quality is not good.

The harness fixture now pegs one winding sensor at the marker with quality
bad and asserts it is neither the highest sensor nor anywhere on the tile.
Cedar Creek's idle pumps report -0.00058 mH2O, and at five decimals that
value pushed its unit past the edge of the KPI tile and lost the sparkline
beside it. The value row now wraps, the sparkline has its own full-width
row, and a label no longer truncates against its state badge. The window
caption prints both ends at one precision and joins a negative end with
"to", since "-0.00984–0.0208" reads as three numbers.

On the charts, a one-letter unit rotated through ninety degrees read as a
chevron or an E and collided with wide tick labels; units now sit upright
above their axis, and the axis is as wide as its widest tick. Every chart
of a window prints the same tick instants, so the shared crosshair looks
shared. Descriptions no longer name an axis whose parameter the pump does
not have, the unusual-strip counts only the pump's own signals, and a
station lists its bays in plant order rather than P10 before P2.
A screenshot of the tab in dark mode needs the provider told, since the
harness has no user settings to follow; ?scheme=dark does it.
A page that draws a dozen series asked for a dozen tokens at once, because
every connector built its own DefaultAzureCredential and closed it again
when the read finished. Each one walked the whole credential chain, and a
service principal's walk reaches login.microsoftonline.com - which was
being given the five seconds meant for a query against the account, on the
other side of the world. The reads that failed under load failed on the
token, not on the data, and said "the source could not be reached".

The credential is now a module global built once behind a lock, so the
SDK's token cache is shared with it and a connector's close() leaves it
open. Its budget is its own constant rather than the query budget, since
the identity provider is a different host at a different distance, and one
request may now retry a dropped connection instead of reporting an outage.

The emulator key is deliberately not shared: it is named per source and
still read from the environment on every call.
A second review round, six lenses over the rendered tab, found nine ways
the page drew more than it knew.

An idle pump reports exactly zero, and Recharts given a flat series invents
its own nought-to-four scale: active power sat under an axis implying the
machine reaches 4 MW, and a power factor whose physical maximum is one had
an axis running to four with no unit beside it to say which column was
which. Flat sides now get a band around their own value, and an axis
without a unit is named after the series it carries.

The sparkline had the same fault in miniature: every point of a constant
series mapped to the bottom edge, so the tile drew a full-width rule that
read as a divider, and the extremes of a moving series were clipped flat by
the box they were drawn in.

Three numbers were drawn from the newest sample without asking whether it
was usable, so the source's over-range marker could become a plant total, a
bay's reading and a confident "Running" - while the chart beside them,
which does ask, drew zero.

The heatmap clipped long row labels from the front, turning "Motor NDE
bearing vibration 1" into the name of a different channel on the same pump;
labels are now measured and, if they still do not fit, cut at the end where
the reader can see it. Its colour ramp was picked for a white card, so on a
dark one the coolest sensors were the brightest rows.

Two differently named inlet families shared one label, so the card showed
"Cooling water inlet 3" twice, a bar reported its neighbour's value, and one
of the two was dropped from the calculated rise without a word.

Re-enabling Live left the control highlighting "Custom" over abandoned
dates while the charts had gone back to a preset, and at the 24 h preset six
date ticks overprinted each other into unreadable text on every narrow card.
Twenty-four findings from a second review round, plus one fault of my own.

Mine first: stopping Recharts inventing a nought-to-four scale for a flat
line left the axis padded by a hundredth of the value, and a value is
rarely round. A voltage pinned at -592.5925903320312 V therefore got the
bounds -598.5185162353515 and -586.666664428711, and the axis printed them
- wide enough to overflow the card into the chart beside it. The band is
now a tenth of the value's magnitude and is ticked at round numbers, as a
moving axis already was.

The rest, in the order an operator meets them. A tile with no current
reading threw away the reading's age and its window range, so a gap said
less than it knew. Bar labels wrapped and overlapped until it was unclear
which digit belonged to which sensor, and the bars ran from an automatic
baseline, drawing a 1.12:1 difference as ten to one. The heatmap printed a
second, unlabelled number per row that disagreed with the bar beside it,
and told the reader a cell was the "mean of 1 readings". Plant totals were
dated by their freshest input, so a bay that had stopped reporting was
hidden behind one that had not. "Newest reading" was a bare clock time,
which for a past window reads as a time today. A full-screen chart lost
the chips that say which lines are drawn. The scatter repeated its unit on
every tick until the ticks wrapped into the axis title, named a twenty
minute band where it meant an instant, and in dark mode ran its time ramp
backwards so the oldest readings were the most prominent.

Two findings were refuted rather than fixed: the scatter's rotated axis
title and the trend charts' unit placement both render correctly.
The last three findings from the review, and one fault the verification
turned up on the way.

Opening a chart full screen showed the word "Trend" rather than the card's
own name on six charts, because a title had to be passed twice - once to
the card and once to the chart - and six call sites passed it once. A card
now tells the charts inside it what it is called, so the two cannot drift
apart again.

Chip and line colours were picked from a ladder of shade numbers fixed per
colour scheme, and no such ladder can be right for every hue: shade 6
clears 3:1 against a white card for blue and fails it for orange, teal and
cyan, which is why nine of forty lines on a pump page were drawn in
colours that could not be seen. The shades are now read from the theme's
own palette and measured against the card they will be drawn on.

That alone made the page legible and harder to read: a warm hue keeps only
three usable shades on white, so eleven winding sensors shared three
colours, and a fourteenth bay was drawn in the same teal as the first
because the hue list wrapped and started again. A family that outgrows its
own shades now continues into the neighbouring hue - windings run orange
into red into pink - and no colour is reused until the palette has nothing
left to offer. Fourteen bays are fourteen colours; every chip and line on
both pages clears 3:1 in both schemes.

Sections left half a row blank when they held an odd number of cards, and
stretched every card to the tallest in its row so the short ones carried
dead space. The grid that Electrical already used is now shared, and cards
size to their own content.
Pump 02 had 10 of 89 dictionary points approved where its siblings had 55, 60
and 71, which reads as a review somebody abandoned half way. It is not.

The 63 points in question already carry a component and a catalogue parameter,
so the crosswalk was done; what is missing is a unit, and the reason it is
missing is that the channels report nothing. Sampled evenly across the whole
recorded window - 46 snapshots over ten days - every one of them holds exactly
0, while the identical tags on the sibling pumps vary normally over the same
snapshots: 64 of Pump 01's 87 numeric tags move against 13 of Pump 02's 85.
Both bays read Idle throughout, so this is not a pump that was merely stopped;
a stopped pump still reports ambient temperatures, as Pump 01 does.

The ten points already approved are exactly the ones carrying live data -
bearing temperatures 2 and 4, shaft speed, discharge pressure, the motor
on/off pair. That earlier review was right, and this one does not overturn it.

Borrowing the sibling's degC would have filled the tab: eleven winding
temperatures, cooling water, bearing pads, all reading zero, on a page whose
contract is that it never shows a number the instrument did not report. A
value held for ten days is as consistent with degF or an unwired input as with
degC, so the review file records the finding against each point and carries
the sibling's settled decision in the note, leaving the unit one lookup away
for whenever the channel reports again.

Nothing is newly bound, because there is nothing new to draw.
The readings live in Cosmos, but what turns them into a page - which tag is
which parameter, what unit it is in, what it is called, and why each was
decided - has until now existed only in one development database. A fresh
deployment could be given the code and the telemetry and would still draw
nothing, because the 1,452 bindings that connect them were not written down
anywhere.

These are the three stations exported through export_dictionary_review: 1,452
approvals carrying the catalogue crosswalk, the data type, the unit and its
status, and the note recording each decision. They resolve identity by
source_entity_uuid, source_key and part IPN rather than by primary key, so they
apply to a database that already holds its own assets without touching them,
which a dump of the tables could not do.

Each station also gets a withheld pack, which is not a duplicate. The exporter
writes unapproved points under "pending" and the applier reads only "approve"
and "withhold", so replaying an export as it comes would land 743 points with
no reason against them - reading as a review nobody had begun, when every one
of them has a finding behind it. The Maple Grove dead-channel investigation is
63 of those.

All six were dry-run against the local database first and reported exactly the
counts they claim: 802/103, 452/467, 198/173.
The review packs were committed but unreachable where they are needed. The
production stage copies only src/backend, so contrib/ does not exist in a
deployed container and `apply_dictionary_review --review contrib/...` would
have failed on a missing file - the packs would have had to be copied in by
hand before every bootstrap.

They ship now, 1.5 MB, so giving a deployment its dictionary is one exec call
against a path that is already there.

The manifest is new, and it is not contrib/pump-cassandra/estate.json. That
file documents the estate - source names, coordinates, the reasoning behind
the display names - and carries commentary keys that onboard_pumphouse_estate
rejects outright, which I found by running it: "Manifest requires version 1
and stations only". This one is generated from the registered stations
themselves and pins their public UUIDs, so a station keeps one identity across
deployments; register_station is idempotent and returns an existing
registration rather than duplicating it. Dry-run against the local database it
resolves all three stations and their thirty bays.
… stops

Sections 12 and 13 deploy an application that can read the plant's telemetry
and draws nothing with it: what turns a reading into a tile is data, and it
lives in a database until someone exports it. Production has users, parts and
stock and none of this.

Section 14 is the sequence, verified end to end in a clean-room test database
rather than reasoned about - which is how the awkward details surfaced. A
Client is already there from migration 0009. Nothing in the codebase creates a
HealthSource, so it is the admin or a shell, and a source created through the
admin silently takes a fifteen-minute freshness window against a five-minute
source. All four of onboard_estate's refusal conditions print the same
sentence, so it never tells you which one you got wrong. Activation computes
its own hash and is idempotent.

Three things do not work as shipped, and the section says so rather than
reading as a runbook that would fail halfway:

The review packs update dictionary points; nothing in the image creates them.
The approvals packs pin a hash taken after review, covering each point's
status, note and mapping, so a freshly imported dictionary can never match it
and the apply is refused - guaranteed, not a risk. And activation opens each
checkpoint five minutes before now, which for a recorded window is 442 days
past the read ceiling, so the poller reads nothing for ever without reporting
an error, and the tiles stay blank while the charts work.

Each has its remedy recorded. Two are repackaging; the third is a decision
about putting plant snapshots under version control, which is not mine.
Section 14 listed three blockers. Two of them are closed here, and closing
them turned the procedure into a single command: onboard_pumphouse_estate
registers the stations, imports each dictionary, applies each review, binds
and opens a checkpoint.

The dictionary had no creator in the image. The manifest already supported a
`snapshot` key and I had not used it - and it turns out the snapshot only has
to convey which tags a station reports, because the dictionary is built from
the shape of a payload and the review sets every data type and unit
afterwards. So each station now names a tag file with placeholder values: no
plant telemetry under version control, and the tag names were already in the
packs. Coverage is exact - 905, 919 and 371 paths, none missing, none
spurious.

The packs would have been refused outright. Each pinned a dictionary_hash
taken after review, covering every point's status, note, unit and mapping, so
a freshly imported dictionary could never match it. They carry none now, and a
test fails if a re-export puts one back.

Two things I got wrong on the way, both now recorded rather than smoothed
over. The manifest may hold `version` and `stations` and nothing else, and I
broke that by adding a comment key to it - the note lives in the README. And
`source_context` cannot be carried at all: read_manifest decodes numbers as
Decimal to keep precision, JSONField.full_clean rejects a Decimal, so any
station with a coordinate fails to onboard. That is a latent bug in the
shipped code; the manifest omits the field and section 14 says why.

The remaining blocker is the tiles: activation opens each checkpoint five
minutes before now, which for a recorded window is 442 days past the read
ceiling, so the poller reads nothing for ever without reporting an error.

test_estate_bootstrap runs the whole thing against an empty database and
asserts the counts, that a dry run writes nothing, and that a second run
changes nothing. 813 backend tests green.
Activation opened every ingestion cursor five minutes before now. For a
station whose history is a recorded window that is about 442 days past
everything the connector will ever return - read_ceiling clamps reads to the
recorded end - and a cursor only moves forward, so it could never come back.

The failure was silent, which is what made it worth chasing. The poller went
on succeeding every minute: last_poll_at advancing, last_error_code empty,
last_success_at set, zero documents read, because finding no documents is not
an error. Health blades and Mimic tiles would have stayed blank beside charts
that worked perfectly, since charts read the source per request and tiles read
the cache the poller never filled.

A recorded window is now entered five minutes before its own end: the same
five minutes of validity the rule always meant, measured against the clock the
data actually has. The condition mirrors read_ceiling exactly and compares in
milliseconds as it does, so the cursor and the horizon cannot disagree about
which windows are recorded, and a genuinely live source is unaffected.

This gives the runbook an order it did not have before: discover_data_range
must run before --activate, because activation reads the window to place the
cursor and nothing can move it afterwards. Section 14 says so and the tests
assert it - test_activation_cursor that the cursor lands below the ceiling,
test_estate_bootstrap that it does for the real estate.

818 backend tests green.
@aniketdev2018
aniketdev2018 merged commit b8c3119 into IOT Sep 27, 2026
34 of 58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant