huskies: merge 986

This commit is contained in:
dave
2026-05-13 15:57:24 +00:00
parent 91fbad568a
commit 430079ecbc
13 changed files with 377 additions and 81 deletions
+11 -3
View File
@@ -264,13 +264,21 @@ pub fn transition_to_merge_failure(
) -> Result<TransitionFired, String> {
let display = kind.display_reason();
let gate_output = kind.to_gate_output();
// Serialise the typed kind BEFORE it is moved into the event so both the
// JSON key and the legacy string key can be written after the transition.
let kind_json = serde_json::to_string(&kind).unwrap_or_default();
let fired = apply_transition(story_id, PipelineEvent::MergeFailed { kind }, None)
.map_err(|e| e.to_string())?;
// Persist gate-output string so the CRDT projection can reconstruct the
// MergeFailureKind on server restart (display-only; scheduling uses the
// typed kind from the Stage variant).
// Persist the typed kind as JSON so the CRDT projection can reconstruct it
// without substring-scanning the gate output string (story 986).
crate::db::write_content(
crate::db::ContentKey::MergeFailureKind(story_id),
&kind_json,
);
// Persist legacy gate-output string for human-readable display and
// backward-compatible fallback on pre-986 data.
crate::db::write_content(crate::db::ContentKey::GateOutput(story_id), &gate_output);
// Persist human-readable description on the MergeJob CRDT entry so display