Skip to content

fix(showcase): preserve and atomically persist selected probe results - #7256

Merged
jpr5 merged 2 commits into
mainfrom
fix/showcase-selected-observation-persistence
Sep 17, 2026
Merged

jpr5 merged 2 commits into
mainfrom
fix/showcase-selected-observation-persistence

Conversation

@jpr5

@jpr5 jpr5 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR

Keep filtered probe runs from changing excluded dashboard cells, and persist selected D5 results with durable, atomic retry receipts. This PR combines the reviewed reporting foundations from #7222 with the dependent D5 persistence repair. It supersedes #7222; that parent is deliberately not merged separately.

PocketBase prerequisite #7255 is already merged and verified on staging: normal :latest, sole successful deployment, exact hook/migration bytes, live 2 MiB receipt field and authenticated endpoint. This PR contains only 13 harness files in two concern commits.

Actual local RED → GREEN on the final composition

The fresh official main-baseline image and the final candidate both execute the actual native browser probes successfully for Microsoft .NET, .NET Harness, and Mastra. On main, each selected run incorrectly also changes the excluded full-framework aggregate (unchangedControls:false, two reds cleared). The candidate preserves excluded records and clears only the selected row.

The reviewed #7222 intermediate image exposes an additional D5 namespace regression: the same successful native observations leave the selected row red and summary total zero. The combined candidate turns the SAME three row IDs green, records total one, preserves excluded records, and replays without changing status/history. Thus main's selected row was already green; this PR does not mislabel it as an application failure or claim three new application fixes.

Private PocketBase rows are explicitly labeled test sentinels for detecting persistence loss and out-of-scope writes; they are not invented application failures. The real native verdicts pass in every phase.

All RED phases were run locally before restoring the respective reviewed source files. Candidate source 4b1c76bdfb9f9d9d6bf06e381ad7615ba57217b2 exactly matches the independently reviewed bytes; the official local image is sha256:e97ece5636d37de7743ae95d19d66ec8e2ae21b7e27f7cb2fd21fb510b8c8615. Native browser/worker/real PocketBase runs used isolated local services and AIMock, not CI or fabricated unit results.

S05 raw final observer output

red-main — observer exit 2:

{"actualWorkerPassed":true,"persistedState":"green","rollup":{"total":1,"passed":1,"failed":0},"agg":{"runRowId":"8hhqhmmfztnabna","statusOutcomes":[{"previousState":"red","newState":"green","transition":"red_to_green","firstFailureAt":null,"failCount":0,"persisted":true},{"previousState":"red","newState":"green","transition":"red_to_green","firstFailureAt":null,"failCount":0,"persisted":true}],"overlayOutcomes":[],"skipped":false,"outageSkippedKeys":[],"droppedCommError":false,"corruptStateSkippedKeys":[]}}

red-parent — observer exit 1:

{"actualWorkerPassed":true,"persistedState":"red","rollup":{"total":1,"passed":1,"failed":0},"agg":{"runRowId":"gftdymmzxgvq2qm","statusOutcomes":[],"overlayOutcomes":[],"skipped":false,"outageSkippedKeys":[],"droppedCommError":false,"corruptStateSkippedKeys":[]}}

green-candidate — observer exit 0:

{"actualWorkerPassed":true,"persistedState":"green","rollup":{"total":1,"passed":1,"failed":0},"agg":{"runRowId":"8ck5a5rs8floyzb","statusOutcomes":[{"previousState":"red","newState":"green","transition":"red_to_green","firstFailureAt":null,"failCount":0,"persisted":true}],"overlayOutcomes":[],"skipped":false,"outageSkippedKeys":[],"droppedCommError":false,"corruptStateSkippedKeys":[]}}

S06 raw final observer output

red-main — observer exit 2:

{"actualWorkerPassed":true,"persistedState":"green","rollup":{"total":1,"passed":1,"failed":0},"agg":{"runRowId":"wyftkyd5fy9344w","statusOutcomes":[{"previousState":"red","newState":"green","transition":"red_to_green","firstFailureAt":null,"failCount":0,"persisted":true},{"previousState":"red","newState":"green","transition":"red_to_green","firstFailureAt":null,"failCount":0,"persisted":true}],"overlayOutcomes":[],"skipped":false,"outageSkippedKeys":[],"droppedCommError":false,"corruptStateSkippedKeys":[]}}

red-parent — observer exit 1:

{"actualWorkerPassed":true,"persistedState":"red","rollup":{"total":1,"passed":1,"failed":0},"agg":{"runRowId":"bjgumkld7fcs91z","statusOutcomes":[],"overlayOutcomes":[],"skipped":false,"outageSkippedKeys":[],"droppedCommError":false,"corruptStateSkippedKeys":[]}}

green-candidate — observer exit 0:

{"actualWorkerPassed":true,"persistedState":"green","rollup":{"total":1,"passed":1,"failed":0},"agg":{"runRowId":"3vc19es94r8e3ph","statusOutcomes":[{"previousState":"red","newState":"green","transition":"red_to_green","firstFailureAt":null,"failCount":0,"persisted":true}],"overlayOutcomes":[],"skipped":false,"outageSkippedKeys":[],"droppedCommError":false,"corruptStateSkippedKeys":[]}}

S07 raw final observer output

red-main — observer exit 2:

{"actualWorkerPassed":true,"persistedState":"green","rollup":{"total":1,"passed":1,"failed":0},"agg":{"runRowId":"30wkjgnotspcl1e","statusOutcomes":[{"previousState":"red","newState":"green","transition":"red_to_green","firstFailureAt":null,"failCount":0,"persisted":true},{"previousState":"red","newState":"green","transition":"red_to_green","firstFailureAt":null,"failCount":0,"persisted":true}],"overlayOutcomes":[],"skipped":false,"outageSkippedKeys":[],"droppedCommError":false,"corruptStateSkippedKeys":[]}}

red-parent — observer exit 1:

{"actualWorkerPassed":true,"persistedState":"red","rollup":{"total":1,"passed":1,"failed":0},"agg":{"runRowId":"j74kmxgcwz1qyuv","statusOutcomes":[],"overlayOutcomes":[],"skipped":false,"outageSkippedKeys":[],"droppedCommError":false,"corruptStateSkippedKeys":[]}}

green-candidate — observer exit 0:

{"actualWorkerPassed":true,"persistedState":"green","rollup":{"total":1,"passed":1,"failed":0},"agg":{"runRowId":"xdrsr5ctvrgdybd","statusOutcomes":[{"previousState":"red","newState":"green","transition":"red_to_green","firstFailureAt":null,"failCount":0,"persisted":true}],"overlayOutcomes":[],"skipped":false,"outageSkippedKeys":[],"droppedCommError":false,"corruptStateSkippedKeys":[]}}

Review and validation

Independent composition review confirms all 13 file hashes, the six parent-only files' 26-report review coverage, and the D5 changes' 12-report final review. Both reviews have zero remaining mandatory findings. Current official local Docker build and three native paired checks pass. Host formatter, lint (102 reviewed warnings, zero errors), explicit typecheck, full suite (3,841 passed; 18 existing skips), and full production build all pass. CI must pass before merge.

The prior real PocketBase/consumer failure proofs remain bound to identical reviewed behavior, with all 88 frozen artifact hashes reverified. These cover partial writes, lost responses, prefix retries, process restart/stale sweep, observation identity, missing selected observations, structural driver errors, summary accounting, malformed timestamps, and concurrent row creation.

Preserved actual local A1 failure-surface proof

A1 raw local red-green proof for PR body

Selected status writes previously resolved after a PocketBase write failure, so the result consumer latched the job and the run became terminal without the required observation. Atomic per-job receipts now preserve retryability and suppress replayed writes, including after stale-run sweep and process restart.

TS commit 4994eb27f033eab4b24b960298e2fa271b405e0d; PB component 7e6b695cd67fe1f0939612337bd8eb2caff70367. Private PocketBase on 42910, real result consumer and real status writer. Native S06 capture replayed; additional selected prefix, negative state, and communication-error inputs are explicitly synthetic accepted protocol cases. They are not native-producer bug claims.

Single required status write failure

Red (red.log), then green (atomic-single-green.log):

{"first":{"processed":1,"failures":0},"retry":{"processed":0,"failures":0},"replay":{"processed":0,"failures":0},"checks":{"failureNotAcknowledged":false,"noFalseTerminal":false,"retrySucceeded":false,"sameRun":true,"noReplayWrites":true,"oneHistoryAdded":false}}
{"first":{"processed":0,"failures":1},"retry":{"processed":1,"failures":0},"replay":{"processed":0,"failures":0},"checks":{"failureNotAcknowledged":true,"noFalseTerminal":true,"retrySucceeded":true,"sameRun":true,"noReplayWrites":true,"oneHistoryAdded":true}}

Multiple selected cells: successful prefix then later failure

Red (multi-candidate.log), then green (atomic-multi-final.log):

{"first":{"processed":0,"failures":1},"retry":{"processed":1,"failures":0},"replay":{"processed":0,"failures":0},"checks":{"failureNotAcknowledged":true,"noFalseTerminal":true,"retrySucceeded":true,"sameRun":true,"prefixHistoryDuplicated":true,"noReplayWrites":true,"oneHistoryAdded":false}}
{"first":{"processed":0,"failures":1},"retry":{"processed":1,"failures":0},"replay":{"processed":0,"failures":0},"checks":{"failureNotAcknowledged":true,"noFalseTerminal":true,"retrySucceeded":true,"sameRun":true,"prefixHistoryPreserved":true,"noReplayWrites":true,"oneHistoryAdded":true}}

Real stale sweep and child-process restart

Red (restart-red.log), then green (restart-final.log):

{"first":{"processed":0,"failures":1},"retry":{"processed":1,"failures":0},"replay":{"processed":0,"failures":0},"checks":{"actualSweep":true,"newProcess":true,"prefixStatePreserved":true,"failureNotAcknowledged":true,"noFalseTerminal":true,"retrySucceeded":false,"sameRun":true,"prefixHistoryPreserved":true,"noReplayWrites":true,"oneHistoryAdded":false}}
{"first":{"processed":0,"failures":1},"retry":{"processed":1,"failures":0},"replay":{"processed":0,"failures":0},"checks":{"actualSweep":true,"newProcess":true,"prefixStatePreserved":true,"failureNotAcknowledged":true,"noFalseTerminal":true,"retrySucceeded":true,"sameRun":true,"prefixHistoryPreserved":true,"noReplayWrites":true,"oneHistoryAdded":true}}

New job identity and overlay fallback route change

Red (identity-route-red.log), then green (identity-route-final.log):

{"distinctJobCounted":true,"distinctJobHistory":true,"oldReplayPreserved":true,"fallbackPersisted":true,"routeRetrySucceeded":true,"fallbackReplayPreserved":false}
{"distinctJobCounted":true,"distinctJobHistory":true,"oldReplayPreserved":true,"fallbackPersisted":true,"routeRetrySucceeded":true,"fallbackReplayPreserved":true}

Selected history failure must roll back status and retry

Red (history-red.log), then green (history-green.log):

{"first":{"processed":1,"failures":0},"retry":{"processed":0,"failures":0},"replay":{"processed":0,"failures":0},"checks":{"statusRolledBack":false,"failureNotAcknowledged":false,"noFalseTerminal":false,"retrySucceeded":false,"sameRun":true,"noReplayWrites":true,"oneHistoryAdded":false}}
{"first":{"processed":0,"failures":1},"retry":{"processed":1,"failures":0},"replay":{"processed":0,"failures":0},"checks":{"statusRolledBack":true,"failureNotAcknowledged":true,"noFalseTerminal":true,"retrySucceeded":true,"sameRun":true,"noReplayWrites":true,"oneHistoryAdded":true}}

Lost response after real transaction commit

The proof consumes and discards one successful HTTP response after PocketBase commits. The client retries and gets the stored receipt; one history row lands. This tests the new atomic boundary, not an invented pre-fix missing-endpoint bug.

{"first":{"processed":1,"failures":0},"retry":{"processed":0,"failures":0},"replay":{"processed":0,"failures":0},"checks":{"committedResponseWasLost":true,"atomicRequestRetried":true,"consumerSucceeded":true,"oneHistoryAdded":true,"noReplayWrites":true,"finalStateGreen":true}}

Validation: full harness 3,832 passed / 18 existing skipped; typecheck/build/format pass; lint 0 errors / 10 pre-existing warnings. Schema/endpoint absence fails loudly; deploy PB migration and hook before the new control-plane writer. Raw complete logs and JSON snapshots are hash-bound in final-receipt.json.

Preserved actual local A2 failure-surface proof

A2 native driver diagnostic preservation

Scoped native D5 jobs exclude their full aggregate from status writes. A genuine driver exception returns empty cells, aggregateState: error, and the diagnostic in aggregateSignal, with no communication error. The selected cells therefore received no error history.

The fix projects the driver error onto each selected key through the existing status-writer error path. It preserves the prior durable observation, advances its observed timestamp, and stores the actual diagnostic in error history. It leaves executed-cell counts at zero and the run failed. It does not modify the full aggregate or excluded cells.

Local red-green proof

The same untouched native createE2eFullDriver runs through real runClaimedJob, real queue report, real createResultConsumer, and a private real PocketBase at port 42920. The accepted malformed features input triggers the actual native TypeError featureSource.filter is not a function. No driver, consumer, queue, or writer stub is used. Baseline runtime is the existing eb3 proof image; green changes only the compiled aggregator module using a read-only mount. This demonstrates persistence of an actual native exception, not a successful test or a product-cell green flip.

All complete outputs are retained next to this document (red.log/json, green.log/json, proof-receipt.json). The selected status row remains red, keeps its ID, and advances observed_at; its error history now contains the exact diagnostic. The run remains failed with zero executed cells. Controls and replay are unchanged.

RED raw output

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
{"level":"warn","msg":"pb-client.legacy-admin-auth-fallback","ts":"2026-09-17T05:33:50.251Z","hint":"/_superusers returned 404 — falling back to /api/admins (PB ≤0.22). Disable this warn after upgrading to PB 0.23+."}
{"level":"error","msg":"fleet.worker.job-driver-error","ts":"2026-09-17T05:33:50.778Z","workerId":"local-d5-worker","jobId":"sxlxy3eoil7cd2l","probeKey":"d5-single-pill-e2e:a2-driver-error","errName":"TypeError","err":"featureSource.filter is not a function"}
{
  "driverFailed": true,
  "diagnosticPreserved": false,
  "consumed": {
    "processed": 1,
    "failures": 0
  },
  "selectedHistory": [],
  "unchangedControls": true,
  "replayPreserved": true,
  "runs": {
    "page": 1,
    "perPage": 100,
    "totalItems": 1,
    "totalPages": 1,
    "items": [
      {
        "collectionId": "mbsz2pvgffrkd7y",
        "collectionName": "probe_runs",
        "created": "2026-09-17 05:33:50.803Z",
        "duration_ms": 4,
        "finished_at": "2026-09-17 05:33:50.804Z",
        "id": "9c6t0kjwihf1643",
        "job_id": "sxlxy3eoil7cd2l",
        "probe_id": "d5-single-pill-e2e:a2-driver-error",
        "started_at": "2026-09-17 05:33:50.800Z",
        "state": "failed",
        "summary": {
          "failed": 0,
          "passed": 0,
          "redsCleared": 0,
          "redsIntroduced": 0,
          "total": 0
        },
        "triggered": false,
        "updated": "2026-09-17 05:33:50.811Z"
      }
    ]
  }
}

GREEN raw output

{"level":"warn","msg":"pb-client.legacy-admin-auth-fallback","ts":"2026-09-17T05:35:29.220Z","hint":"/_superusers returned 404 — falling back to /api/admins (PB ≤0.22). Disable this warn after upgrading to PB 0.23+."}
{"level":"error","msg":"fleet.worker.job-driver-error","ts":"2026-09-17T05:35:29.687Z","workerId":"local-d5-worker","jobId":"ptpk5w3sgljiyjx","probeKey":"d5-single-pill-e2e:a2-driver-error","errName":"TypeError","err":"featureSource.filter is not a function"}
{
  "driverFailed": true,
  "diagnosticPreserved": true,
  "consumed": {
    "processed": 1,
    "failures": 0
  },
  "selectedHistory": [
    {
      "collectionId": "eg1ekz8jfyeploi",
      "collectionName": "status_history",
      "created": "2026-09-17 05:35:29.741Z",
      "dimension": "d5",
      "id": "fjsywn62kx5opk4",
      "key": "d5:a2-driver-error/shared-state",
      "observed_at": "2026-09-17 05:35:29.687Z",
      "signal": {
        "error": "featureSource.filter is not a function"
      },
      "state": "red",
      "transition": "error",
      "updated": "2026-09-17 05:35:29.741Z"
    }
  ],
  "unchangedControls": true,
  "replayPreserved": true,
  "runs": {
    "page": 1,
    "perPage": 100,
    "totalItems": 2,
    "totalPages": 1,
    "items": [
      {
        "collectionId": "mbsz2pvgffrkd7y",
        "collectionName": "probe_runs",
        "created": "2026-09-17 05:33:50.803Z",
        "duration_ms": 4,
        "finished_at": "2026-09-17 05:33:50.804Z",
        "id": "9c6t0kjwihf1643",
        "job_id": "sxlxy3eoil7cd2l",
        "probe_id": "d5-single-pill-e2e:a2-driver-error",
        "started_at": "2026-09-17 05:33:50.800Z",
        "state": "failed",
        "summary": {
          "failed": 0,
          "passed": 0,
          "redsCleared": 0,
          "redsIntroduced": 0,
          "total": 0
        },
        "triggered": false,
        "updated": "2026-09-17 05:33:50.811Z"
      },
      {
        "collectionId": "mbsz2pvgffrkd7y",
        "collectionName": "probe_runs",
        "created": "2026-09-17 05:35:29.728Z",
        "duration_ms": 24,
        "finished_at": "2026-09-17 05:35:29.747Z",
        "id": "7c7otr4omcoknz5",
        "job_id": "ptpk5w3sgljiyjx",
        "probe_id": "d5-single-pill-e2e:a2-driver-error",
        "started_at": "2026-09-17 05:35:29.723Z",
        "state": "failed",
        "summary": {
          "failed": 0,
          "passed": 0,
          "redsCleared": 0,
          "redsIntroduced": 0,
          "total": 0
        },
        "triggered": false,
        "updated": "2026-09-17 05:35:29.752Z"
      }
    ]
  }
}

The final PR body must include these raw outputs; this worker does not create or push a PR.

Preserved actual local A4 failure-surface proof

A4 proof and handoff

Commit 6f4f00a68859b528661962be70b75bbb358ef777, base eb3d9466e4648cea9ed509b0fa662ef9e9deb0ed. Clean isolated concern branch. Only aggregator source and regression tests changed. No PR/push/deployment.

Scoped totals now use valid original observations retained by the existing canonical-key write plan. First occurrence remains authoritative without commError; trusted-negative replacement remains authoritative with commError. Synthetic fallback rows do not count. Explicit driver/communication errors remain failed, and rejecting all original selected observations cannot manufacture a successful run.

Integration

observationProjectionCount is recorded before fallback insertion. Preserve that boundary when applying A2/A3 so synthetic diagnostics remain excluded from totals. A1 changes only the subsequent writer failure catch and does not conflict semantically. No new public helper or signature.

Reproduction

These are adversarial mutations of the real captured native S05 D5 result at ../../green-value-s05.json, NOT claims that the producer normally emits duplicate/corrupt states. The production queue enqueue/claim/report and real consumer decode path accept them; production writers persist to an isolated real PocketBase. No fake writers or LLM calls. Original RED captured before source edits in red.json/red.log. Final paired replay adds selected-state and replay checks.

Local PB d5-a4-pb remains available on port 42940 for integration, with owned pb-data here. Port 42941 unused. Observer command, from the artifact directory:

docker --context desktop-linux run --rm --platform linux/amd64 --user 0 -v "$PWD:/proof" -v "$PWD/../..:/capture:ro" --entrypoint node showcase-d5-a4:local /proof/proof.mjs green-integration

For the baseline use image sha256:a7030a6f2e570e72dd01ff78dabc33882b0c2cee8f38c843b07aeb0d34f4f598, label red-integration. Expected exit 1 baseline, 0 candidate. Run sequentially on this PB. The Dockerfile's parent resolves to the baseline; replace result-aggregator.js with final integrated harness build output, then use docker --context desktop-linux buildx build --builder desktop-linux --load --platform linux/amd64 -t showcase-d5-a4:integration . and use that image in the observer. Do not run plain docker build (host default redirects to Depot).

Validation

113 focused tests pass (four new tests observed failing first). Full harness: 180 files passed, 2 existing skipped; 3832 tests passed, 18 existing skipped. Typecheck, full TypeScript build, format and lint pass (eight pre-existing warnings). Language-service diagnostics empty. Local Docker build succeeded with final emitted module. Receipt hashes bind source and raw outputs. Manual checks ran before commit; hooks disabled for commit. Independent CR remains the integration owner's next gate.

Raw final RED

{"scenario":"duplicate-green-red","consumed":{"processed":1,"failures":0},"summary":{"failed":1,"passed":1,"redsCleared":1,"redsIntroduced":0,"total":2},"state":"failed","history":[{"key":"d5:ms-agent-dotnet/shared-state-write","state":"green"}],"controlsUnchanged":true,"selectedState":"green","replayPreserved":true,"passed":false}
{"scenario":"valid-and-corrupt","consumed":{"processed":1,"failures":0},"summary":{"failed":1,"passed":1,"redsCleared":1,"redsIntroduced":0,"total":2},"state":"failed","history":[{"key":"d5:ms-agent-dotnet/shared-state-write","state":"green"}],"controlsUnchanged":true,"selectedState":"green","replayPreserved":true,"passed":false}
{"scenario":"all-corrupt","consumed":{"processed":1,"failures":0},"summary":{"failed":1,"passed":0,"redsCleared":0,"redsIntroduced":0,"total":1},"state":"failed","history":[],"controlsUnchanged":true,"selectedState":"red","replayPreserved":true,"passed":false}
{"scenario":"explicit-error-with-duplicate","consumed":{"processed":1,"failures":0},"summary":{"failed":1,"passed":1,"redsCleared":1,"redsIntroduced":0,"total":2},"state":"failed","history":[{"key":"d5:ms-agent-dotnet/shared-state-write","state":"green"}],"controlsUnchanged":true,"selectedState":"green","replayPreserved":true,"passed":false}
{"scenario":"comm-duplicate","consumed":{"processed":1,"failures":0},"summary":{"failed":1,"passed":1,"redsCleared":0,"redsIntroduced":0,"total":2},"state":"failed","history":[{"key":"d5:ms-agent-dotnet/shared-state-write","state":"red"}],"controlsUnchanged":true,"selectedState":"red","replayPreserved":true,"passed":false}

Raw final GREEN

{"scenario":"duplicate-green-red","consumed":{"processed":1,"failures":0},"summary":{"failed":0,"passed":1,"redsCleared":1,"redsIntroduced":0,"total":1},"state":"completed","history":[{"key":"d5:ms-agent-dotnet/shared-state-write","state":"green"}],"controlsUnchanged":true,"selectedState":"green","replayPreserved":true,"passed":true}
{"scenario":"valid-and-corrupt","consumed":{"processed":1,"failures":0},"summary":{"failed":0,"passed":1,"redsCleared":1,"redsIntroduced":0,"total":1},"state":"completed","history":[{"key":"d5:ms-agent-dotnet/shared-state-write","state":"green"}],"controlsUnchanged":true,"selectedState":"green","replayPreserved":true,"passed":true}
{"scenario":"all-corrupt","consumed":{"processed":1,"failures":0},"summary":{"failed":0,"passed":0,"redsCleared":0,"redsIntroduced":0,"total":0},"state":"failed","history":[],"controlsUnchanged":true,"selectedState":"red","replayPreserved":true,"passed":true}
{"scenario":"explicit-error-with-duplicate","consumed":{"processed":1,"failures":0},"summary":{"failed":0,"passed":1,"redsCleared":1,"redsIntroduced":0,"total":1},"state":"failed","history":[{"key":"d5:ms-agent-dotnet/shared-state-write","state":"green"}],"controlsUnchanged":true,"selectedState":"green","replayPreserved":true,"passed":true}
{"scenario":"comm-duplicate","consumed":{"processed":1,"failures":0},"summary":{"failed":1,"passed":0,"redsCleared":0,"redsIntroduced":0,"total":1},"state":"failed","history":[{"key":"d5:ms-agent-dotnet/shared-state-write","state":"red"}],"controlsUnchanged":true,"selectedState":"red","replayPreserved":true,"passed":true}
Preserved actual timestamp and creation-race failure-surface proof

Invalid-timestamp counters

Invalid-timestamp transition counter repair

An accepted green observation with an invalid timestamp leaves the durable status row red. The aggregator previously counted that history-only observation as a cleared red. Exclude error transitions and explicitly non-persisted outcomes from red transition counters.

Actual local RED → GREEN

Same round2-invalid-date.mjs through the official AMD64 harness image, real queue, real status writer, and local PocketBase atomic endpoint; no cloud or CI proof. Baseline exit 1; candidate exit 0. The durable status row stays red in both. This fixes the counter only, not the intentionally retained durable colour or the separate observation rollup.

RED raw output:

{"level":"warn","msg":"pb-client.legacy-admin-auth-fallback","ts":"2026-09-17T15:59:54.867Z","hint":"/_superusers returned 404 — falling back to /api/admins (PB ≤0.22). Disable this warn after upgrading to PB 0.23+."}
{"level":"warn","msg":"status-writer.durable-unparseable-observed-at","ts":"2026-09-17T15:59:55.539Z","key":"d5:round2-invalid-date-1789660794730/selected","observedAt":"invalid-timestamp","currentObservedAt":"2026-09-17 15:59:54.730Z","hint":"incoming durable-write observedAt is unparseable — landing the history row with a substituted timestamp and skipping the durable upsert (PB would 400 on a non-date value)"}
{"bugReproduced":true,"state":"red","summary":{"failed":0,"passed":1,"redsCleared":1,"redsIntroduced":0,"selectedObservationFingerprint":"9382bff8aa3105e878dc9886a37996c6a337eea0f9a8f32e6e9403ad27ddc9a2","total":1}}

GREEN raw output:

{"level":"warn","msg":"pb-client.legacy-admin-auth-fallback","ts":"2026-09-17T16:07:46.700Z","hint":"/_superusers returned 404 — falling back to /api/admins (PB ≤0.22). Disable this warn after upgrading to PB 0.23+."}
{"level":"warn","msg":"status-writer.durable-unparseable-observed-at","ts":"2026-09-17T16:07:47.688Z","key":"d5:round2-invalid-date-1789661266436/selected","observedAt":"invalid-timestamp","currentObservedAt":"2026-09-17 16:07:46.437Z","hint":"incoming durable-write observedAt is unparseable — landing the history row with a substituted timestamp and skipping the durable upsert (PB would 400 on a non-date value)"}
{"bugReproduced":false,"state":"red","summary":{"failed":0,"passed":1,"redsCleared":0,"redsIntroduced":0,"selectedObservationFingerprint":"714c566c75bc85f99ccdea8b44da79b02366a94a6ab50c75e9d2ac4f59d27a86","total":1}}

Candidate local image: sha256:09086b2550217c279691c4a4aa9d5a6e8d3c098f5298b386fbeabf6442faae1f (linux/amd64), built with the repository's unchanged harness Dockerfile and the isolated candidate source. Focused regression tests: RED 3 failed /116 passed; GREEN119 passed. Additional complete checks recorded separately in the final receipt.

Final validation: complete harness suite3841 passed/18 existing skipped; typecheck and format passed; lint0 errors/8 unchanged baseline warnings. Clean commit 9ba5f5ff5739d36bf3f02bfb38d7c329e5b4c3b4; hooks passed without bypass.

Selected creation race

Selected communication-error creation race

A selected observation could miss its live communication-error overlay when another writer created the status row between the overlay read and its history fallback. Keep the fallback bound to the absent-row basis. A concurrent insertion now produces a transaction conflict and repeats route selection, attaching the diagnostic to the newly created row.

Actual local red/green proof

Uses the official harness Dockerfile and actual local PocketBase at port 43590. The probe schedules a real foreign status insert after the actual empty status GET; there are no fake database responses.

  • BEFORE edit, official baseline showcase-harness:d5-source-5becd15a53: round2-creation-race.mjs exits 1. insertions:1, returned route write, live signal {foreign:true}, replay retains the missing diagnostic (red.log and red/round2-creation-race-red.json).
  • The stricter assertion version against the same baseline also exits 1, acceptance:false (red-strict.log).
  • AFTER, official candidate image sha256:4f62614c4c5326332543db86f6bbfe8130b2b8065363e1945d77e0c92267f0e5: same foreign-insert scenario exits 0, acceptance:true; returned route overlay, applied:true, historyPersisted:true. Live signal includes both the foreign value and communication error; green state, attribution and failure counter are unchanged. Replay does not alter the row (green.log).
  • Independent persisted readback: PASS — exactly one foreign observation history and one selected overlay history; receipt route overlay; replay creates no extra history (persisted.log).
  • Official Docker build and explicit full tsc --noEmit: PASS. Full suite plus source-context reruns covers 3838 passed, 18 existing skips, no remaining failures. The initial official build-stage run lacked fixture sources; those failures and subsequent read-only source-binding reruns are retained. Normal commit hooks and Prettier check also pass.

This proves one persistence race; it does not claim any original staging cell is resolved.

Rollback test target

Local red-green proof: rollback test targets the affected job

The old rollback check read the original job instead of the third job whose transaction failed. Both negative controls PATCH the real private PocketBase thirdJob receipt and verify that persisted mutation before the assertion.

RED stale receipt corruption: exit 0 — ALL REAL POCKETBASE TRANSACTION CHECKS PASSED
RED capacity receipt corruption: exit 0 — ALL REAL POCKETBASE TRANSACTION CHECKS PASSED
GREEN same stale corruption: exit 1 — AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal
GREEN same capacity corruption: exit 1 — AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal
GREEN intact real transaction suite: exit 0 — ALL REAL POCKETBASE TRANSACTION CHECKS PASSED

Both fixed failures identify the actual persisted wrongJobControl receipt mismatch. Existing real transaction checks stay intact. Syntax, format, applicable precommit hooks, and commitlint pass.

Retained follow-ups

Retained follow-ups for combined harness shipment

These preserve the two independent review inventories. Selected observation transactions address the current selected-job write/retry subject; they do not claim to resolve ordinary unfiltered write/ack durability or the broader lifecycle subjects. Overlapping descriptions remain traceable to their original inventories.

Parent reporting-integrity inventory

Consolidated follow-ups after round 3

All eighteen remain real, separately scoped follow-up obligations. No item is erased or declared fixed by this status shipment. D1–D17 retain their prior independent classifications; D18 is newly confirmed under the distinct fleet-boot-stop-signal-ownership subject.

Deferred — Out of Scope for this PR

Bucket (c) — subject-neutral pre-existing (deferred backlog)

(none)

Bucket (d) — out-of-this-PR subject (follow-up PR)

  • showcase/harness/src/orchestrator.ts:3256 — follow-up: D1 — Cross-environment pin-drift discovery activation.

  • showcase/harness/src/orchestrator.ts:4280/4372 — follow-up: D2 — Worker registration health recovery.

  • showcase/harness/src/orchestrator.ts:2836 — follow-up: D3 — PID saturation durable recovery.

  • showcase/harness/src/fleet/control-plane/result-aggregator.ts:1061 — follow-up: D4 — At-least-once aggregator write/ack durability.

  • showcase/harness/src/probes/loader/probe-invoker.ts:731 — follow-up: D5 — Detail-aware durable progress counts.

  • showcase/harness/src/probes/loader/probe-invoker.ts:733 — follow-up: D6 — Monotonic concurrent progress persistence.

  • showcase/harness/src/probes/loader/probe-invoker.ts:771 — follow-up: D7 — Invoker sibling cancellation/drain lifecycle.

  • showcase/harness/src/orchestrator.test.ts:6325 — follow-up: D8 — Control-plane test failure cleanup handle.

  • showcase/harness/src/orchestrator.test.ts:2061 — follow-up: D9 — Unregister regression must observe rejected attempt.

  • showcase/harness/src/orchestrator.test.ts:4700 — follow-up: D10 — HTTP-probe test temporary directory cleanup.

  • showcase/harness/src/orchestrator.test.ts:1397 — follow-up: D11 — S3 test environment restoration.

  • showcase/harness/src/orchestrator.test.ts:1395 — follow-up: D12 — Test module factory isolation.

  • showcase/harness/src/orchestrator.test.ts:235 — follow-up: D13 — Shutdown regression must verify socket closure.

  • showcase/harness/src/orchestrator.ts:1233 — follow-up: D14 — Legacy boot bind failure leaks watchers, engine and subscriptions.

  • showcase/harness/src/orchestrator.ts:3505 — follow-up: D15 — Control-plane HTTP scheduler last-run cache is not hydrated on restart.

  • showcase/harness/src/orchestrator.ts:3387 — follow-up: D16 — Unserialized asynchronous reloads can restore stale schedule configuration.

  • showcase/harness/src/orchestrator.ts:3607 — follow-up: D17 — Port-zero boot handles return requested zero instead of assigned port.

  • showcase/harness/src/orchestrator.ts:4538 (also 4493) — follow-up: D18 — Fleet boot/stop signal-handler ownership; stopped generations retain callbacks and can exit before a replacement drains. Independent classification: round-3-signal-lifecycle-independent-classification.md.

Origin/classification evidence: round-1-complete-inventory.json; independent-test-finding-classification.md; runtime-durability-independent-classification.md; round-2-lifecycle-independent-classification.md; round-3-signal-lifecycle-independent-classification.md. Canonical originating reports and line anchors remain in this directory.

D5 persistence inventory

Consolidated D5 follow-ups — bucket (d)

These are confirmed separate subjects, not waived defects and not current D5 mandatory work. Inherited partition evidence: ../../confirmation/round-2-final-partition.md. Current classification: round-3-final-partition.md. Bucket(c) empty.

  1. Ordinary overlay row-deletion recovery: preserve HTTP404 status from pb-client.update so ordinary overlay fallback classifies a vanished row. Actual read/delete/PATCH repro required before a behavior fix; verify selected atomic409 behavior remains intact.
  2. Complete orphan-run boot cleanup: sweepStaleRuns currently visits only first50. Real51+row proof required; bounded pagination must handle changing rows and failures without infinite retry.
  3. Bounded PocketBase transport operation: auth, fetch and body reads lack one overall deadline. Real stalled auth/headers/body proof required, including no attempt after deadline. Do not conflate retry wait budget with total request deadline.
  4. Docker/Railway health recovery documentation: HEALTHCHECK unhealthy status does not itself restart container. Correct operational comment against actual supervisor behavior; no implicit runtime restart change.
  5. Ordinary probe-run lifecycle documentation: failed also includes reported negative fleet outcomes, not only execution exceptions. Document both callers without changing policy.
  6. PocketBase retry exception documentation: exhausted429/5xx throws typed PbHttpError, not Response. Correct existing comment; distinct from implementing deadline readme #3.

All behavioral follow-up PRs require actual LOCAL RED before fix, SAME actual GREEN after fix, raw output in PR body. Comment-only work requires factual verification and emitted-code equivalence. No follow-up is marked completed here.

Rollout

After green CI, use normal main build and :latest staging deployments for both control plane and worker. Verify both deployed revisions/digests, then enqueue normal selected D5 runs and inspect fresh persistence and dashboard results. No image pins, status overrides, or direct staging database edits. Close superseded #7222 only after this PR merges.

Final staging verification

Merged as b4b7f2657be63d213aef47ca811c5f2deb1de271 after 23 passing and 4 skipped CI checks. PocketBase prerequisite PR #7255 deployed first; its live receipt schema and atomic endpoint were verified. Normal Build & Push run 35264083028 succeeded. Both control-plane and worker roles are sole SUCCESS on normal :latest, digest sha256:b468b4b0dfc104c8b95c2f00cefd67f72759e933a8b87ae50c172291259ffeb6; all eight changed running executable hashes match the locally tested candidate.

Fresh selected D5 run frun_mu5x9bks_k3qv06_1 executed five supported cells of six declared pairs: 5/5 passed. The unsupported Harness streaming pair was excluded. The original .NET, .NET Harness, and Mastra targets passed actual 2/2, 2/2, and 3/3 native turns; each persisted a fresh green row and durable receipt. Saved summaries are 2/2, 2/2, and 1/1, and all excluded rows remained unchanged. Fresh dashboard screenshots were visually inspected and show the three targets green. They were already green before this shared reporting repair; no new original-cell closures or badge transitions are claimed. Parent #7222 was closed only after this superseding PR merged.

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Ignore keyword(s) in the title.

⛔ Ignored keywords (4)
  • fix(showcase)
  • feat(showcase)
  • chore(release)
  • chore: release

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: aef43459-dab6-4f27-852e-db486b0e9d01

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Production Digest-Pinning Audit

All 42 services digest-pinned.

Run 2026-09-17 12:10:08 PDT — 0 finding(s).

@jpr5
jpr5 merged commit b4b7f26 into main Sep 17, 2026
27 checks passed
@jpr5
jpr5 deleted the fix/showcase-selected-observation-persistence branch September 17, 2026 19:18
contextablemark added a commit that referenced this pull request Oct 1, 2026
…nce (#7550)

Selected fleet results still used separate status and history writes, so
a history failure could be acknowledged as processed. This connects
selected observations to the atomic PocketBase endpoint in #7548.
Status, history, and the durable observation receipt commit together;
persistence failures propagate to the existing consumer and leave the
job unprocessed.

Selection comes from the persisted job payload. Selected D5 keys use the
canonical d5 namespace; aggregate and off-scope rows are excluded.
Interrupted results reuse the same run, including after the boot
stale-run sweep, and committed observation receipts replay without
duplicate history, counters, or status events. A completed-run
fingerprint is recorded only after all selected observations and
required run finish succeed. The caller asks the endpoint to validate
durable receipt replay.

The existing writer calculations and ordinary/unfiltered behavior
remain. This change adds no probe execution, retry/skip qualification,
dashboard UI, storage schema, or test framework. It does not establish
honest functional green.

Validation:

- Focused regression cases failed against the prior caller, then passed
with the integration; existing relevant suites and the repaired
orchestrator job-lookup case passed.
- Harness Nx typecheck/build and scoped format passed. Lint has zero
errors and the same 102 warnings as the exact base; the new helper has
no diagnostics.
- A private real PocketBase run reproduced the old false
acknowledgement. With the candidate, a successful prefix committed once,
a later history-validation failure rolled back and left the job
unprocessed, and a new consumer process ran the real stale-run sweep
before recovering the same run. Prefix data/history/receipt, excluded
aggregate/off-scope rows, and the raw worker result stayed unchanged;
the later observation gained exactly one history row and receipt. All
disposable resources were removed.

This PR is stacked on #7548 and should follow its endpoint deployment.
Capacity restoration is separate in #7549. Preserve database schema/data
across application rollback and follow the artifact's staged rollout
with a complete D5/D6 observation between changes. No deployment is
included.

Restart reference: narrowly restores the persistence seam from #7256,
without restoring its producer and qualification policy changes.
contextablemark added a commit that referenced this pull request Oct 1, 2026
Selected observations can persist a status row even when the
accompanying history write fails. This restores the admin-authenticated
PocketBase transaction endpoint from #7255 so status, history, and a
durable job receipt commit together. Matching retries return the
recorded outcome; stale bases and conflicting identities reject without
partial effects.

The additive, bounded receipt migration is restored byte-for-byte with
original authorship retained. The hook also rejects malformed receipt
maps and incomplete stored receipt entries before writes or replay
acknowledgements. Both defects were reproduced against real PocketBase
databases before correction.

Retained integration checks cover authentication, real
history/receipt-capacity validation rollback, receipt admission, durable
replay, concurrency, stale bases, history fallback, and preserved worker
results. The tests use the official image without custom fault hooks or
a proxy. Removed the test fault hook and legacy/missing-schema modes.
Prior upgraded-volume and application-image rollback evidence remains
available.

Validation: fresh real PocketBase integration suite, scoped Nx
format/lint, JavaScript syntax, and full official Docker image build.
These standalone JavaScript checks have no TypeScript configuration.

This is a database prerequisite: the showcase caller does not yet use
this route. It makes no pill-execution or fleet-health claim. Deploy
before dependent callers and observe a complete staging D5/D6 cycle
before the next rollout. Application rollback must retain schema and
data. No deployment is included.

Restart references: #7255, #7256, #7340. The archived caller requires a
separate narrow change because its retry/skip policy conflicts with the
approved design.
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