Skip to content

[AI-3477] Pin the source usage id of a request moved on twice - #2234

Merged
kanat merged 1 commit into
mainfrom
ai-3477-pin-source-usage-id
Nov 23, 2026
Merged

kanat merged 1 commit into
mainfrom
ai-3477-pin-source-usage-id

Conversation

@kanat

@kanat kanat commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Test only, no code change. There is no production caller: the PR pins code that is already on main.

Problem

#2189 round-2 review, finding R2.2: mutant N3 survives the whole DataMoveSuite on main. N3 changes picked[j] = origin to picked[j] = "r.usage_id" at acceleration/internal/store/datamove.go:761, the line that keeps the first recorded usage id as source_usage_id of a copy. A request that moves on twice and comes back (A -> B -> C -> A) is then two rows at A.

Test

TestARequestMovedOnTwiceAndBackIsOneRowWhereItWasRecorded, next to TestARequestMovedOnFromACopyIsOneRowWhereverItLands:

source acme (A) --move--> destination acme (B) --import--> destination globex (C) --import--> source acme (A)

Expected: one row at A, with the usage id it had first. The request id is random (crypto/rand).

Mutation

Mutant Result
N3: picked[j] = "r.usage_id" (datamove.go:761) the test fails with 2 rows (expected 1); restored

go test -tags integration ./internal/store/ -run TestDataMoveSuite: pass on the head (33 s).

🤖 Generated with Claude Code

A request sent home after a third hop (A to B to C to A) must be one row
where it was recorded. Taking source_usage_id from the sent usage_id
instead of the origin left this uncovered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No findings at 972e9ba.

Verdict: GO.

Checked, on the head merged onto current main (2c52b62, unchanged since the branch point):

  • The diff is datamove_test.go only (+25); no production code changes.
  • The test walks a real A -> B -> C -> A path: s.move into the destination, then ImportRow into another customer there, then ImportRow back into the source. It asserts one row at A and its usage id equals the one the request first had, not only the count.
  • It passes on the head 5 of 5 runs (-count=1) and the whole TestDataMoveSuite passes.
  • Mutant N3 (picked[j] = "r.usage_id", datamove.go:761) fails it 5 of 5 (2 rows, expected 1). A second mutant, picked[j] = "r.source_usage_id", also fails it 5 of 5. Swapping the COALESCE order of origin fails it together with its two neighbours.
  • The request id comes from crypto/rand and every test truncates first, so ids cannot collide with another test or suite.
  • A merge-tree of this head with #2208, #2221 and #2230 (each alone, then all three) is clean, and go vet -tags integration ./internal/store/ passes on the combined tree.

CI: this is a draft, so the Go jobs are skipped; they run at gh pr ready.

@kanat
kanat marked this pull request as ready for review November 23, 2026 16:13
@kanat
kanat merged commit d575e6e into main Nov 23, 2026
15 checks passed
@kanat
kanat deleted the ai-3477-pin-source-usage-id branch November 23, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant