Goal
Make SpecificationItem fully immutable by replacing its public mutation API with a builder-copy workflow.
Scope
- Remove the public
SpecificationItem.addCoveredId(SpecificationItemId) method as a breaking API change.
- Add
SpecificationItem.toBuilder(), returning an independent builder pre-populated with every item property, including located IDs/ranges, text fields, status, location, relations, tags, and forwarding state.
- Defensively snapshot all builder-owned collections when building a
SpecificationItem, so later builder changes cannot affect an existing item.
- Preserve the linker’s derived covered-ID behavior: when it must add a missing covered ID,
LinkedSpecificationItem replaces its wrapped item with item.toBuilder().addCoveredId(...).build() instead of mutating the original.
- Update
dsn~specification-item to revision 4 and update corresponding implementation and unit-test trace markers.
Acceptance Criteria
- A
toBuilder().build() copy retains all source properties.
- Changing a copied builder produces a new item and leaves the source unchanged.
- Mutating a builder after
build() does not change the built item’s collections.
- Linked items continue to expose inferred covered IDs after linking, while the source
SpecificationItem remains unchanged.
./oft-self-trace.sh and mvn -T 1C verify pass.
Goal
Make
SpecificationItemfully immutable by replacing its public mutation API with a builder-copy workflow.Scope
SpecificationItem.addCoveredId(SpecificationItemId)method as a breaking API change.SpecificationItem.toBuilder(), returning an independent builder pre-populated with every item property, including located IDs/ranges, text fields, status, location, relations, tags, and forwarding state.SpecificationItem, so later builder changes cannot affect an existing item.LinkedSpecificationItemreplaces its wrapped item withitem.toBuilder().addCoveredId(...).build()instead of mutating the original.dsn~specification-itemto revision 4 and update corresponding implementation and unit-test trace markers.Acceptance Criteria
toBuilder().build()copy retains all source properties.build()does not change the built item’s collections.SpecificationItemremains unchanged../oft-self-trace.shandmvn -T 1C verifypass.