Skip to content

fix: metadata stored by 0.1.8/0.1.9 copies breaks newer copies (uniqueIndexes added without a key bump) #44

Closed

Description

@Upd4ting

The metadata keys (Symbol.for(...@1)) are shared by every copy of the package on purpose, so that tables declared through one copy can be read through another. #32 added uniqueIndexes to DatumStaticMetadata without bumping the key, so metadata stored by a copy at 0.1.8 or 0.1.9 is read by a newer copy as if it had the new shape.

Reproduction (CommonJS; old is a 0.1.9 install, current the main build):

const oldCopy = require("<0.1.9 install>/node_modules/@antelopejs/interface-database-decorators");
const newCopy = require("@antelopejs/interface-database-decorators");
class Row extends oldCopy.Table {}
oldCopy.Index()(Row.prototype, "email");
const meta = newCopy.getMetadata(Row, newCopy.DatumStaticMetadata);
console.log("instanceof new class:", meta instanceof newCopy.DatumStaticMetadata);
console.log("uniqueIndexes:", meta.uniqueIndexes);
meta.uniqueIndexes.has("email");

Output:

instanceof new class: false
uniqueIndexes: undefined
TypeError: Cannot read properties of undefined (reading 'has')

Expected: either the key is versioned when the stored shape changes, or a reader tolerates (or upgrades) metadata stored by an older copy.

Activity

  1. Upd4ting commented on Nov 4, 2026

    @Upd4ting
    MemberAuthor

    Fixed by #55 (upgrade the table metadata stored by an older copy of the package), landed on main (921bf9d, the landed campaign/integration PR #87). The key stays shared and getMetadata upgrades what it reads; src/tests/stored_metadata.test.ts covers it and the 243 module tests pass on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions