Re: [Django] #36652: Loading squashed migrations from disk raises CircularDependencyError indeterministically

25 views
Skip to first unread message

Django

unread,
Oct 13, 2025, 9:40:10 AMOct 13
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------
Reporter: Jayden Kneller | Owner: (none)
Type: Bug | Status: new
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Changes (by Jacob Walls):

* has_patch: 1 => 0

Comment:

(We usually wait for a pull request to mark Has Patch, unsetting.)
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 13, 2025, 9:40:25 AMOct 13
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------
Reporter: Jayden Kneller | Owner: (none)
Type: Bug | Status: new
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Changes (by Jacob Walls):

* needs_tests: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:8>

Django

unread,
Oct 14, 2025, 12:42:08 AMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Changes (by Augusto Pontes):

* owner: (none) => Augusto Pontes
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:9>

Django

unread,
Oct 14, 2025, 1:41:43 AMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Augusto Pontes):

I will create another branch for testing, and i suggest you to create a
.gitignore, because the {{{show_issue}}} command generate too many files
and cache
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:10>

Django

unread,
Oct 14, 2025, 11:29:43 AMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

Using a management command and permutations of the migration names, I can
see if there is a way to recreate this with less apps and migrations.
I'll test between removing apps and migrations and see happens.
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:11>

Django

unread,
Oct 14, 2025, 11:37:53 AMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

Replying to [comment:10 Augusto Pontes]:
> I will create another branch for testing, and i suggest you to create a
.gitignore, because the {{{show_issue}}} command generate too many files
and cache

Done
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:12>

Django

unread,
Oct 14, 2025, 11:43:31 AMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

If anyone needs write access to this repo, let me know. I don't have any
branch protection rules set up, and I'm not sure I'll need any for this.

When I get the management command created that can run permutations of
migrations names, I'll get that committed.
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:13>

Django

unread,
Oct 14, 2025, 12:37:18 PMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

Looks like permutations of `(app_label, migration_name)` is not going to
be useful, as it is far too high a number. I'll see what I can figure
out.
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:14>

Django

unread,
Oct 14, 2025, 1:30:38 PMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

So, it look like i missed commenting out 2 dependencies in the old apps,
and if I comment them out, then the issue doesn't happen. So those are
probably the key to making this smaller.
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:15>

Django

unread,
Oct 14, 2025, 1:41:40 PMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

I updated the project, trimming the migrations down to 6 per app. I left
1 dependency in an old migration, commented out one I missed, and now I
have 2 success and 2 failure situations. From the looks of this, since it
is related to a dependency in an old migration, it should be possibly to
trim down the apps and migrations, possibly a lot.
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:16>

Django

unread,
Oct 14, 2025, 3:44:55 PMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

So far I've deleted apps 2, 3, 5, 7, 8, 10, and 14. Also found that
contrib wasn't being used. It was listed as a MIGRATION_MODULES in the
app this came from.
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:17>

Django

unread,
Oct 14, 2025, 3:57:20 PMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Augusto Pontes):

Replying to [comment:17 Jayden Kneller]:
> So far I've deleted apps 2, 3, 5, 7, 8, 10, and 14. Also found that
contrib wasn't being used. It was listed as a MIGRATION_MODULES in the
app this came from.

Ok, im writing some tests to make sure that your methods are really
working, but thanks to notify me, i will update my branch
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:18>

Django

unread,
Oct 14, 2025, 4:23:53 PMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

Got it down to 3 apps. 2 with 2 migrations and 1 with 3. I'm going to
rename them to app_one and app_two. users will stay.
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:19>

Django

unread,
Oct 14, 2025, 4:26:03 PMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

There is now only 1 successful path and 1 failure path.
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:20>

Django

unread,
Oct 14, 2025, 4:27:00 PMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

After I've renamed things I'll rewrite the Readme, to reflect the current
state of things.
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:21>

Django

unread,
Oct 14, 2025, 4:36:14 PMOct 14
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jacob Walls):

Hi Jayden, glad to hear of progress reducing the example. Could I ask you
to reduce the frequency of the updates? Feel free to provide an update
when you're ready for a review or are blocked, but if you're trying to
collaborate in real time with Augusto, may I suggest the Django Discord or
other collaboration platform instead? Thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:22>

Django

unread,
Oct 15, 2025, 10:39:26 AMOct 15
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Augusto Pontes):

Ok jacob, jayden you can add me on discord:

rankracerbr

just type this name, if you cant send the invite, i will invite you to my
server
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:23>

Django

unread,
Oct 15, 2025, 11:21:07 AMOct 15
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

So, after getting the test project down to 3 apps and 7 total migrations,
I've tracked the issue down to the order that
`self.graph.remove_replaced_nodes(key, migration.replaces)` gets called,
which is determined by the order of `self.replacements.items()`, which is
determined by the order of `migration_names`. If the second migration in
app_one is added to `self.replacements` before the first migration, since
dictionaries are now ordered by default, then a cyclic dependency error
occurs 100% of the time. To confirm this you can rename migration
`0002_squashed_initial` to `0000_squashed_initial` and call `show_issue
--use-fixed`.

If it is possible to mock the results that `self.replacements.items()`
returns, then I we could have a test that guarantees the results of either
a pass or CircularDependencyError based on the order of the migrations we
return, but with the migration names being a set right now, that mock
would still be susceptible to it only giving the result we want 50% of the
time. So, how do we write a test that will fail if the migration names is
a set?

Or, perhaps a better fix than making the migration names into a list,
would be for self.replacements to be added to in the order that migrations
would run. But, I'm not sure how easy that would be.

Any ideas for how to do a test?
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:24>

Django

unread,
Oct 15, 2025, 11:23:15 AMOct 15
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

Replying to [comment:23 Augusto Pontes]:
> Ok jacob, jayden you can add me on discord:
>
> rankracerbr
>
> just type this name, if you cant send the invite, i will invite you to
my server
>

Searching for rankracerbr says no one with that name could be found. You
can join the django discord channel using
https://discord.com/invite/xcRH6mN4fa
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:25>

Django

unread,
Oct 15, 2025, 11:31:55 AMOct 15
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Augusto Pontes):

Replying to [comment:25 Jayden Kneller]:
> Replying to [comment:23 Augusto Pontes]:
> > Ok jacob, jayden you can add me on discord:
> >
> > rankracerbr
> >
> > just type this name, if you cant send the invite, i will invite you to
my server
> >
>
> Searching for rankracerbr says no one with that name could be found.
You can join the django discord channel using
https://discord.com/invite/xcRH6mN4fa


Im in the server, i sent a message at the Community > #Contributor-
discussion, if you find me, you can send a friend request

{{{I|IRankracerBRI|I: ticket#36652}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:26>

Django

unread,
Oct 16, 2025, 10:48:51 AMOct 16
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by 허진수):

If i've understood correctly, the order can be fixed with PYTHONHASHSEED
env variable. Because Python iterates over set using the location of each
items, and it is based on the hash value. Python also uses seed to
randomize the hash results.

So, it's possible to test using `PYTHONHASHSEED` and `subprocess`. So we
just need to find the value that causes CircularDependencyError.
Here is simple example.


{{{
class SomeTestClass(TestCase):
def test():
...

#####
# other file
#####
def some_test_method():
env_vars = os.environ.copy()
env_vars['PYTHONHASHSEED'] = '0'
result = subprocess.run(
[sys.executable, '-m', 'unittest', 'test_file.py'],
env=env_vars,
capture_output=True,
text=True
)
}}}

I'm not sure if the result will be same, given a fixed `PYTHONHASHSEED`
env variable.
If something wrong here, please tell me.
Actually It's my first time on open source:)
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:27>

Django

unread,
Oct 17, 2025, 1:20:56 AMOct 17
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Augusto Pontes):

Replying to [comment:27 허진수]:
> And sry for my bad english:(
> Actually It's my first time on open source:)

Great suggestion, i recommend you to analyze the README on the repo of
jayden, i read, and the problem is a little bit deeper, on what i
understood, is that jayden already solved the problem, with some
adjustments on the code, and for now we are doing unit tests, and he is
analyzing performance issues that can happen in the future or on other big
applications, we are discussing on the official discord server, you can
join using this link:

https://discord.com/channels/856567261900832808/1428096388608299155
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:28>

Django

unread,
Oct 17, 2025, 5:29:51 PMOct 17
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Changes (by Jayden Kneller):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:29>

Django

unread,
Oct 17, 2025, 5:49:22 PMOct 17
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Comment (by Jayden Kneller):

Got a PR created. I even added a small docs change, though I don't know
if it is needed.

2 of the tests I created
(`test_migration_loader_replacement_order_succeeds` and
`test_migration_loader_replacement_order_raises`) are more for if someone
makes changes deeper in the code, if someone can figure out a better fix.
If there is a fix deeper in the code, then the first 2 tests will become
useless.
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:30>

Django

unread,
Oct 30, 2025, 5:19:35 PMOct 30
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:31>

Django

unread,
Nov 3, 2025, 12:14:42 PMNov 3
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
-------------------------------------+-------------------------------------
Reporter: Jayden Kneller | Owner: Augusto
| Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin

Comment:

[https://github.com/django/django/pull/20043 PR with latest edits]
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:32>

Django

unread,
Nov 3, 2025, 12:32:37 PMNov 3
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
Reporter: Jayden Kneller | Owner: Augusto Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 0 => 1
* stage: Ready for checkin => Accepted

Comment:

Test failures need investigating.
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:33>

Django

unread,
Nov 3, 2025, 9:11:24 PMNov 3
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
-------------------------------------+-------------------------------------
Reporter: Jayden Kneller | Owner: Augusto
| Pontes
Type: Bug | Status: assigned
Component: Migrations | Version: dev
Severity: Normal | Resolution:
Keywords: squashed | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:34>

Django

unread,
Nov 4, 2025, 8:15:35 AMNov 4
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
-------------------------------------+-------------------------------------
Reporter: Jayden Kneller | Owner: Augusto
| Pontes
Type: Bug | Status: closed
Component: Migrations | Version: dev
Severity: Normal | Resolution: fixed
Keywords: squashed | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls <jacobtylerwalls@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"e27cff68a32a0183c6b8d110b359c1c858f68cd7" e27cff6]:
{{{#!CommitTicketReference repository=""
revision="e27cff68a32a0183c6b8d110b359c1c858f68cd7"
Fixed #36652 -- Increased determinism when loading migrations from disk.

Ordering still depends on pkgutil.iter_modules, which does not guarantee
order, but at least now Django is not introducing additional
indeterminism,
causing CircularDependencyError to appear or not appear in some edge
cases.

Co-authored-by: Jacob Walls <jacobty...@gmail.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:35>

Django

unread,
Dec 15, 2025, 3:25:08 PM (23 hours ago) Dec 15
to django-...@googlegroups.com
#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
-------------------------------------+-------------------------------------
Reporter: Jayden Kneller | Owner: Augusto
| Pontes
Type: Bug | Status: closed
Component: Migrations | Version: dev
Severity: Normal | Resolution: fixed
Keywords: squashed | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls <jacobtylerwalls@…>):

In [changeset:"0071cb1efd559d721e5882da2e18556f867eed76" 0071cb1]:
{{{#!CommitTicketReference repository=""
revision="0071cb1efd559d721e5882da2e18556f867eed76"
Refs #36652 -- Avoided missing imports in a temporary file generated in a
migration test.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:36>
Reply all
Reply to author
Forward
0 new messages