feat(wake): #940 snapshot-datable digests — adapter fd-3 snapshot-metadata channel
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
A digest locator carried observed_hash + emit_ts but nothing DATING the
snapshot, so a consumer could not tell a fresh snapshot from one already
superseded at delivery without a tool call (wake-pilot finding
fw-wake-digest-snapshot-lag: seq 56 rendered "(none)" from a board revision
superseded ~5s before delivery by one adding a FLEET STOP block).
Additive + backward-compatible:
- detector.sh: invoke the W4 source adapter with fd 3 -> temp file; the
adapter MAY write {"snapshot_sha": "<git commit sha>", "snapshot_ts":
<epoch>}. Out-of-band is load-bearing: stdout is hashed by the delta
gate, so an in-band tip-commit sha would advance observed_hash on every
unrelated push. Metadata is ADVISORY and validated (sha ^[0-9a-f]{7,64}$,
ts number); malformed metadata drops LOUDLY but never fails the poll or
suppresses the wake. Valid fields join the enqueue locators. An adapter
that never writes fd 3 is byte-identical legacy behavior.
- digest.sh: _locator_line renders snapshot_sha=/snapshot_ts= (scrubbed)
beside observed_hash=; snapshot_sha+path upgrades the actionable-tier
re-verify hint to one-call `git show <snapshot_sha>:<path>`. With
emit_ts already in the header, snapshot age is local arithmetic.
- tests: detector D10 (fields land in locators; metadata-only change is
NOT a delta) + D11 (malformed metadata: loud drop, wake still fires, no
fields); digest Q10 (orientation dating render, no-vestige sibling,
actionable re-verify upgrade). manifest 0.6.12; watch-list schema
untouched ([1,1]); store/reconcile/beacon unchanged.
Closes #940
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NsKce8iZuSuRnu3gVMCBKB
This commit is contained in:
co-authored by
Claude Fable 5
parent
b981b4ec10
commit
bb54e09aec
@@ -235,7 +235,7 @@ _has_hard_locator() {
|
||||
# ACTIONABLE-tier hard-locator FAIL-LOUD gate is untouched.
|
||||
_locator_line() {
|
||||
local loc="$1" repo issue sha file anchor head parts='' reverify=''
|
||||
local remote path kind id ohash branches
|
||||
local remote path kind id ohash branches snap_sha snap_ts
|
||||
repo="$(jq -r '.repo // ""' <<<"$loc")"
|
||||
issue="$(jq -r '(.issue // "") | tostring' <<<"$loc")"
|
||||
sha="$(jq -r '.sha // ""' <<<"$loc")"
|
||||
@@ -247,6 +247,8 @@ _locator_line() {
|
||||
kind="$(jq -r '.kind // ""' <<<"$loc")"
|
||||
id="$(jq -r '(.id // "") | tostring' <<<"$loc")"
|
||||
ohash="$(jq -r '.observed_hash // ""' <<<"$loc")"
|
||||
snap_sha="$(jq -r '.snapshot_sha // ""' <<<"$loc")"
|
||||
snap_ts="$(jq -r '(.snapshot_ts // "") | tostring' <<<"$loc")"
|
||||
branches="$(jq -r '(.branches // []) | if length > 0 then join(",") else "" end' <<<"$loc" 2>/dev/null || true)"
|
||||
[ -n "$kind" ] && parts="$parts kind=$(_scrub_inline "$kind")"
|
||||
[ "$id" != "" ] && parts="$parts id=$(_scrub_inline "$id")"
|
||||
@@ -273,9 +275,18 @@ _locator_line() {
|
||||
# git commit SHA — kept distinct from `sha` so it never impersonates one or
|
||||
# feeds the `git show <sha>` re-verify hint below.
|
||||
[ -n "$ohash" ] && parts="$parts observed_hash=$(_scrub_inline "$ohash")"
|
||||
# snapshot_sha/snapshot_ts (#940): the SNAPSHOT'S git commit sha + commit
|
||||
# epoch, attested by the source adapter at OBSERVE time (out-of-band fd 3,
|
||||
# detector-validated). Unlike observed_hash this IS a commit sha, so it may
|
||||
# feed the `git show` re-verify hint; with emit_ts already in the header,
|
||||
# snapshot age becomes local arithmetic for the consumer.
|
||||
[ -n "$snap_sha" ] && parts="$parts snapshot_sha=$(_scrub_inline "$snap_sha")"
|
||||
[ "$snap_ts" != "" ] && parts="$parts snapshot_ts=$(_scrub_inline "$snap_ts")"
|
||||
# One-targeted-call re-verify hint (best available, most-specific first).
|
||||
if [ -n "$sha" ] && [ -n "$file" ]; then
|
||||
reverify="git show $(_scrub_inline "$sha"):$(_scrub_inline "$file")"
|
||||
elif [ -n "$snap_sha" ] && [ -n "$path" ]; then
|
||||
reverify="git show $(_scrub_inline "$snap_sha"):$(_scrub_inline "$path")"
|
||||
elif [ -n "$repo" ] && [ "$issue" != "" ]; then
|
||||
reverify="issue $(_scrub_inline "$repo")#$(_scrub_inline "$issue")"
|
||||
elif [ -n "$sha" ]; then
|
||||
|
||||
Reference in New Issue
Block a user