Skip to content

add commit msg tag to reset dashboard db in drone#70434

Merged
davidsbailey merged 8 commits into
stagingfrom
reset-db-drone-commit-msg
Jan 28, 2026
Merged

add commit msg tag to reset dashboard db in drone#70434
davidsbailey merged 8 commits into
stagingfrom
reset-db-drone-commit-msg

Conversation

@davidsbailey

@davidsbailey davidsbailey commented Jan 20, 2026

Copy link
Copy Markdown
Member

See #66876 (comment) for a description of the original issue -- Bethany tried removing some units from UI_TEST_SCRIPTS which she knew were being depended on by UI tests in order to get a list of failures, but the drone run unexpectedly passed. The underlying issue is that the cache-staging-build pipeline in .drone.yml has already prepopulated the database with those courses / units and cached them. So, when entries were removed from UI_TEST_SCRIPTS in a pending PR, this has no effect on the drone run, because those units already exist in the drone run's database.

The fix proposed by this PR is to add a new [reset db] commit message tag (similar to existing [test all] or [skip ui] tags). This causes the database to be dropped and recreated during the ui test setup for that particular drone run.

Depends on:

Testing story

validated via drone runs on intermediate commits, which show the following:

  1. 4b509f2 base case (no commit msg tag) is still working
  2. 13ce738 ui tests still pass when new [reset db] tag is specified
  3. c161d72 without [reset db] tag, removing a course / unit from seeding does not break UI tests. this is the original bug
  4. 1c76cd8 when specifying [reset db], removing course / unit does break UI tests. this is the desired behavior

Future work

The new behavior could be triggered automatically when there are changes to dashboard/lib/tasks/seed.rake, however this could be a bit heavy-handed given the 27-minute penalty for re-seeding the database.

@davidsbailey davidsbailey force-pushed the reset-db-drone-commit-msg branch from 47b7af0 to cb1f6fd Compare January 20, 2026 22:21
@davidsbailey davidsbailey force-pushed the reset-db-drone-commit-msg branch from ecb0746 to 4b509f2 Compare January 20, 2026 23:16
@davidsbailey davidsbailey changed the title add drone commit msg tag to reset dashboard db before seeding ui tests add commit msg tag to reset dashboard db in drone Jan 21, 2026
@davidsbailey davidsbailey marked this pull request as ready for review January 21, 2026 00:40
Comment thread lib/rake/ci.rake
Dir.chdir('dashboard') do
if CI::Utils.tagged?(RESET_DB_TAG)
ChatClient.log "Commit message: '#{CI::Utils.git_commit_message}' contains [#{RESET_DB_TAG}], resetting dashboard database."
RakeUtils.rake_stream_output 'db:reset db:setup_or_migrate'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just checking - is this safe to do in Drone? I don't know how our caching works but I wouldn't like my PR that removes units from seeding to see what fails to cause everyone's PRs to fail 😅

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

in theory it should be safe because the next step is to run seed:ui_test, and DB setup + seeding should get us back into the same state (modulo any updates made in the PR being tested) vs what existed in cached DB generated by the cache-staging-build pipeline (defined in .drone.yml). I'm not aware of any other database modifications that could have been made during the cache-staging-build step that could be lost here.

I attempted to validate this assumption via the results of the individual drone runs outlined in the PR description. if something in drone ui tests (the only place seed_ui_test is run) was broken by this, then I'd have expected this drone run to fail:

  1. 13ce738 ui tests still pass when new [reset db] tag is specified

as for making everyone's PRs fail, I think we can be confident that won't happen in this case because seed_ui_test does not get run in cache-staging-build. that pipeline calls a different method which does not hit this new codepath:

bundle exec rake ci:force_seed_ui_test

Comment thread lib/rake/ci.rake
# Reset the dashboard database before seeding for UI tests. By default, the
# database will have been prepopulated based on recent data from the staging
# branch (see cache-staging-build pipeline in .drone.yml).
RESET_DB_TAG = 'reset db'.freeze

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it worth adding a commit hook like this one when someone updates dashboard/lib/tasks/seed.rake to suggest using this tag?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I agree with the spirit of this and I'd be happy to better advertise or enforce this flag if it can be done in a high-signal manner, but I think this one could be a bit noisy because

  1. most people are going to be adding to the list of what's seeded, or sometimes touching parts of the file that have nothing to do with what gets seeded in UI tests
  2. the commit hook you linked to often gets triggered by other people's code changes when I'm doing a merge, and so the message isn't applicable to me

although I'm planning to use this tag pretty heavily in the next few weeks/months, I feel more comfortable with being a bit quieter about it because it doesn't seem relevant to most normal feature development, and folks who are doing cleanup projects can still find it in ci.rake if they need to.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

in the absence of a commit hook, I'll beef up the comment here to make it extra clear when this tag should probably be used.

@bethanyaconnor bethanyaconnor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A question and a suggestion but the change looks good to me! Thanks for doing this!

@davidsbailey davidsbailey merged commit a23dd55 into staging Jan 28, 2026
6 checks passed
@davidsbailey davidsbailey deleted the reset-db-drone-commit-msg branch January 28, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants