Skip to content

Spectra: ooxml-edit-algebra-implementation (Phase 2 — Edit type runtime + property tests, per ooxml-edit-isomorphism-foundation) #105

@kiki830621

Description

@kiki830621

Problem

The architectural foundation Spectra change ooxml-edit-isomorphism-foundation (#99) shipped decision-pinning + 11/35 mechanical tasks. The 23 Swift implementation tasks (§1–§7 + §10.2 of that change's tasks.md) were explicitly DEFERRED to this Phase 2 follow-up.

Type

feature (implementation of locked architectural contract)

Priority

P2 — non-blocking, but unblocks downstream PRs #94#98 re-frames (#102 / #103 / #104), che-word-mcp boundary refactor (PsychQuant/che-word-mcp#162), and word-builder-swift lens migration (#101)

Scope (from ooxml-edit-isomorphism-foundation tasks.md §1–§7 + §10.2)

  • §1 Edit protocol + OOXMLEdit / WordEdit enum scaffold (4 tasks)
  • §2 Document.apply(_:) public API (3 tasks)
  • §3 Three canonical OOXMLEdit cases + CD diagrams (3 tasks: insertParagraph, setBold, insertHyperlink)
  • §4 Select + implement 2 additional OOXMLEdit cases (3 tasks)
  • §5 Three canonical WordEdit cases + lower() implementations (3 tasks)
  • §6 Property-based fully-faithful-functor tests on NTPU thesis fixture (5 tasks)
  • §7 Composition + associativity tests (2 tasks)
  • §10.2 Full swift test pass on packages/ooxml-swift (1 task)

Total: 24 implementation tasks across the ooxml-swift package.

Strategy

Open a new Spectra change ooxml-edit-algebra-implementation citing:

  • This issue (#?? — to be auto-numbered when filed)
  • Foundation change ooxml-edit-isomorphism-foundation's design.md ADRs 001-009
  • Foundation change's spec.md ooxml-edit-algebra capability (8 Requirements)
  • Foundation change's design.md ADR-002 Worked Examples (4 canonical CD diagrams for insertParagraph / setBold / insertHyperlink / range-crossing applyBold)

Apply phase implements the 24 tasks with:

  • TDD discipline per .spectra.yaml (each task starts with failing test from CD diagram's commute property)
  • Audit discipline per .spectra.yaml (3-lens adversary review per Edit case)
  • CD diagram authoring per new Edit case (ASCII ladder format, IETF-RFC style; templates in foundation design.md ADR-002 Worked Examples)
  • Property tests on NTPU thesis fixture (100 randomized inputs per Edit case)

Acceptance

  • packages/ooxml-swift/Sources/OOXMLSwift/EditAlgebra/{Edit,OOXMLEdit,WordEdit}.swift compile + pass TDD tests
  • packages/ooxml-swift/Tests/EditAlgebraTests/FullyFaithfulFunctorTests.swift passes 100 randomized inputs per OOXMLEdit case
  • Document.apply(_ edit: any Edit) API surface added without breaking existing Document.applyOverlay() / markDirty() callers
  • spectra validate ooxml-edit-algebra-implementation green
  • CD diagrams (text-form ASCII ladders) attached to each PR that introduces an Edit case (per ooxml-edit-isomorphism-foundation ADR-002)

Related

Why this is a separate issue (not bundled into #99)

Per #99's spectra-discuss conclusion + apply-phase budget reality, the 23 Swift implementation tasks require dedicated cycles with TDD + audit discipline + CD diagram authoring + property-based test calibration. Bundling them with decision-pinning would either rush the implementation or block the contract from landing. Splitting them lets the contract land first (already in foundation change) and the runtime follow with proper review.

Refs #99

Current Status

Phase: verified
Last updated: 2026-05-25 by /idd-diagnose

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions