* feat(storage): add ExternalRefHistoryQuerier capability for external-ref history
Introduce ExternalRefHistoryQuerier (HistoryViewer + PreviousExternalRef)
and implement it on DoltStore and EmbeddedDoltStore via a shared
issueops.PreviousExternalRefInTx helper. This lets callers resolve what a
given issue's external_ref was as of a point in time by querying Dolt's
dolt_history_issues system table, without requiring a raw *sql.DB —
EmbeddedDoltStore executes SQL through its own transaction-scoped
connection helper rather than a pooled *sql.DB, so it could never satisfy
a DB()-presence check even though it has the history table.
Refs #4549
* fix(tracker): gate externalRefChangedAfter on ExternalRefHistoryQuerier capability, not DB() presence
externalRefChangedAfter's dolt_history_issues fast path was gated on
whether the store exposed a raw *sql.DB (dbProvider). Embedded-Dolt
stores execute SQL through a transaction-scoped connection helper rather
than a pooled *sql.DB, so they never took the fast path even though they
support the dolt_history_issues query — they silently fell back to the
coarser CreatedAt/UpdatedAt timestamp heuristic, which can disagree with
the precise history-table answer.
Rewire the gate to type-assert (unwrapping decorators via
storage.UnwrapStore) for the new storage.ExternalRefHistoryQuerier
capability instead, so embedded-Dolt stores take the fast path too.
Adds pure-Go mock coverage for the capability-detection and gating logic,
plus cgo-tagged integration tests exercising the real EmbeddedDoltStore
and DoltStore backends.
Refs #4549
* test(tracker): lock NULL-historical-ref contract in externalRefChangedAfter (#4549)
PreviousExternalRefInTx surfaces a NULL historical external_ref column as
("", found=true), not "not found" (internal/storage/issueops/history.go:126).
Add a pure-Go fast-path test asserting the fast path compares that empty
string against currentRef like any other value, rather than treating it as
an unconditional "changed" the way the old inline !previousRef.Valid check
did.
---------
Co-authored-by: matt wilkie <maphew@gmail.com>