Skip to content

test: Ensure back-compat of new _code fields in TOML archives#552

Closed
kdmccormick wants to merge 1 commit intomainfrom
kdmccormick/code-backcompat
Closed

test: Ensure back-compat of new _code fields in TOML archives#552
kdmccormick wants to merge 1 commit intomainfrom
kdmccormick/code-backcompat

Conversation

@kdmccormick
Copy link
Copy Markdown
Member

@kdmccormick kdmccormick commented Apr 19, 2026

[Do Not Merge]

This is a test PR to see how changes to the backup-restore format in #544 and #545 would work on Ulmo instance.

This PR is based on v0.30.2, which is what release/ulmo pins.

Context: #544 (comment)

@kdmccormick kdmccormick requested a review from ormsbee April 19, 2026 21:19
@kdmccormick kdmccormick marked this pull request as draft April 19, 2026 21:57
@kdmccormick kdmccormick force-pushed the kdmccormick/code-backcompat branch from 42199b5 to 9a5b342 Compare April 20, 2026 15:47
@kdmccormick kdmccormick force-pushed the kdmccormick/code-backcompat branch from 9a5b342 to f4ba024 Compare April 20, 2026 16:10
@kdmccormick
Copy link
Copy Markdown
Member Author

kdmccormick commented Apr 20, 2026

@ormsbee @bradenmacdonald Could I get your take on which of these formats to use for Verawood? I'm leaning 2 or 3.

All of these could be implemented to be backwards-compatible with Ulmo instances. Existing Ulmo-generated archives would be forwards compatible with Verawood instances, as the Verawood instance would just fall back to parsing [entity].key

Option 1

This is what I have implemented now.

[entity.component]
component_type = "xblock.v1:html"
component_code = "c22b9f97-f1e9-4e8f-87f0-d5a3c26083e2"

Option 2

This would match how an [entity.container] is defined. You could imagine additional component-type-specific data going into this table.

[entity.component."xblock.v1".html]
component_code = "c22b9f97-f1e9-4e8f-87f0-d5a3c26083e2"

Option 3

No changes for Verawood. Just continue parsing[entity].key. A future v2 format would implement something like the options above, and it would replace [entity].key with [entity].entity_ref.

@kdmccormick
Copy link
Copy Markdown
Member Author

For containers, I have similar question. Option 1 doesn't make sense given the existence of [entity.container.<subclass>] in the format. So, it's either:

Option 2

[entity.container.subsection]
container_code = "unit-foo-bar-baz"

Option 3

No changes. Just continue using [entity].key as the container_code.

@ormsbee
Copy link
Copy Markdown
Contributor

ormsbee commented Apr 20, 2026

I think (1) or (3). The container_code and container_type are things handled by the container applet, and are not specific to a kind of container. Likewise with component.

@kdmccormick
Copy link
Copy Markdown
Member Author

Option (1) is unfortunately impossible for containers without breaking Ulmo backcompat, due to how strict this existing validation code is:

if not isinstance(value, dict) or len(value) != 1:
errors.append("Container must be a dict with exactly one key.")
if len(value) == 1: # Only check the key if there is exactly one
container_type = list(value.keys())[0]
if container_type not in ("section", "subsection", "unit"):

That is, the following TOML

[entity.container]
container_code = "blah"

[entity.container.subsection]
...

will yield "Container must be a dict with exactly one key.".

Given that, I think we should keep things simple and just wait until "v2" before making any backup-restore format changes.

As an aside @ormsbee @bradenmacdonald , if/when we do TOML v2, I think we should aim to make Restore fairly permissive as to allow future backwards-compatible additions to the format.

@kdmccormick kdmccormick deleted the kdmccormick/code-backcompat branch April 20, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants