Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.
This repository was archived by the owner on Jul 29, 2026. It is now read-only.

[S2] compress.py "lossless guarantee" is false — BoneToken.entry discarded on decode #50

Description

@erinepshovel-code

compress.py module docstring states:

Lossless guarantee: pt2 and metrics2 are token-for-token identical to the originals.

_dict_to_tok (the decode path) reconstructs BoneToken objects with entry={}:

BoneToken(..., entry={})   # raw canon dict always empty after decode

Five of the six BoneToken slots round-trip correctly (surface, normalized, bone_type, primary, families). The entry field (the raw canon dictionary for the matched bone) is set to empty dict on every decode.

Impact: Any consumer that reads token.entry after a compress/decompress cycle gets {} instead of the original canon entry. Downstream code that reconstructs features from token.entry silently produces empty or wrong results.

Fix options:

  1. Serialize entry into the compressed format and restore it on decode (accepts the size cost).
  2. Correct the docstring: "lossless for surface/normalized/bone_type/primary/families; entry must be re-resolved via canon lookup after decode."
  3. If entry is intentionally excluded for size, add a note directly on BoneToken that entry is not guaranteed to be populated after decode.

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions