Make creases and flaps first-class entities in Fold_state (#26, #27) #40

Merged
toph merged 8 commits from feat/crease-entity into main 2026-07-03 07:16:56 +00:00
Owner

For #26 and #27. Groundwork for the #26/#28 material-crease work, split into two PRs; this is PR1, the plumbing.

Makes creases and flaps first-class entities in Fold_state: an edge carries paper endpoints, its two bordering face ids, an assignment, a stable crease_id, and provenance. Edges accumulate across folds and split when a later fold crosses them, preserving crease_id — the #26 identity invariant. fold_emit now serializes creases straight from state.edges, retiring the emit-time geometric reconstruction (the record_of/on_segment chord matching). The #27 precrease bug — mark a crease, fold on it, get U/0° instead of V/180° — is now fixed on the entity via an in-place UM/V upgrade; the old tactical two-chords-at-emit hack and the now-dead crease_record side-list are removed, so edges are the single source of truth.

Behavior-preserving. A 20-snapshot golden net, generated on the old emit path, survives the rewrite byte-for-byte — no emitted FOLD changes. Rebased onto the step/macro slice (#35); fold_state.ml was untouched by it, so the entity work rebased clean and the goldens were regenerated to characterize #35 output.

Out of scope, deferred to PR2: material crease reference semantics and the #(.a .b .c) flap operand — the user-facing half of #28. This PR is only the entity that PR2 builds on; no language surface changes here. Design and plan live in docs/superpowers/{specs,plans}/2026-07-03-*.

For #26 and #27. Groundwork for the #26/#28 material-crease work, split into two PRs; this is PR1, the plumbing. Makes creases and flaps first-class entities in `Fold_state`: an `edge` carries paper endpoints, its two bordering face ids, an assignment, a stable `crease_id`, and provenance. Edges accumulate across folds and split when a later fold crosses them, preserving `crease_id` — the #26 identity invariant. `fold_emit` now serializes creases straight from `state.edges`, retiring the emit-time geometric reconstruction (the `record_of`/`on_segment` chord matching). The #27 precrease bug — mark a crease, fold on it, get `U`/0° instead of `V`/180° — is now fixed on the entity via an in-place `U`→`M`/`V` upgrade; the old tactical two-chords-at-emit hack and the now-dead `crease_record` side-list are removed, so edges are the single source of truth. Behavior-preserving. A 20-snapshot golden net, generated on the old emit path, survives the rewrite byte-for-byte — no emitted FOLD changes. Rebased onto the step/macro slice (#35); `fold_state.ml` was untouched by it, so the entity work rebased clean and the goldens were regenerated to characterize #35 output. Out of scope, deferred to PR2: material crease reference semantics and the `#(.a .b .c)` flap operand — the user-facing half of #28. This PR is only the entity that PR2 builds on; no language surface changes here. Design and plan live in `docs/superpowers/{specs,plans}/2026-07-03-*`.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jfw5BuRgc2vq3j6zckY867
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jfw5BuRgc2vq3j6zckY867
Rebased feat/crease-entity onto origin/main (7d353f2, step-macro slice #35).
#35 added a 'step' field to beloch:edges and rewrote example syntax, changing
the FOLD output of every crease-bearing example; def-diagonals.bel is new.
fold_state.ml (Task 2) untouched by #35 — rebased clean, 5/5 fold_state green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jfw5BuRgc2vq3j6zckY867
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jfw5BuRgc2vq3j6zckY867
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jfw5BuRgc2vq3j6zckY867
toph merged commit 802671b90d into main 2026-07-03 07:16:56 +00:00
toph deleted branch feat/crease-entity 2026-07-03 07:16:57 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
toph/beloch!40
No description provided.