Skip to content

test(etl): same-block route collision regression test (parity 2C)#244

Open
raymondjacobson wants to merge 1 commit intoetl/parity-2b-price-historyfrom
etl/parity-2c-pending-routes
Open

test(etl): same-block route collision regression test (parity 2C)#244
raymondjacobson wants to merge 1 commit intoetl/parity-2b-price-historyfrom
etl/parity-2c-pending-routes

Conversation

@raymondjacobson
Copy link
Copy Markdown
Contributor

Summary

Stack 2C audit / regression test. The original parity report flagged "in-block `pending_routes` collision tracking" as missing because apps explicitly threads `pending_track_routes` / `pending_playlist_routes` lists through block processing.

Investigation: that mechanism isn't needed in go-openaudio's current architecture. Handlers in `indexer.go` use `e.pool` directly with no surrounding transaction, so each `Exec` auto-commits before the next handler runs. Tx N+1's slug query already sees tx N's inserted `track_routes` / `playlist_routes` row, and `GenerateSlugAndCollisionID` correctly assigns `collision_id=1`.

apps needs the explicit pending list because its Python pipeline defers INSERTs to end-of-block (records staged in `new_records`, bulk-inserted on commit).

What this PR adds

Two regression tests that lock the current behavior in. If a future refactor groups same-block INSERTs into a single transaction (e.g. for write throughput), it must also introduce a pending_routes mechanism — otherwise same-title same-block tracks/playlists will silently get duplicate slugs.

No code change; tests + commit-message documentation only.

Stack context

Stacked on #243 (2B — price history).

Test plan

  • `TestSameBlock_TrackRouteCollision` — two tracks "My Song" by same owner → slugs `my-song` and `my-song-1`.
  • `TestSameBlock_PlaylistRouteCollision` — same for playlists.

🤖 Generated with Claude Code

Stack 2C audit. The original parity report flagged "in-block pending_routes
collision tracking" as missing because apps explicitly threads a
pending_track_routes / pending_playlist_routes list through block
processing — necessary because apps' Python pipeline defers INSERTs to
the end of the block (records are staged in new_records and bulk-inserted
on commit).

go-openaudio doesn't need that mechanism: handlers in indexer.go use
e.pool directly with no surrounding transaction, so each Exec auto-commits
before the next handler runs. Tx N+1's slug query already sees tx N's
inserted route_routes / playlist_routes row, and GenerateSlugAndCollisionID
correctly assigns collision_id=1 etc.

This commit adds two regression tests to lock that behavior in. If a
future refactor groups same-block INSERTs into a single transaction (e.g.
for performance), it must also add an explicit pending_routes mechanism
or the same-title same-block case will silently produce duplicate slugs.

No code change; documentation + test only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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