Repository navigation
OpenConceptLab/ocl_issues#2911 | Load base_entities.yaml only on a new database - #939
Merged
Merged
Conversation
…on a new database, so deploys stop resetting the OCL org pre_startup.sh ran `loaddata core/fixtures/*` on every container start. loaddata overwrites an existing row in full, so each deploy put the OCL org (pk 1) back to its 2020 seed values and wiped its text, description, logo and overview. The new `load_fixtures` command loads every file in core/fixtures as before, but skips base_entities.yaml once the OCL org exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018wMfkJ379WBjtcv8ZiWpT4
…superuser and staff flags itself The base_entities.yaml reload used to reset them on every start. Without it, a demoted ocladmin made setup_superuser's lookup (is_superuser=True) fail and stop the container from starting (Codex review pass 1, F1.1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018wMfkJ379WBjtcv8ZiWpT4
Member
Author
Codex review, pass 1 (codex-cli 0.162.1, commit 7e3b528)Verdict: 1 finding (P2), fixed in ea7de7a.
findings.json{
"reviewer": "codex-cli 0.162.1",
"perspective": "defects",
"mode": "full",
"commit": "7e3b528bdae0d49c4958261c8da565daec0d5c52",
"verdict": "findings",
"prior": [],
"findings": [
{
"id": "F1.1",
"severity": "P2",
"tag": null,
"file": "core/common/management/commands/load_fixtures.py",
"line": 20,
"claim": "Skipping the entire fixture can break subsequent container starts when ocladmin has been demoted.",
"scenario": "In standalone mode, another staff user can demote ocladmin through PUT /users/ocladmin/staff/, setting is_superuser=False. With organization ID 1 present, this command now skips the user seed. The following setup_superuser command requires username='ocladmin', is_superuser=True, so it raises DoesNotExist and aborts startup. Previously, reloading base_entities.yaml restored that flag before setup_superuser ran.",
"action": "Initialize the required ocladmin state independently of organization seeding, or make setup_superuser restore its required flags without filtering them in the lookup. Add a regression test for startup after demotion.",
"lines_delta": null,
"confidence": "high"
}
]
} |
…ase; keep reloading ocladmin as before Moves the OCL org from base_entities.yaml to ocl_org.yaml, which load_fixtures skips once the org exists. base_entities.yaml (ocladmin) reloads on every start as before, so a demoted or deactivated ocladmin is restored as it always was, and setup_superuser goes back to master (Codex review pass 2, F2.1, and pass 1, F1.1). The fresh-database test now deletes both the org and ocladmin (F2.2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018wMfkJ379WBjtcv8ZiWpT4
Member
Author
Codex review, pass 2 (codex-cli 0.162.1, commit ea7de7a)Verdict: F1.1 resolved; 2 new findings (P2), both addressed in 72473ee by a different approach.
findings.json{
"reviewer": "codex-cli 0.162.1",
"perspective": "defects",
"mode": "verify",
"commit": "ea7de7ac2baba256daf5f7b60989c5da2005ac88",
"verdict": "findings",
"prior": [
{
"id": "F1.1",
"status": "resolved"
}
],
"findings": [
{
"id": "F2.1",
"severity": "P2",
"tag": null,
"file": "core/common/management/commands/setup_superuser.py",
"line": 16,
"claim": "Startup no longer restores a deactivated ocladmin's ability to authenticate.",
"scenario": "Another administrator deactivates ocladmin through the supported DELETE endpoint, setting is_active=False and verified=False. Previously, reloading base_entities restored both defaults. Startup now restores privileges and credentials but leaves those flags false: the configured API token is rejected and password login enters the reactivation flow.",
"action": "Restore ocladmin's active and verified state alongside its privilege flags, and add a regression test covering startup after deactivate().",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F2.2",
"severity": "P2",
"tag": null,
"file": "core/common/tests_load_fixtures.py",
"line": 44,
"claim": "The fresh-database test does not cover creation of the required ocladmin user.",
"scenario": "OCLTestCase.setUpClass already loads base_entities, and this test deletes only the organization. The preexisting ocladmin remains, so the test would pass even if fresh startup stopped creating that user, leaving the ticket's fresh-database acceptance criterion incompletely tested.",
"action": "Run the fresh-database case without preloaded base entities, assert both entities are initially absent, then verify that load_fixtures creates the OCL organization and ocladmin.",
"lines_delta": null,
"confidence": "high"
}
]
} |
Member
Author
Codex review, pass 3 (codex-cli 0.162.1, commit 72473ee)Verdict: clean. F1.1, F2.1 and F2.2 are resolved, and no new findings. findings.json{
"reviewer": "codex-cli 0.162.1",
"perspective": "defects",
"mode": "verify",
"commit": "72473eeb88438bac122878f9996e827853841dd8",
"verdict": "clean",
"prior": [
{"id": "F1.1", "status": "resolved"},
{"id": "F2.1", "status": "resolved"},
{"id": "F2.2", "status": "resolved"}
],
"findings": []
} |
…org test, drop a repeated comment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018wMfkJ379WBjtcv8ZiWpT4
Member
Author
Simplification review (fresh Claude subagent, commit 72473ee)Verdict: 4 cuts proposed; 2 applied in 229a7a5. A Codex check of that commit came back clean.
Check of cuts (codex-cli 0.162.1, commit 229a7a5): clean. simplify.json{
"reviewer": "claude subagent",
"perspective": "simplify",
"mode": "full",
"commit": "72473eeb88438bac122878f9996e827853841dd8",
"verdict": "findings",
"prior": [],
"findings": [
{
"id": "S1",
"severity": null,
"tag": "shrink",
"file": "core/common/tests.py",
"line": 279,
"claim": "The three test base classes list the fixture files in four loaddata calls; load_fixtures already loads that set.",
"action": "Replace the four loaddata lines in each setUpClass with call_command('load_fixtures').",
"lines_delta": -9,
"confidence": "medium",
"scenario": null
},
{
"id": "S2",
"severity": null,
"tag": "shrink",
"file": "core/common/tests_load_fixtures.py",
"line": 10,
"claim": "test_keeps_an_existing_ocl_org sets four attributes and makes four assertEquals; the same check fits in a dict.",
"action": "update(**edits) then assertEqual(values(*edits).get(), edits)",
"lines_delta": -8,
"confidence": "medium",
"scenario": null
},
{
"id": "S3",
"severity": null,
"tag": "dup-test",
"file": "core/common/tests_load_fixtures.py",
"line": 33,
"claim": "The ocladmin test and the capabilities test both assert that load_fixtures reloads every fixture except ocl_org.yaml.",
"action": "Merge into one test_reloads_every_fixture_but_the_ocl_org.",
"lines_delta": -4,
"confidence": "low",
"scenario": null
},
{
"id": "S4",
"severity": null,
"tag": "delete",
"file": "core/common/management/commands/load_fixtures.py",
"line": 18,
"claim": "The reason ocl_org.yaml is seed-only appears three times (help string, inline comment, fixture header).",
"action": "Nothing replaces it; keep the help string and the ocl_org.yaml header.",
"lines_delta": -2,
"confidence": "low",
"scenario": null
}
]
}cuts.json{
"reviewer": "codex-cli 0.162.1",
"perspective": "defects",
"mode": "cuts",
"commit": "229a7a5fe8d0ab5e2f0da7cc5d8b94572695559d",
"verdict": "clean",
"prior": [],
"findings": []
} |
Closed
6 of 7 tasks
snyaggarwal
approved these changes
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes OpenConceptLab/ocl_issues#2911
Problem
pre_startup.shranpython manage.py loaddata core/fixtures/*on every container start.base_entities.yamlpins the OCL org at pk 1 with onlyname,company,mnemonicandwebsite, andloaddataoverwrites an existing row in full. So every deploy put the OCL org back to its 2020 seed values: name "OCL", notext,description, logo oroverview. The About text and logo set on 2026-10-08 for OpenConceptLab/ocl_issues#2886 were gone after the next deploy.Change
base_entities.yamlinto its own fixture,ocl_org.yaml.manage.py load_fixtures: loads every file incore/fixturesas before, but skipsocl_org.yamlonce the OCL org exists. A new database is still seeded with the org.pre_startup.shcalls it instead ofloaddata core/fixtures/*.ocl_org.yamlnext tobase_entities.yaml.auth_groups.yamlthat named the old command now names the new one.Everything else, including ocladmin in
base_entities.yaml, still reloads on every start, so ocladmin's flags are restored as they always were.Tests
core/common/tests_load_fixtures.py:load_fixturesthensetup_superuser);With the old behaviour (loading the org fixture unconditionally), the first test fails. All four pass with the change; pylint scores 10.00 on the changed Python files.
After merge and deploy
The OCL org's content (name, logo, About text, description and banner) must be set again (OpenConceptLab/ocl_issues#2886). After this deploys, it stays.
🤖 Generated with Claude Code
https://claude.ai/code/session_018wMfkJ379WBjtcv8ZiWpT4