Skip to content

Conversation

@Lechros
Copy link
Owner

@Lechros Lechros commented Dec 8, 2025

Note

Introduce GearData v2 (top-level version/id, required icon), add migrate/getVersion utilities, validate version in ReadonlyGear, and update docs/tests/fixtures.

  • Core types (lib/data):
    • GearData v2: move meta.version/id to top-level version/id; make icon required; add VERSION = 2.
  • ReadonlyGear:
    • Validate data.version === VERSION in constructor (throws GearError on mismatch).
    • New getters: version, id; remove meta usage; icon now non-optional.
  • Migration utilities:
    • Add getVersion and migrate (v1→v2), with error handling; export migrate from package.
  • Errors:
    • GearError now accepts { id, name }; add messages for constructor/migration failures.
  • Tests/fixtures:
    • Update fixtures to v2 shape; add tests for version detection/migration; adjust ReadonlyGear tests.
  • Docs:
    • README: update GearData example to v2 and add migration usage section.

Written by Cursor Bugbot for commit e2d677b. This will update automatically on new commits. Configure here.

@changeset-bot
Copy link

changeset-bot bot commented Dec 8, 2025

🦋 Changeset detected

Latest commit: e2d677b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@malib/gear Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cloudflare-workers-and-pages
Copy link

Deploying malib-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: e2d677b
Status:🚫  Build failed.

View logs

@Lechros Lechros merged commit be7ffe3 into main Dec 8, 2025
3 of 4 checks passed
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on January 11

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

id: meta.id,
version: 2,
};
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Migration doesn't provide default value for required icon field

The migrateV1ToV2 function doesn't add an icon field when migrating from V1 to V2. The icon property changed from optional (in V1) to required (in V2), and the ReadonlyGear.icon getter removed its fallback value (?? ''). When V1 data without an icon is migrated, the resulting V2 data will lack the required icon field, causing ReadonlyGear.icon to return undefined instead of a string.

Additional Locations (1)

Fix in Cursor Fix in Web

...rest,
id: meta.id,
version: 2,
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Migration silently discards custom properties in meta object

The migrateV1ToV2 function extracts only id from the meta object and discards everything else. The old GearMetadata interface documentation stated that users could add custom properties prefixed with _ to meta. During migration, these custom properties are silently lost since only meta.id is preserved in the output.

Fix in Cursor Fix in Web

Lechros added a commit that referenced this pull request Dec 8, 2025
feat: update GearData interface and add migrate function
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