Skip to content

[Feature:System] Verify migration datestamps#12474

Merged
bmcutler merged 15 commits into
Submitty:mainfrom
jndlansh:feature/verify-migration-datestamp
Jun 19, 2026
Merged

[Feature:System] Verify migration datestamps#12474
bmcutler merged 15 commits into
Submitty:mainfrom
jndlansh:feature/verify-migration-datestamp

Conversation

@jndlansh

@jndlansh jndlansh commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Why is this Change Important & Necessary?

Closes #12446

Migration files are executed in chronological order based on their datestamp. If a pull request containing a migration remains open for an extended period before merging, its datestamp may become stale. When merged later, this can cause the migration to execute out of order on systems updating from older versions, potentially leading to dependency failures.

This change introduces a CI check to prevent stale migration files from being merged.

What is the New Behavior?

A new GitHub Action runs on pull requests that modify files under:
migration/migrator/migrations/**

The workflow:

  • Identifies migration files added or modified in the PR
  • Validates that filenames follow the expected format (YYYYMMDDHHMMSS_description.py)
  • Fails the check if any migration file is older than 7 days (default threshold)
  • Prints a clear message explaining how to rename the file

The maximum allowed age can be configured via the MAX_MIGRATION_AGE_DAYS environment variable.

What steps should a reviewer take to reproduce or test the bug or new feature?

  1. Create a branch and add a migration file with a timestamp older than 7 days.
  2. Open a pull request.
  3. Confirm that the GitHub Action fails and reports the file as stale.

To verify the passing case:

  1. Rename the migration file to use a current timestamp.
  2. Push the change.
  3. Confirm the GitHub Action passes.

Unit tests for the verification script can be run locally using:
pytest migration/tests/test_verify_migration_datestamp.py

Automated Testing & Documentation

Unit tests have been added for:

  • Filename parsing (valid and invalid formats)
  • Fresh vs stale migration detection
  • Custom age threshold handling
  • Git diff filtering logic

All tests pass locally.

Other information

  • No breaking change.
  • No database schema changes are introduced by this PR.
  • No security concerns are introduced.
  • This PR adds CI validation only and does not affect runtime behaviour.
image

@jndlansh
jndlansh marked this pull request as draft February 26, 2026 02:48
@automateprojectmangement automateprojectmangement Bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Feb 26, 2026
@jndlansh
jndlansh marked this pull request as ready for review February 26, 2026 04:35
@jndlansh
jndlansh marked this pull request as draft February 26, 2026 04:36
@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to Seeking Reviewer in Submitty Development Feb 26, 2026
@automateprojectmangement automateprojectmangement Bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Feb 26, 2026
@jndlansh
jndlansh marked this pull request as ready for review February 26, 2026 07:00
@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to Seeking Reviewer in Submitty Development Feb 26, 2026
@JManion32

Copy link
Copy Markdown
Contributor

Hey @jndlansh, thank you for your contribution, and thorough pull request description. Please update your title to match Submitty conventions: [<TYPE>:<MODULE>] <SUBJECT>. More information can be found here.

@jndlansh jndlansh changed the title CI: Verify migration datestamps [Feature:System] Verify migration datestamps Feb 27, 2026
@jndlansh

Copy link
Copy Markdown
Contributor Author

Thanks @JManion32 for correcting my PR title. I hope now it complies with the rules and regulations.

@jndlansh

Copy link
Copy Markdown
Contributor Author

Hi @williamschen23, could you please approve the workflows for this PR when you have a moment so the CI checks can initiate? That would be great.

@codecov

codecov Bot commented Feb 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.48%. Comparing base (d0682c2) to head (9458de7).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main   #12474   +/-   ##
=========================================
  Coverage     21.48%   21.48%           
  Complexity     9842     9842           
=========================================
  Files           268      268           
  Lines         36851    36851           
  Branches        495      495           
=========================================
  Hits           7919     7919           
  Misses        28441    28441           
  Partials        491      491           
Flag Coverage Δ
autograder 21.32% <ø> (ø)
js 2.01% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.52% <ø> (ø)
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@williamjallen

Copy link
Copy Markdown
Member

@jndlansh Please see failing CI.

@jndlansh

jndlansh commented Feb 28, 2026

Copy link
Copy Markdown
Contributor Author

hey @williamjallen
I have tried to fix the linting and unit test errors, could you kindly approve the workflows again. This time all the tests should pass.
https://drive.google.com/file/d/14YJKfv8YECtMW7yyFujsBSf7pDtWuhZC/view?usp=drive_link

@williamjallen

Copy link
Copy Markdown
Member

@jndlansh Please see failing CI. You can test your changes on your own fork for faster iteration with our CI checks.

@jndlansh

jndlansh commented Mar 1, 2026

Copy link
Copy Markdown
Contributor Author

@jndlansh Please see failing CI. You can test your changes on your own fork for faster iteration with our CI checks.

I am not able to run CI checks on my fork, it shows no workflow runs, could you please guide me on how to do that @williamjallen ?

Newer : Now I have passed the CI tests on my VM, it that alright or i need to check in my fork?

@jndlansh

jndlansh commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

Hey @williamjallen !

Could you please approve the workflows, I have passed the CI checks.

Screenshot 2026-03-05 074658

Comment thread site/public/js/server.js Outdated
@github-project-automation github-project-automation Bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Mar 7, 2026
@jndlansh
jndlansh requested a review from williamjallen March 9, 2026 17:49
@jndlansh

jndlansh commented Mar 9, 2026

Copy link
Copy Markdown
Contributor Author

hey @williamjallen could you please review my PR?

@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to In Review in Submitty Development Mar 9, 2026

@JManion32 JManion32 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.

Code changes seem reasonable, but I have a few changes to request before I test everything more thoroughly. The big change is adding the new job to ci.yml.

Comment thread site/app/templates/submission/homework/SubmitBox.twig Outdated
Comment thread site/public/js/submission-page.js Outdated
Comment thread migration/migrator/migrations/course/20260301120000_allow_read_only.py Outdated
Comment thread .github/workflows/verify-migration-datestamp.yml Outdated
Comment thread .github/scripts/verify_migration_datestamp.py Outdated
@github-project-automation github-project-automation Bot moved this from In Review to Work in Progress in Submitty Development Mar 22, 2026
@jndlansh

Copy link
Copy Markdown
Contributor Author

Hey @JManion32, I have reverted all the unnecessary changes and moved the verify_migration_datestamp.yml file to ci.yml .

Could you please review the changes made.

@github-actions github-actions Bot added the Abandoned PR - Needs New Owner No activity on PR for more than 2 weeks -- seeking new owner to complete label Apr 7, 2026
Comment thread .github/scripts/verify_migration_datestamp.py Outdated
@dandrecollins07-ctrl dandrecollins07-ctrl self-assigned this Jun 15, 2026

@dandrecollins07-ctrl dandrecollins07-ctrl 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.

Fixed ci.yml lint issue, also with one small requested change. Tested locally and the functionality works. Approving.

@GarvitKhandelwal31 GarvitKhandelwal31 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.

Looks good to me as well.

@github-actions github-actions Bot removed the Abandoned PR - Needs New Owner No activity on PR for more than 2 weeks -- seeking new owner to complete label Jun 16, 2026
@bmcutler
bmcutler merged commit 738850a into Submitty:main Jun 19, 2026
24 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Verify Migration File datestamp using a Github Action test

6 participants