Skip to content

fix: make every down/0 runnable, and pin the generator that stopped writing them - #371

Merged
Taure merged 2 commits into
mainfrom
chore/rebar3-kura-0-16-1
Aug 4, 2026
Merged

fix: make every down/0 runnable, and pin the generator that stopped writing them#371
Taure merged 2 commits into
mainfrom
chore/rebar3-kura-0-16-1

Conversation

@Taure

@Taure Taure commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Closes the last open item from the asobi_quests gap report (section 11), which was filed upstream as Taure/rebar3_kura#43.

What was wrong

rebar3_kura emitted every drop_table before every drop_index. Dropping a table already drops its indexes, so the drop_index that followed raised 42704 and the rollback stopped half way:

rollback: {error, {migration_failed, ...,
    {pgsql_error, #{code => <<"42704">>, message => <<"index \"...\" does not exist">>}}}}

Two of asobi's own migrations were written that way and could not roll back:

  • m20260330174743_create_player_identities - drops player_identities, then two of its indexes
  • m20260804063533_create_ops_audit_entries - drops ops_audit_entries, then all three of its indexes

What is here

  • rebar3_kura v0.16.0 -> v0.16.1, which is the fix upstream: index down-ops for a table created in the same migration are no longer emitted at all.
  • The two files corrected. Editing generated output rather than regenerating is deliberate - the generator only ever emits a new file, and both of these are applied everywhere. down/0 is read at rollback time and nowhere else, so this changes no deployed database.
  • asobi_migrations_tests walks every migration in the application and fails if a down/0 drops an index of a table it also drops. Nothing else would have noticed: down/0 runs on a rollback and never in CI. Against the two files as they were, it fails twice.

Checks

rebar3 fmt --check, xref and eunit (1551 tests, 0 failures) all clean locally.

Taure added 2 commits August 4, 2026 23:31
…riting them

rebar3_kura emitted every drop_table before every drop_index, and dropping a
table already drops its indexes, so two of asobi's own migrations could not
roll back: create_player_identities and create_ops_audit_entries each drop a
table and then drop an index of it, which raises 42704 part way through.
Taure/rebar3_kura#43 fixed the generator in v0.16.1; this pins it and corrects
the two files it wrote before.

Editing a generated migration rather than regenerating it is deliberate: the
generator only ever emits a new file, and these are applied everywhere. down/0
is read at rollback time only, so correcting it changes no deployed database.

asobi_migrations_tests walks every migration in the application and fails if a
down/0 drops an index of a table it also drops, because nothing else would
notice - down/0 runs on a rollback and nowhere else. Against the previous two
files it fails twice.
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

🟡 Code Coverage — 75%

6537 of 8718 lines covered.

@Taure
Taure merged commit dfc56ed into main Aug 4, 2026
15 checks passed
@Taure
Taure deleted the chore/rebar3-kura-0-16-1 branch August 4, 2026 21:47
Taure added a commit that referenced this pull request Aug 5, 2026
Taure added a commit that referenced this pull request Aug 5, 2026
… group (#381)

Closes #376.

asobi_match_server:waiting/3 stops with {shutdown, timeout} after
?WAITING_TIMEOUT - sixty seconds - and five test modules started one with
start_link and never unlinked it. asobi_match_server_tests starts 49 and stops
36, so thirteen linked processes were left sitting in `waiting` on every run.

A minute later each one exits {shutdown, timeout}, and the link carries that
into the eunit process running at that moment - which is some unrelated group,
usually a property module, because those run last. eunit reports it as
`*unexpected termination of test process* ::{shutdown,timeout}` with
`Failed: 0` and `undefined` for a name, since nothing failed: a group was
killed from outside.

That is every symptom in #376. It explains the alternating victim, the
sub-second gap between a module header and the kill, the zero failures, and
why no timeout in the tree was short enough to account for it - the timer that
fired belonged to a process nobody was looking at.

It is CI-only because it is a race with total run time: the leak has to still
be linked sixty seconds later, and a slower runner keeps the suite alive long
enough for the timer to land inside a later module. Nothing about #372 caused
it; that PR added enough test time to make the landing more likely. A bisect
probe at #371, the supposed last green, fails too.

Unlink at every start_link site, matching what asobi_bot_presence_tests already
did. The three fixes in #378 were all real and none of them was this.
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