Repository navigation
Spectra: ooxml-edit-algebra-implementation — Phase 2 runtime of #99 - #109
Merged
Merged
Conversation
Phase 2 of ooxml-edit-isomorphism-foundation (#99): ship the Swift runtime that the foundation's ADRs pinned. Splits into: - proposal.md — scope: Edit protocol + OOXMLEdit/WordEdit enums + WordDocument.apply public API. - design.md — 6 Decisions: 1. Edit↔Operation mapping table (the central design artifact) 2. WordEdit↔OOXMLEdit mapping (per foundation ADR-003) 3. WordDocument owns OperationLog (Option A; rejected EditableDocument wrapper after user pushback re: type-surface bifurcation) 4. EditError shape (5 cases) 5. swift-testing @test(arguments:) for property tests 6. (NEW errata) End-to-end Edit-apply tests deferred behind OpLog Phase 2c — OperationReducer currently handles only setText/ setParagraphStyle/markers; all tree-mutating Operations throw malformedOp. File ooxml-swift issue for Phase 2c reducer cases before unblocking §3.3 / §8 / §9. - tasks.md — 10 task groups; §1+§2+§3.1+§3.2 marked done. - specs/ooxml-edit-algebra-runtime/spec.md — 8 ADDED Requirements with SHALL/MUST, Scenarios, SBE Examples. Tracks PsychQuant/ooxml-swift work on branch idd/105-edit-algebra-runtime: - §1 scaffold (Edit protocol + EditError + 5 OOXMLEdit cases + 3 WordEdit cases) — 9 tests, committed earlier in session - §2 Document.apply pipeline wiring + operationLog field — 9 tests, committed earlier in session - §3.1+§3.2 insertParagraph emission — 7 tests, this commit 25 ooxml-swift EditAlgebra tests green. Build clean. Refs #105
§3.3 / §8 / §9 e2e tests blocked on OperationReducer Phase 2c (tree-mutating Operation cases throw malformedOp). Issue filed against ooxml-swift with full scope + per-case priority order. Refs #105
§3.1/§3.2/§4.1/§6.1 emission tests shipped on ooxml-swift branch idd/105-edit-algebra-runtime. §3.3/§4.2/§6.2 e2e blocked on ooxml-swift#71 (OpLog Phase 2c reducer). §5 insertHyperlink pending — composite atomic design has open questions requiring user input (see #105 issue thread / next msg). Refs #105
ooxml-swift#71 Phase 2c reducer cases (insertParagraphAfter, insertParagraphBefore, removeParagraph, setRunFormat(bold MVP)) landed on ooxml-swift branch idd/71-oplog-phase-2c-reducer (merged into idd/105-edit-algebra-runtime for local e2e testing). 7 InsertParagraphE2ETests.swift tests prove the full chain (WordDocument.apply → lower → operations → log → materialize) mutates xmlTrees end-to-end on synthesized single-part documents. Real-.docx NTPU fixture variants deferred until per-op part scoping fix lands in WordDocument+Apply.swift — currently iterates ALL parts → Reducer throws elementNotFound on parts not containing the target. Documented as follow-up. §5 insertHyperlink still pending composite-atomic design checkpoint. Refs #105 Refs PsychQuant/ooxml-swift#71
Fixes raised by review of PR #109: C1 (tasks.md status accuracy) - §1.1–1.4, §2.1, §2.4, §2.5 marked [x] (shipped); §1+§2 headers note COMPLETE - §2.2 + §2.3 stay [ ] but annotated PHASED (Phase 2c follow-up); explained - §4, §6 already correctly marked H1 (spec.md Document → WordDocument) - Renamed throughout spec.md (the actual ooxml-swift type is WordDocument; foundation #99 used the conceptual name 'Document' which we now reconcile) - spec.md item title 'Document.apply Public Method' → 'WordDocument.apply Public Method' - Sources/.../Models/Document.swift file path retained (that's where the WordDocument type IS declared); apply() lives in EditAlgebra/WordDocument+Apply.swift H2 + M1 (PHASED items in spec.md normative SHALL list) - spec.md item #4 (pathNotFound early validation) marked '(PHASED — Phase 2c follow-up)' with explicit fallback (Reducer's elementNotFound wraps via operationLogFailure) - spec.md item #5 (preserveViolation defensive c14n) same phasing - Added 'Phased acceptance note' at end of Requirement explaining which SHALLs are required for initial acceptance vs phased M2 (proposal.md ASSUMPTION cross-ref) - Added REVISED ASSUMPTION block under the original ASSUMPTION, pointing to design.md Decision 6 errata + linking ooxml-swift#71 + PR #72 - Notes that insertHyperlink's composite mapping still depends on insertNode + updateAttribute reducer cases not yet in PR #72 L2 (design.md Decision 6 — link PR #72) - Added 'Critical-path subset SHIPPED via PR #72' paragraph with 4-of-14 case enumeration + 7 e2e test reference L4 (tasks.md §5 PENDING annotation) - §5 header annotated 'PENDING composite-design checkpoint' with the 5 open design questions inline N1 (proposal.md wrong file paths) - 'gains apply(_:) public method' in Models/Document.swift → 'gains operationLog field; apply ships in NEW file EditAlgebra/WordDocument+Apply.swift' - Affected code list adds WordDocument+Apply.swift entry N3 (design.md inline TODO) - 'TODO: verify if log starts empty or seeded' replaced with reference to DocumentApplyTests.testOperationLogStartsEmpty (already proven) Spectra validate still passes green. Refs #105
This was referenced May 31, 2026
kiki830621
added a commit
that referenced
this pull request
Jun 1, 2026
39/42 tasks complete; remaining 3 are PHASED items intentionally not shipped: - §2.2 EditError.pathNotFound early validation (PHASED — Reducer-wrap via operationLogFailure documented in spec.md as eventual contract) - §2.3 EditError.preserveViolation defensive c14n check (PHASED — same) - §5.2 Upfront atomicity pre-validation (DEFERRED — Reducer-layer atomicity via deterministic rId allocation works correctly without pre-validation; pre-validation would be a UX improvement) Spec ooxml-edit-algebra-runtime moved to openspec/specs/ (8 Requirements with SHALL/MUST + Scenarios + SBE Examples). Implementation shipped across 8 PRs over the macdoc#105 lifecycle: - macdoc PR #109 — Spectra docs (proposal+design+tasks+spec+yaml) - macdoc PR #111 — CD diagrams (8 total: 5 OOXMLEdit + 3 WordEdit) - ooxml-swift PR #72 — Phase 2c reducer critical-path (4 cases) - ooxml-swift PR #74 — multi-part scoping + opID-determinism - ooxml-swift PR #75 — FullyFaithfulFunctorTests (property-based) - ooxml-swift PR #76 — WordEdit.lower() per-case - ooxml-swift PR #77 — NaturalityTests (composition functor) - ooxml-swift PR #78 — Performance benchmark + single-part fast path - ooxml-swift PR #79 — Typed-views resync (opt-in) - ooxml-swift PR #80 — §5 insertHyperlink + wrapWithHyperlink emission - ooxml-swift PR #81 — Phase 2c hyperlink reducer (slice 1) - ooxml-swift PR #82 — Phase 2c wrapWithHyperlink reducer (slice 2) Refs #105 Refs #110 Refs PsychQuant/ooxml-swift#71
kiki830621
added a commit
that referenced
this pull request
Sep 29, 2026
39/42 tasks complete; remaining 3 are PHASED items intentionally not shipped: - §2.2 EditError.pathNotFound early validation (PHASED — Reducer-wrap via operationLogFailure documented in spec.md as eventual contract) - §2.3 EditError.preserveViolation defensive c14n check (PHASED — same) - §5.2 Upfront atomicity pre-validation (DEFERRED — Reducer-layer atomicity via deterministic rId allocation works correctly without pre-validation; pre-validation would be a UX improvement) Spec ooxml-edit-algebra-runtime moved to openspec/specs/ (8 Requirements with SHALL/MUST + Scenarios + SBE Examples). Implementation shipped across 8 PRs over the macdoc#105 lifecycle: - macdoc PR #109 — Spectra docs (proposal+design+tasks+spec+yaml) - macdoc PR #111 — CD diagrams (8 total: 5 OOXMLEdit + 3 WordEdit) - ooxml-swift PR #72 — Phase 2c reducer critical-path (4 cases) - ooxml-swift PR #74 — multi-part scoping + opID-determinism - ooxml-swift PR #75 — FullyFaithfulFunctorTests (property-based) - ooxml-swift PR #76 — WordEdit.lower() per-case - ooxml-swift PR #77 — NaturalityTests (composition functor) - ooxml-swift PR #78 — Performance benchmark + single-part fast path - ooxml-swift PR #79 — Typed-views resync (opt-in) - ooxml-swift PR #80 — §5 insertHyperlink + wrapWithHyperlink emission - ooxml-swift PR #81 — Phase 2c hyperlink reducer (slice 1) - ooxml-swift PR #82 — Phase 2c wrapWithHyperlink reducer (slice 2) Refs #105 Refs #110 Refs PsychQuant/ooxml-swift#71
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Creates Spectra change
ooxml-edit-algebra-implementation— the Phase 2 runtime that the foundation change #99 decision-pinned. Adds 5 artifacts toopenspec/changes/ooxml-edit-algebra-implementation/:Docs-only PR. Implementation code ships in separate ooxml-swift PRs (linked below).
Design Decisions (in design.md)
Operationenum casesOperationReducercurrently handles onlysetText/setParagraphStyle/markers; tree-mutating Operations throwmalformedOp. Filed PsychQuant/ooxml-swift#71. STATUS UPDATE: critical-path Phase 2c cases shipped via ooxml-swift PR #72 — e2e tests for insertParagraph/insertParagraphBefore/setBold/removeParagraph now functional on synthesized single-part documents.Implementation status (across linked PRs)
idd/105-edit-algebra-runtimeidd/105-edit-algebra-runtimeidd/105-edit-algebra-runtimeidd/105-edit-algebra-runtime(depends on ooxml-swift#72)idd/105-edit-algebra-runtimeidd/105-edit-algebra-runtimeidd/105-edit-algebra-runtimeidd/105-edit-algebra-runtime40+ tests across 4 EditAlgebra test files (EditProtocol, DocumentApply, InsertParagraph, SetBold, RemoveParagraph, InsertParagraphE2E) + 17 Phase 2c reducer tests. 1034 tests pass on the merged ooxml-swift branch.
Architectural milestone
The full chain
Edit → lower → operations → log → materialize → new WordDocumentnow mutatesxmlTreesend-to-end on synthesized documents. The macdoc#99 ADRs are empirically validated, not just decision-pinned.Linked work
idd/105-edit-algebra-runtime— Edit algebra emission + e2e tests (depends on 建立 CLI 指令規範檔(cli-spec.yaml)作為所有指令的 single source of truth #72 being merged; PR opens after 建立 CLI 指令規範檔(cli-spec.yaml)作為所有指令的 single source of truth #72 lands so Spectra: ooxml-edit-algebra-implementation (Phase 2 — Edit type runtime + property tests, per ooxml-edit-isomorphism-foundation) #105 branch can rebase cleanly)Test plan
spectra validate ooxml-edit-algebra-implementationpasses (will run before merging)Refs #105
Refs #99