* fix(storage): carry closed_by_session through the domain/UOW writer
Rebased onto current main, which changed what this PR needs to be.
The original diff added closed_by_session to the shared select/scan/
insert column sets (sqlbuild.IssueSelectColumns, issueops.ScanIssueFrom,
insertIssueIntoTable, issueUpsertColumns). All of that landed upstream
independently in #5191, so those hunks are dropped rather than
mechanically re-resolved against the lease-overlay refactor (0055) and
the row_lock/RowVersion hydration that arrived with it.
What is still missing on main is the second writer: db.insertIssueRow,
the domain/UOW statement behind proxied create, batch create and import,
whose column list contains no closed_by_session — not in the INSERT, not
in the ON DUPLICATE KEY UPDATE. The schema defaults the column to '' and
the now-shared scanner faithfully reads back whatever was stored, so a
proxied create silently discards the closing session while the same
issue created through the classic path keeps it. That is the GH#4662
data loss, still live, just relocated.
Add the column to insertIssueRow's insert, values and upsert
assignments, and note at the chokepoint why the two writers' column
lists have to stay in step.
Tests:
- Three new cases in the domain/db suite (real Dolt): insert -> get
preserves closed_by_session on the issues table and on the wisps
table, and the upsert rewrites it rather than keeping a stale value.
All three fail against main and pass with the fix.
- The conformance case PromoteClosedWispPreservesSession from the
original commit is kept: it runs on every backend and is the
end-to-end GH#4662 regression (close a wisp with a session, promote,
assert the session survives).
The nit about test comments asserting closed_by_session is absent from
IssueSelectColumns no longer applies — those comments are gone from
main, and the scan-parity fixture already counts 52 columns including
closed_by_session.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(storage): name insertIssueRow's real callers and pin the upsert clear
Only Insert without CreateOnly reaches insertIssueRow: the CreateIssue
callers that leave CreateOnly unset, such as the quick, todo and gate
proxied servers and the create op of a proxied `bd batch` script.
Proxied create and the unit-of-work batch creator and applier set
CreateOnly, so they insert through the classic writer, and import and
promotion use the classic writer too. That writer and the shared scanner
have carried closed_by_session since #5191.
So the previous commit closes a latent gap in the second writer rather
than a loss on proxied create or import, and GH#4662's closed-wisp
promotion loss was already fixed by #5191. The conformance case is that
issue's regression test: it passes without the domain writer change,
which the domain/db Insert tests pin instead.
- Reword the insertIssueRow comment and the domain/db test docs to name
the callers that reach the statement and its upsert half.
- Say in the PromoteClosedWispPreservesSession header that it guards the
classic path only.
- Add UpsertClearsClosedBySession: rewriting a closed row with an open
one must clear the stored session, not leave an open row with a stale
closing session. It fails if the upsert keeps the stored value when
the incoming one is empty.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Harry Miller <harry_miller@trimble.com>
---------
Co-authored-by: Harry Miller <harry_miller@trimble.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>