Skip to content

fix(automation): close the cross-review findings on the vocabulary - #79

Merged
AresConnor merged 5 commits into
masterfrom
fix/automation-cross-review
Aug 1, 2026
Merged

AresConnor merged 5 commits into
masterfrom
fix/automation-cross-review

Conversation

@AresConnor

Copy link
Copy Markdown
Contributor

Summary

Closes the 8 actionable findings from the codex (gpt-5.6-sol, xhigh) cross-review of the merged automation vocabulary, each independently adversarially verified before fixing (the 9th, generated union schemas, is pre-existing and tracked as #78). Because MCServerLauncher.Common changes, the internal baseline moves to 2.0.0-preview.7.

Fixes

  • Duplicate wire properties rejected — JsonDocument.ParseValue(ref reader) has no options overload and tolerates duplicates last-wins, so "instance_id":"<guid>","instance_id":null deserialized to the fleet-wide wildcard (runtime-repro'd). The converters' property walk now throws on a repeated name, uniformly across every kind. (The event-rule converters share the door; that is event-rules: union converters silently drop unknown property names #74's widened scope, not this PR.)
  • Non-finite numbers rejected — 1e400 no longer becomes infinity that later explodes in Utf8JsonWriter.WriteNumber at persistence time; refused at the converter and again by the validator.
  • Unresponsive trigger reads strictly the newest sample — it previously searched past a newest gap to an older real sample, firing on evidence the sampler had already disowned; now gap ⇒ quiet, the same discipline as sustained-metric.
  • Suppression holds hold one slot per scope — a one-minute restart hold no longer silently ends an hour-long maintenance hold; the two scopes expire on their own clocks, same-scope writes still replace (same author revising the same decision). mcsl.automation.get lists both slots when both are active. No wire-shape change.
  • The delayed restart start-half rechecks holds — a hold established between the stop-half and the drain tick now refuses the start, audits automation.suppressed, and spends the pending entry rather than re-queueing it.
  • Removed instances take all their facts with them — pruning now also clears crash history, pending restart starts, and per-policy backoff; a wildcard crash-loop policy no longer fires on a ghost instance.
  • Audit records get an explicit Detail field — audit.record's caller-authored text was living in ErrorCode, the one field every other record treats as a closed error vocabulary (and always null on success). AuditRecord/AuditEvent gain an optional, capped, documented Detail; audit.record writes "<Severity>: <Message>" there and ErrorCode returns to its closed-vocabulary/null-on-success discipline. Only audit.record populates it.
  • Dry-run hold parity for null trigger targets — mcsl.automation.test now resolves holds per action via the same predicate execution uses, so a daemon-wide trigger with an explicitly targeted action reports exactly what execution would refuse.

Packaging

2.0.0-preview.6 → 2.0.0-preview.7 per the established pin discipline (Common surface changed: Detail + converter strictness). Fingerprints re-recorded after all source changes, machine-checked by PinnedPayloadHashesMatchTheAcceptanceRecord; spec §12.1 table advanced per its own amendment protocol. No release, no publication.

Verification (independent supervisor battery on the final branch)

ProtocolTests 1402/1402 · ApiTests 116/116 (pin check at preview.7 included) · ProtocolDocs --check green · V1 gate green · WPF build 0 warnings · git diff --check clean. Negative controls: the drain-recheck and per-scope-hold regression tests were proven to fail against the pre-fix behavior.

Pre-merge codex gate: this PR itself goes through the standing gpt-5.6-sol cross-review before merging, per the 2026-08-01 standing instruction.

An audit record's ErrorCode is a short outcome code from the daemon's own
closed vocabulary, and null whenever the record succeeded. The automation
audit.record action had no field for the annotation it exists to leave, so it
borrowed that one — unbounded operator prose in a code-shaped column, on a
succeeded record where every other caller writes null.

Detail is that field: caller-authored, never derived from a request payload,
and populated only by audit.record. Everything else leaves it null, which is
what the regenerated goldens, baseline, and schema record.
Seven defects a cross-review found in the merged automation vocabulary, each
one a place where the code did something other than what its own comment or
sibling already claimed:

- The union converters read through a JsonDocument, which keeps every copy of
  a repeated property and hands back the last. A second instance_id of null
  widened a single-instance policy into a fleet-wide one; the unknown-property
  gate now refuses duplicates on the same walk, nested actions included.
- 1e400 is a JSON number no double can hold. It read back as infinity, seated
  a threshold no reading can reach, and then threw on the way back out because
  infinity has no JSON form. Refused at the converter, and again in the
  validator for policies built in process.
- The unresponsive trigger searched past a gap for the last real sample,
  answering a question about the present with evidence the sampler had already
  disowned. It now reads strictly the newest record and stays quiet on a gap,
  the discipline its sibling sustained-metric evaluation already keeps.
- Suppressions were keyed by instance alone, so a one-minute restart hold
  silently ended an hour-long maintenance hold placed by an unrelated policy.
  The two scopes now hold a slot each and expire on their own clocks; a second
  hold in the same scope still replaces the first.
- The delayed half of a two-phase restart started the instance without asking
  whether a hold had appeared since the stop. It rechecks now, audits the
  refusal, and drops the pending entry rather than re-queueing it.
- The removed-instance sweep cleared statuses and holds but left crash times,
  pending restarts, and backoff behind — and a wildcard crash-loop trigger
  matches on the recorded id alone, so it kept firing actions at a ghost.
- The dry run skipped null targets, so a daemon-wide trigger whose actions
  name their own instance reported a free hand where a tick would be refused.
…t detail

The pre-merge gate found the confirmed-intent restart keeping the gap its
deferred sibling had just closed. That path stops the instance, waits up to
thirty seconds for the stop to land, and then started without asking again — so
a hold placed inside that window was bypassed silently, with no audited refusal.
It now rechecks on the far side of the wait and refuses like every other held
restart. The restart is spent rather than retried, matching the drain.

The drain itself judged holds against the instant the tick started. Its refusal
is permanent, because the pending entry is consumed either way, so a hold that
lapsed while the tick was running could take the restart with it. It reads the
clock at the moment it judges.

AuditRecord.Detail documented a 1024-character bound that nothing enforced: the
validator bounds the authored message, and the severity prefix rides on top, so
a message at the limit composed past it. The writer now truncates the composed
string, and the contract says who bounds it.

Adds direct coverage for the two removed-instance prunes that had none — the
pending restart and the per-policy backoff — both written the way the crash-time
prune already was, around an id a later instance takes over.
The cross-review fixes added a public contract member — `AuditRecord.Detail`,
the annotation an automation audit.record action leaves — so the `preview.6`
fingerprint for `MCServerLauncher.Common` stopped describing the tree. The
baseline moves rather than being re-cut in place, which the NU1403 rule forbids.

Exactly one of the eight packed entries differs from `.6`: `Common`, because its
source changed. The other seven are byte-identical, `Daemon.API` included, which
shows again that the version bump alone touches no payload.

The SDK facade is the entry worth a note. Mid-branch an intermediate state of
`Common` moved its hash with no SDK source edit, and the final state moved it
back — the caveat `.6` left behind, behaving exactly as it said it would. Both
documents now record that the hash is stable across versions but not across every
intermediate state within one, so a reader packing some middle commit of this
branch is not looking at a broken build. Every fingerprint was reproduced by
packing into two different `MCSLPinBuildRoot` values.

The spec version table retires `.6` and records `.7` with the same reasoning.
No scope row moves: preview.7 carries correctness on already-delivered surface.
@AresConnor
AresConnor force-pushed the fix/automation-cross-review branch from 9e571dc to aef1057 Compare August 1, 2026 10:40
@AresConnor
AresConnor merged commit a70ef28 into master Aug 1, 2026
4 of 5 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