wip(929): stage 7 — drop resume_to_stage FS write from freeze/unfreeze

transition_to_frozen and transition_to_unfrozen no longer touch YAML; both
now just call apply_transition with no content_transform. Pairs with the
stage-6 read-side change in projection.rs.

Story 934 will obviate the entire resume_to mechanism by making frozen a
flag orthogonal to Stage (story stays in its current Stage when frozen).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Timmy
2026-05-12 19:18:27 +01:00
parent bfea832402
commit 23f58f5762
+9 -16
View File
@@ -100,25 +100,18 @@ pub fn apply_transition_str(
/// Freeze a story at its current stage.
///
/// Transitions the story to `Stage::Frozen { resume_to: current_stage }` and
/// writes `resume_to_stage` into the front matter so the projection layer can
/// reconstruct the full typed stage on subsequent reads.
/// Story 929: the YAML write of `resume_to_stage` is gone; the projection
/// layer no longer reads it (defaults to Coding). Story 934 will make
/// frozen a flag orthogonal to Stage, so the story stays in its current
/// Stage rather than encoding a "where to resume" payload — at which point
/// the read-side default also becomes moot.
pub fn transition_to_frozen(story_id: &str) -> Result<TransitionFired, ApplyError> {
let item = read_typed(story_id)?.ok_or_else(|| ApplyError::NotFound(story_id.to_string()))?;
let resume_dir = item.stage.dir_name().to_string();
let transform = move |content: &str| -> String {
crate::db::yaml_legacy::set_front_matter_field(content, "resume_to_stage", &resume_dir)
};
apply_transition(story_id, PipelineEvent::Freeze, Some(&transform))
apply_transition(story_id, PipelineEvent::Freeze, None)
}
/// Unfreeze a story, restoring it to the stage it was in before freezing.
/// Unfreeze a story.
///
/// Transitions `Stage::Frozen { resume_to }` back to `resume_to` and removes
/// the `resume_to_stage` field from the front matter.
/// Story 929: paired with `transition_to_frozen`, no longer touches YAML.
pub fn transition_to_unfrozen(story_id: &str) -> Result<TransitionFired, ApplyError> {
let transform = |content: &str| -> String {
crate::db::yaml_legacy::clear_front_matter_field_in_content(content, "resume_to_stage")
};
apply_transition(story_id, PipelineEvent::Unfreeze, Some(&transform))
apply_transition(story_id, PipelineEvent::Unfreeze, None)
}