Skip to content

Add missing sets | Fix bit-length overflows | Fix Mana Convergence#8

Open
On-Jin wants to merge 1 commit into
Taum:mainfrom
On-Jin:add-eole-set
Open

Add missing sets | Fix bit-length overflows | Fix Mana Convergence#8
On-Jin wants to merge 1 commit into
Taum:mainfrom
On-Jin:add-eole-set

Conversation

@On-Jin
Copy link
Copy Markdown

@On-Jin On-Jin commented Mar 31, 2026

Hello!
Discovered via the Altered public API that COREKS, CORE, BISE and DUSTERTOP silently corrupt cards whose number exceeds the allocated bit range.

Bit-length fixes (breaking changes (had to fix tests)):

  • COREKS : 5 -> 6 bits (max numbered card : #32)
  • CORE : 5 -> 6 bits (max numbered card : #32)
  • BISE : 6 -> 7 bits (max numbered card : #64)
  • DUSTERTOP: 5 -> 6 bits (max numbered card : #44)

List (REFERENCE decoded as REFERENCE):
ALT_COREKS_B_OR_32_C -> ALT_COREKS_B_OR_00_C
ALT_CORE_B_OR_32_C -> ALT_CORE_B_OR_00_C
ALT_BISE_P_BR_64_C -> ALT_BISE_P_BR_00_C
ALT_BISE_P_BR_64_R1 -> ALT_BISE_P_BR_00_R1
ALT_BISE_P_BR_64_R2 -> ALT_BISE_P_BR_00_R2
ALT_DUSTERTOP_P_AX_32_R1 -> ALT_DUSTERTOP_P_AX_00_R1
ALT_DUSTERTOP_P_AX_41_C -> ALT_DUSTERTOP_P_AX_09_C
ALT_DUSTERTOP_P_BR_32_C -> ALT_DUSTERTOP_P_BR_00_C
ALT_DUSTERTOP_P_BR_38_R1 -> ALT_DUSTERTOP_P_BR_06_R1
ALT_DUSTERTOP_P_LY_39_R1 -> ALT_DUSTERTOP_P_LY_07_R1
ALT_DUSTERTOP_P_MU_33_R1 -> ALT_DUSTERTOP_P_MU_01_R1
ALT_DUSTERTOP_P_MU_44_C -> ALT_DUSTERTOP_P_MU_12_C
ALT_DUSTERTOP_P_OR_42_C -> ALT_DUSTERTOP_P_OR_10_C
ALT_DUSTERTOP_P_OR_43_R1 -> ALT_DUSTERTOP_P_OR_11_R1
ALT_DUSTERTOP_P_YZ_41_C -> ALT_DUSTERTOP_P_YZ_09_C
ALT_DUSTERTOP_P_YZ_44_R1 -> ALT_DUSTERTOP_P_YZ_12_R1


Created tools/fetch-all-references.py which auto-discovers every set from the API. And generates test files in test/generated/.
I let the script there, cloud be usefull for the set7 release!
/!\ Serialized commons (_C_XXX) are currently excluded from generated tests /!\

Added test/generated.test.ts to round-trip every generated file.

New sets added:

  • EOLE (ID 13, 7 bits, max numbered card : #123)
  • EOLECB (ID 14, 7 bits, max numbered card : #122)
  • JUDGE (ID 15, 5 bits, max numbered card : #16)
  • MUSUBI (ID 16, 7 bits, max numbered card : #74)
  • WCF25 (ID 17, 5 bits, max numbered card : Added product fields to spec #1)
  • WCS26 (ID 18, 7 bits, max numbered card : #98)

Mana Convergence
OLD -> // Fun fact: NE_1 (Mana Convergence) does not use 0 prefix on Core/CoreKS.

It sems to not be the case anymore fore CORE
ALT_CORE_B_NE_01_C -> works
ALT_CORE_B_NE_1_C -> 404
So i just refine the condition by removing "|| this.setCode ==2" and fix tests.

Discovered via the Altered public API that COREKS, CORE, BISE and DUSTERTOP silently corrupt cards whose number exceeds the allocated bit range.

Bit-length fixes (breaking):
- COREKS   : 5 -> 6 bits (max numbered card : #32)
- CORE     : 5 -> 6 bits (max numbered card : #32)
- BISE     : 6 -> 7 bits (max numbered card : #64)
- DUSTERTOP: 5 -> 6 bits (max numbered card : #44)

List (REFERENCE decoded as REFERENCE):
ALT_COREKS_B_OR_32_C -> ALT_COREKS_B_OR_00_C
ALT_CORE_B_OR_32_C -> ALT_CORE_B_OR_00_C
ALT_BISE_P_BR_64_C -> ALT_BISE_P_BR_00_C
ALT_BISE_P_BR_64_R1 -> ALT_BISE_P_BR_00_R1
ALT_BISE_P_BR_64_R2 -> ALT_BISE_P_BR_00_R2
ALT_DUSTERTOP_P_AX_32_R1 -> ALT_DUSTERTOP_P_AX_00_R1
ALT_DUSTERTOP_P_AX_41_C -> ALT_DUSTERTOP_P_AX_09_C
ALT_DUSTERTOP_P_BR_32_C -> ALT_DUSTERTOP_P_BR_00_C
ALT_DUSTERTOP_P_BR_38_R1 -> ALT_DUSTERTOP_P_BR_06_R1
ALT_DUSTERTOP_P_LY_39_R1 -> ALT_DUSTERTOP_P_LY_07_R1
ALT_DUSTERTOP_P_MU_33_R1 -> ALT_DUSTERTOP_P_MU_01_R1
ALT_DUSTERTOP_P_MU_44_C -> ALT_DUSTERTOP_P_MU_12_C
ALT_DUSTERTOP_P_OR_42_C -> ALT_DUSTERTOP_P_OR_10_C
ALT_DUSTERTOP_P_OR_43_R1 -> ALT_DUSTERTOP_P_OR_11_R1
ALT_DUSTERTOP_P_YZ_41_C -> ALT_DUSTERTOP_P_YZ_09_C
ALT_DUSTERTOP_P_YZ_44_R1 -> ALT_DUSTERTOP_P_YZ_12_R1

---

Created `tools/fetch-all-references.py` which auto-discovers every set from the API.
And generates test files in `test/generated/`.
/!\ Serialized commons (_C_XXX) are currently excluded from generated tests /!\

Added `test/generated.test.ts` to round-trip every generated file.

New sets added:
- EOLE   (ID 13, 7 bits, max numbered card : #123)
- EOLECB (ID 14, 7 bits, max numbered card : #122)
- JUDGE  (ID 15, 5 bits, max numbered card : #16)
- MUSUBI (ID 16, 7 bits, max numbered card : #74)
- WCF25  (ID 17, 5 bits, max numbered card : Taum#1)
- WCS26  (ID 18, 7 bits, max numbered card : #98)

---

Mana Convergence
`OLD -> // Fun fact: NE_1 (Mana Convergence) does not use 0 prefix on Core/CoreKS.`

It sems to not be the case anymore fore CORE
ALT_CORE_B_NE_01_C -> works
ALT_CORE_B_NE_1_C -> 404
So i just refine the condition by removing "|| this.setCode ==2" and fix tests.
@Taum
Copy link
Copy Markdown
Owner

Taum commented Apr 4, 2026

We cannot do this because it breaks compatibility with existing encoded values.

A good first step would be to add a sanity check in the encoder to throw an error when trying to encode invalid values, instead of simply overflowing like it seems we're doing now. If you want to do this, it could be done quickly in a separate PR.

For OR_32, it was a design decision to save 1 bit on all Core cards, given that it is a token and not a card that can be put into a deck, we didn't have much interest in supporting it in the format.

For BR_64 it is more of a real issue. It might be worth raising on Discord where we have had the usual discussions, see: https://discord.com/channels/1236278362176225321/1275495634278944920 (invite: https://discord.gg/ypHKp7UefF)

For DUSTERTOP we have the same problem. A work-around could be to re-assign a value for encoding and support the existing value for decoding only. I suspect this is less widely used, so less of a problem.

@Taum
Copy link
Copy Markdown
Owner

Taum commented Apr 9, 2026

I just pushed an update to at least throw an error when encoding a family ID that's out of bounds:
8693633

Published as NPM package version 0.8.2

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