Add missing sets | Fix bit-length overflows | Fix Mana Convergence#8
Add missing sets | Fix bit-length overflows | Fix Mana Convergence#8On-Jin wants to merge 1 commit into
Conversation
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.
|
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 For For |
|
I just pushed an update to at least throw an error when encoding a family ID that's out of bounds: Published as NPM package version |
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)):
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.pywhich auto-discovers every set from the API. And generates test files intest/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.tsto round-trip every generated file.New sets added:
productfields to spec #1)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.