Skip to content

fix(deploy): converge hdb_deployment terminal status on peers - #1171

Merged
kriszyp merged 1 commit into
mainfrom
kris/deploy-tracking-converge
Jun 9, 2026
Merged

fix(deploy): converge hdb_deployment terminal status on peers#1171
kriszyp merged 1 commit into
mainfrom
kris/deploy-tracking-converge

Conversation

@kriszyp

@kriszyp kriszyp commented Jun 8, 2026

Copy link
Copy Markdown
Member

Summary

The deploy lifecycle writes the hdb_deployment row ~10 times within a few hundred ms (create, payload ingest, phase flushes, per-peer results, finish()). These replicate to peers; on a loaded peer the rapid same-key writes can commit out of order, where an older full update reverts the terminal success write — the peer row stays stuck at replicating and never converges.

This adds DeploymentRecorder.seal(), called before the replicate phase: scheduleFlush() stops issuing puts (state accumulates in memory) and finish() performs a single terminal write, isolating it from the concurrent same-key burst so the receiver converges.

Purpose

Fixes the intermittently-failing harper-pro integration test deployTrackingReplication.test.mjs ("hdb_deployment row replicates to peers" — saw replicating). It is pre-existing on harper-pro main (failed on Node v22/v24 shard 4; v26 happened to pass), not introduced by any feature branch — it's a timing-dependent replication race.

This is a mitigation. The underlying defect is in core replication (an out-of-order full update can revert a newer record): #1170, fixed separately.

Where to look

  • components/deploymentRecorder.tssealed flag + seal(); scheduleFlush() early-returns when sealed.
  • components/operations.jsrecorder?.seal() before the replicate phase.

Tradeoff (deliberate)

The origin's get_deployment polling view no longer shows the transient replicating status or incremental peer_results during the final phase. Live SSE tailing is unaffected (the emitter still emits in real time). Once #1170 lands, this seal can be removed to restore incremental peer_results persistence.

Verification

  • Recorder unit tests pass (17, incl. 2 new for seal()); test:unit:main shows no regressions.
  • The actual multi-node failing test is verified via a companion harper-pro PR that bumps the core pointer to this branch (the test only runs in harper-pro CI).

Cross-model review: Codex (no issues) + Gemini/AntiGravity (correct; two low-severity suggestions — guard the unused transitionPhase, reset dirty in finish() — intentionally skipped as YAGNI since finished already gates further writes).

🤖 Generated by Claude (Opus 4.x) per the Harper engineering DLC.

The deploy lifecycle writes the hdb_deployment row ~10 times within a few
hundred ms (create, payload ingest, phase flushes, per-peer results, finish).
These replicate to peers; on a loaded peer the rapid same-key writes can commit
out of order, where an older full update reverts the terminal `success` write —
the peer row stays stuck at `replicating` and never converges (#1170).

Add DeploymentRecorder.seal(), called before the replicate phase: scheduleFlush()
stops issuing puts (state accumulates in memory) and finish() performs a single
terminal write, isolating it from the concurrent same-key burst so the receiver
converges. The ProgressEmitter still emits live SSE events; only the origin's
get_deployment polling view skips the transient `replicating` status and
incremental peer_results during the final phase. Mitigation pending #1170.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@claude

claude Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Reviewed; no blockers found.

@kriszyp
kriszyp marked this pull request as ready for review June 8, 2026 22:07
@kriszyp

kriszyp commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

Marking ready for review. ✅

Verification: the actual failing test (deployTrackingReplication.test.mjs — "hdb_deployment row replicates to peers") is green on all three Node versions via the companion harper-pro PR (#291) that pins core to this branch.

Note on red CI: the only remaining failure is Unit Test"Test logRotator module > Test that log file is rotated if log has exceeded max size". This is a pre-existing flake on the base commit, not from this change — it reproduces identically on #1172 (which only touches resources/Table.ts and doesn't go near logging), and the deployment-recorder change touches neither logging nor rotation. The other integration/Bun blips cleared on re-run.

— Claude (Opus 4.x)

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@kriszyp
kriszyp merged commit 982b078 into main Jun 9, 2026
68 of 76 checks passed
@kriszyp
kriszyp deleted the kris/deploy-tracking-converge branch June 9, 2026 03:50
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.

2 participants