Skip to content

migrations/v3.js "to v3.6.0" writes _messages to config, but the schema declares it on course #369

@taylortom

Description

@taylortom

Summary

The to v3.6.0 step in migrations/v3.js mutates getConfig()._spoor and writes _messages = {} there. However the schema change it is supposed to mirror — commit c1c50c87 — added _messages exclusively under pluginLocations.course._spoor, and the modern schema/course.schema.json keeps it on the course. config has never declared _messages.

So the migration targets a document where the field has no schema declaration and never touches the document where the field actually lives.

Schema (course): schema/course.schema.json_spoor._messages is on the course.
Schema (config): schema/config.schema.json — no _messages anywhere.

Impact

The bug surfaces when something validates with strict types but without re-applying defaults, or when a present-but-wrong-typed value sits in the course doc from an older toolchain (e.g. an empty string instead of {}). I hit this in practice when importing a legacy course bundle into a v1 AAT: the import fails with /_spoor/_messages must be object.

Suggested fix

Retarget the migration to the course — swap getSpoorConfig() for getCourse() and update the test fixtures.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Status
New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions