mzzz-zzm commented on PR #982:
URL: https://github.com/apache/iceberg-go/pull/982#issuecomment-4399201682
Refactored in commit `a6f6a0a` (Path A — clean fix, as you preferred).
`MetadataBuilder` now exposes a public
`AddSnapshotUpdate(*addSnapshotUpdate)` entry point that stores the update
**as-is**, preserving both `ownManifests` and `rebuildManifestList`. `Apply` is
now a one-liner that delegates to it:
```go
// table/updates.go
func (u *addSnapshotUpdate) Apply(builder *MetadataBuilder) error {
return builder.AddSnapshotUpdate(u)
}
```
The `builder.updates[n-1]` reach-back is gone. Identity-pinning tests in
`table/add_snapshot_update_test.go` now use `assert.Same` so any future change
that constructs a fresh `*addSnapshotUpdate` inside `AddSnapshotUpdate` (the
original "silent fix-disable" failure mode) fails loudly:
- `TestAddSnapshotUpdate_PreservesIdentity` — the stored update pointer must
equal the input pointer.
- `TestAddSnapshotUpdate_PreservesRebuildClosure` — `ownManifests` and
`rebuildManifestList` survive `Apply` end-to-end.
- `TestAddSnapshotUpdate_ApplyRoutesThroughAddSnapshotUpdate` — `Apply` does
not bypass the new method.
- `TestAddSnapshotUpdate_NilNoOp` — guard for the historical no-snapshot
case.
Verified the new tests fail on the previous back-door implementation. Blast
radius was small enough to make the refactor cleanly in this PR rather than
punt to a follow-up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]