Repository navigation
Issue #1513: feat: give the seed dev's models 3, 6, 14 and 17, and remove 29 - #1521
Conversation
…s cleaned Runs cleanup_export_blockers.py, remove_test_data.py and convert_overlays.py on backup.sql in public and tenant_lif_team, and removes model 16, as dev got in #1388 and #1393. Dumped with pg_dump 18.6, as the seed last was. Tests that need overlays load the unconverted seed, kept as test/fixtures/backup-unconverted.sql (the same blob as the old backup.sql). The rest pin the converted seed; the snapshots are regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…move 29 As decided on #1513: models 3, 6, 14 and 17 take dev's content (exported from dev's tenant_lif_team), keeping their Ids, and model 29 is removed. The groups on model 17 are re-imported and keep their activation. V1.11 is applied before the dump, since restore.sh replays it on every local load. Every model and group in the seed now exports. Tests that need model 29 or CASE's TargetEntityId attributes run on the unconverted seed; model 17 joins 4 and 10 as a model whose association names aren't derived by the V1.7 rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kup.sql backup.sql is no longer a snapshot of V1.1's content. Per the decision on #1513 step 4, no migration converts a fresh environment; the deployment guide now says so and names the scripts that give it the seed's content. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f V1.1 Comment only. backup.sql still replaces V1.1 locally, but its content has moved past V1.1's; point at the deployment guide's note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…veat, model 17 precondition - deployment.md: a fresh Flyway environment has no supported path to the seed's content until #1514; the scripts were never run against V1.1. - conftest.py: backup-unconverted.sql replays no migrations, so a later migration has to be applied to it too. - test_type_name_does_not_select_the_overlay_path asserts model 17 is Type OrgLIF instead of only saying so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…issue-1513-replace-models
#1520's review added an assertion that model 17 is Type OrgLIF. Here 17 is dev's copy, Type SourceSchema; assert that, and note the OrgLIF case is tested through MODEL_ID. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Per #1520's review: handbook chapter 3 now says overlays are gone (dev and the seed converted, demo won't be), lists the seed's 18 live models, and replaces the overlay walkthrough with a pointer. Chapter 7's add-a-field step adds to model 17 directly (checked against the seed: 201, field in 17's generated schema). The fixture comments say the unconverted seed lasts until the overlay code is removed, not that the scripts run on demo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cbeach47
left a comment
There was a problem hiding this comment.
From Claude:
I checked this against main (which now includes #1523) and #1513's decisions. The seed side looks right:
- The live groups (the 23–26 groups, now 28–31) keep their rule counts (0, 0, 4, 1).
- No code or config in the repo refers to the old group Ids.
- The Id swap covers every model-Id column.
1. Chapter 7's recipe sets fields that POST /attributes/ ignores. CreateAttributeDTO (components/lif/mdr_dto/attribute_dto.py:36) has no LevelOfAccess, Queryable or Modifiable, and Pydantic drops unknown fields without an error. The attribute gets the defaults (Public, false, false), so x-queryable / x-mutable can't be set this way. UpdateAttributeDTO doesn't have these fields either. Before, the inclusion row carried these flags. On a self-contained model, no API call sets them now, though the format carries them on elements (§5.3). Could the recipe say they default and can't be set yet, with a follow-up issue to add them to both DTOs?
2. Model 17's Type changed from OrgLIF to SourceSchema. The portable format doesn't carry Type, so import_model writes SourceSchema (model_converter.py:550). That fits ADR data_model/0004, but it changes the local MDR UI, and the PR doesn't mention it:
- StateU LIF moves from the Org LIF group to source schemas (
SimpleTree.tsx:312). - Data Extensions (
DataExtensions.tsx,GET /datamodels/orglif) shows nothing. - 18, converted in place, stays
PartnerLIF, so the seed's two converted models now have different types.
Please list this as a behaviour change. Either is fine with me: leave it, or set 18 to SourceSchema too so they match.
3. Two tests now depend on #1523's temporary pass for NOT_MIGRATED. test_clone_datamodel_sql and test_schema_generation_cycle now run on the unconverted seed. Its models 14 and 29 still have attributes with DataType entity, so they're only generated because CODES_NOT_YET_REFUSED lets them through. When #1468 removes that pass (#1513's "Done means"), both tests fail.
- The cycle test can go along with #1463's guard.
- The clone test checks something the format keeps (Relationship, Placement, Required, Array). I'd run it on the converted seed's 3 and 14, and drop the
TargetEntityIdcoverage, since the format retired that form.
4. CI predates #1523. The run on 503ea8f was on 2026-11-17, and #1523 merged on 2026-11-18, so CI hasn't run generation's refusal against this seed. I merged main into this branch locally and ran the snapshot, portability, generation, endpoint, association-name and export-measurement tests. The new seed and #1523 work together: every snapshot matches, and nothing is refused. A rebase and a green CI run before merging would confirm it.
5. The new wording still describes dev and demo as live. Chapter 3 ("dev and the local seed: converted; demo won't be"), chapter 7, frontend chapter 2 and reference_data/transformations/README.md ("into dev's tenant_lif_team", "doesn't import into dev's public") all do. Now that both are decommissioned, these sentences can describe the seed alone.
On the Array question in the description: under §5.4, the association's Array is the cardinality. The element's own Array is a legacy column the format doesn't carry. So the 224 list associations are what model 17 means, and not checking 17 against the V1.7 rule is right. If any of them shouldn't be lists, that's a content change to 17, separate from this PR.
Nits
test_association_name_seed.py: the attribute query filters onx."Name" IS NOT NULL, so a model-17 row with noNameis never checked. The entity test addsOR p."DataModelId" IN %s. Doing the same here would make "both are set" true.test_schema_generation_element_flags.py: the comment says "since #1521"; elsewhere it's #1513.
… fix the recipe and wording - Clone test: run on the seed's self-contained models 3 (CLR v2 / Open Badges v3) and 14 (CASE) instead of the unconverted seed, and drop the TargetEntityId coverage the format retired. clone_datamodel sets no ContributorOrganization, so with the pass gone generation refuses every clone (MODEL_IDENTITY_INCOMPLETE); the test sets the source's organization on the clone, which leaves the open question of what a clone's organization should be. With CODES_NOT_YET_REFUSED emptied, the clone test passes. - Cycle test: say that it runs on the unconverted seed only because of the pass, and goes with #1463's guard when #1468 removes it. - Chapter 7: POST /attributes/ ignores LevelOfAccess, Queryable and Modifiable (neither CreateAttributeDTO nor UpdateAttributeDTO has them), so the recipe says the attribute gets the defaults. - Frontend chapter 2: StateU LIF (17) is now SourceSchema, so the tree lists it with source schemas and Data Extensions is empty; 18 is still PartnerLIF. - Describe the seed, or what a schema needs, instead of named environments (chapters 3 and 7, frontend chapter 2, the transformations README). - test_association_name_seed: check model 17's attribute rows with no Name too, and require both Name and Array on them. Comment cites #1513. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the transformations README: "Where the portable files import" keeps this branch's content, describes the seed and what a schema needs rather than named environments, and the old-format bullet says none are left at the top level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
From Claude: Thanks. I merged
Nits: both done. The attribute query now includes model 17 rows with no |
|
From Claude: Thanks, cf1dea9 covers everything, and CI passed with #1523 in the branch. I'd recommend approval. One small thing: the description doesn't list model 17's I've added the clone gap (no |
cbeach47
left a comment
There was a problem hiding this comment.
Spot checked. Approved.
|
From Claude: Thanks. The description now has a Behaviour change section on model 17's |
…models # Conflicts: # test/scripts/test_measure_export_blockers.py
…ortable format (#1522) ##### Description of Change **Stacked on #1521** (itself on #1520), so the diff shows only this step. Merge those first; this PR's base then becomes `main`. The two outbound reference groups, StateU LIF → CLR v2 / Open Badges v3 and StateU LIF → Ed-Fi v5, were the last old-format files in `reference_data/transformations/` (#1511). Their groups on dev have never had mappings, so there was nothing to export them from. Since #1521, the seed's models 3, 6 and 17 are dev's `tenant_lif_team` versions, which these files were written against, so they now convert through the seed: 1. Each old file was imported into the seed (`import_transformation_group`, as `POST /transformation_groups/{id}/import` does) as a new 17 → 3 or 17 → 6 group, version `1.0`. 2. That group was exported with `export_mapping_group` (`GET /portable/mapping_groups/{id}`) and replaces the old file under the same name. Both of the seed's schemas give the same two files, byte for byte. All three files in the directory are now portable, so `scripts/import-transformations.sh` loads all three instead of skipping two. **What changed in the content:** - **Rules:** every converted rule has the old rule's name, expression, expression language, target and sources, compared rule by rule (old paths' dotted `UniqueName`s and numeric prefixes reduced to the portable path's segments). That's 70 of 70 for Ed-Fi v5 and 30 of 32 for CLR v2 / Open Badges v3. - **Two rules dropped:** `AchievementSubject.activityStartDate` and `AchievementSubject.result` have no source or target attributes in the old file, and both read `Name.firstName`. The portable format needs a target, and they look like placeholders. - **Group names** follow the `<source>_<target>` pattern every other group uses: `StateU LIF_CLR v2 / Open Badges v3` and `StateU LIF_Ed-Fi v5`. The old files had `StateU-LIF_CLR-v2-Open-Badges-v3__v1.0` and `StateU LIF_Ed-Fi_v5_v1.0`. - **Not carried over:** the old files' `ActivationDate` (2026-06-18). An imported group arrives inactive (#1350), like the inbound file's. No rule had `Notes`, `Alignment` or a contributor to lose. ##### Where they import Checked on throwaway copies of #1521's seed: - **The seed, both schemas:** each file imports with every rule, re-exports byte for byte, and a second import is refused with `GROUP_EXISTS`. - **Dev's `public`:** none of the three files imports, and that includes the inbound file already on `main`. With dev's `public` export of model 17 in place of the seed's, they're refused with 53, 8 and 47 `PATH_INVALID` errors. That StateU LIF has fewer entities than `tenant_lif_team`'s, as the README already says for the inbound file. - **Dev's `tenant_lif_team`:** its models 3, 6 and 17 are the ones the seed now holds, so the paths resolve there. Not imported, since that would be a dev write. One thing to check before running the script there: `GROUP_EXISTS` keys on the two models plus `Version`. If dev already has an empty 17 → 3 or 17 → 6 group at `1.0`, the script reports the file as already installed while that group still has no mappings. ##### Tests - New `test/bases/lif/mdr_restapi/test_reference_transformations.py` runs every portable file in the directory (not recursively, like the script) in both seed schemas. It checks four things: the rule count, the import, the byte-for-byte re-export, and `GROUP_EXISTS` on the second import. 7 passed. - **Mutations:** the old-format Ed-Fi file put back fails 2 tests, and so does a mapping removed from it. ##### Related Issues Refs #1511, #1513 ##### Type of Change - [x] Bug fix (non-breaking change which fixes an issue) - [x] Documentation update ##### Project Area(s) Affected - [x] reference_data/ - [x] test/ or e2e/ --- ##### Checklist - [x] commit message follows commit guidelines (see commitlint.config.mjs) - [x] tests are included (unit and/or integration tests) - [x] code passes linting checks (`uv run ruff check`) - [x] code passes formatting checks (`uv run ruff format`) - [x] pre-commit hooks have been run successfully ##### Additional Notes - **Conflicts:** with #1518 in `reference_data/transformations/README.md`, like #1521. Whichever merges second resolves. - **The diff is mostly the two JSON files:** the old format carried database Ids and nulls on every rule; the portable one names paths only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Description of Change
#1520 is merged, and this branch has
mainmerged in, including #1523.Step 1 of #1513, applied to the seed, as decided: models 3 (CLR v2), 6 (Ed-Fi v5), 14 (CASE) and 17 (StateU LIF) take dev's content, and model 29 (Open Badges v3) is removed. Dev has no separate Open Badges v3; its model 3 covers both. Dev's
publicandtenant_lif_teamhold the same 3, 6 and 14, byte for byte. For 17, the seed takestenant_lif_team's version, which the reference mappings were written against. In both of the seed's schemas:→ 17) are exported and soft-deleted with their rules.GET /portable/models/{id}from dev'stenant_lif_team, 2026-11-15) is imported, and the two Ids are swapped, so the new content keeps the model's Id (17 is pinned in every compose file'sOPENAPI_DATA_MODEL_ID) and the old soft-deleted rows move to the new Id.DataModels.IdisGENERATED ALWAYS, so the swap relaxes it toBY DEFAULTand restores it in the same transaction.publiconly; the seed'stenant_lif_teamhas none).ActivationDate, so the local stack translates as before.Arraytrue, the V1.7 copies V1.11 (MDR portability: decide whether a Reference association can be a list #1471) resets.restore.shreplays V1.11 on every local load anyway, so it's applied before the dump, andbackup.sqlholds what a local stack loads.No live crosswalk goes through any of these models. 91 value mappings start at model 3's and 14's values, but each ends at a value of a model 1 value set deleted long ago.
Result (
scripts/measure_export_blockers.py): every model and group in the seed exports, 18 of 18 and 6 of 6 in each schema.Behaviour change
Model 17's
Typeis nowSourceSchema, notOrgLIF. The portable format doesn't carryType, soimport_modelwritesSourceSchema, which fits ADR data_model/0004. In the local MDR UI, StateU LIF moves from the Org LIF group to the source schemas, and Data Extensions (GET /datamodels/orglif) shows nothing. Model 18, converted in place, staysPartnerLIF.How it was checked
export_modelon 3, 6, 14 and 17 gives dev's file byte for byte.GET /datamodels/open_api_schema/{id}from dev'stenant_lif_team, row Ids aside:Array/Requiredon 3, 6 and 14;public_only, three child entities of model 17 (OperationalStatus,OrganizationCode,Ranges, whose parents are Private) come out single, because a child entity's legacyArrayisn't carried;full_export,CreationDate, which the format doesn't carry.Ed-Fi-v5_StateU-LIF__v1.0.json(Issue #1511: feat: import the reference transformations through the portable endpoint #1517) imports, all 83 rules, into both seed schemas. Before,publicrefused it withMODEL_MISSING.setvallines, is identical to Issue #1513: feat: convert the seed's overlays and clean it as dev was cleaned #1520's, including the 33GENERATED ALWAYSidentity columns.restore.shdoes changes no row.The procedure ran once, on a fresh load of #1520's seed, so the dump's Ids and sequence values don't depend on any dry runs.
Tests
test_measure_export_blockers: 18 of 18 models and 6 of 6 groups in each schema, nothing refused.test_portable_seed_round_trip: all 18 models, and every group and crosswalk on them, round-trip byte for byte.test_portable_endpoints: no seed model is refused any more, so the not-migrated test sets one of model 3's attributes toDataTypeentity inside the request's session, then rolls it back.test_association_name_seed: model 17 joins 4 and 10 as a model whose associationNameandArrayaren't derived by the V1.7 rule. They were set on dev: role names such asawardedByRefOrganization(MDR portability: store mapping paths so that two roles don't share one EntityIdPath (follow-up to #1389) #1434), andArrayedited since MDR portability: edit an association's Name and Array through the API and UI #1472. For those models, the test checks only that both are set.test_clone_datamodel_sql: runs on the converted seed's 3 (CLR v2 / Open Badges v3) and 14 (CASE). A clone gets noContributorOrganization, so the test sets the source's; that gap is on Check portability rules in one place: schema generation and MDR editing should call mdr_portability #1468.test_schema_generation_cycle: needs model 29, so it runs on the unconverted seed (unconverted_db_session, from Issue #1513: feat: convert the seed's overlays and clean it as dev was cleaned #1520), and goes with Issue #1462: fix: refuse an embedded-association cycle instead of crashing schema generation #1463's guard when Check portability rules in one place: schema generation and MDR editing should call mdr_portability #1468 removes theNOT_MIGRATEDpass.test/scripts,test/bases/lif/mdr_restapiandtest/components/lif/mdr_services: 728 passed, 1 skipped (PG 16.15 locally). One fewer than #1520 because model 29 left the snapshot set. After mergingmain(with #1523), the full suite: 1927 passed, 1 skipped.Docs:
reference_data/transformations/README.mdnow says where the files import against this seed.Related Issues
Refs #1513 (the seed is done; demo, step 6, and the migration question, step 4, stay open there), #1511, #1514
Type of Change
Project Area(s) Affected
Checklist
uv run ruff check)uv run ruff format)Additional Notes
Arrayvalues. Dev storesArraytrue on 123 attribute associations and 101 entity associations whose child's ownArrayisNo. The generator reads the association, so dev and now the local stack serve those as lists. That's dev's content as decided, but it may not be what was meant; the counts are from the seed'spublic.reference_data/transformations/README.md(both edit "Where the portable file imports"), and with Issue #1513: feat: count crosswalks in measure_export_blockers.py #1519 intest/scripts/test_measure_export_blockers.py. Whichever merges second resolves.🤖 Generated with Claude Code