Skip to content

Add deterministic API snapshot comparison core - #15

Merged
geromet merged 3 commits into
mainfrom
feat/api-snapshot-diff-core
Sep 4, 2026
Merged

geromet merged 3 commits into
mainfrom
feat/api-snapshot-diff-core

Conversation

@geromet

@geromet geromet commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

Implements the first independently mergeable slice of #13: a deterministic, browser-independent comparator for two generated lua_api.json snapshots.

  • adds compare_api.py using the existing normalized extractor output rather than reparsing Java;
  • reports class add/remove plus inheritance/interface/exposure-state changes;
  • reports field add/remove/type/tag changes;
  • reports method add/remove/return/tag changes and recognizes an unambiguous parameter-signature change as changed while preserving overload additions;
  • reports global-function add/remove/structural changes;
  • requires explicit --old-id / --new-id snapshot identities instead of guessing build versions from paths/timestamps;
  • writes canonical JSON with stable ordering and schema_version;
  • documents the command in README;
  • adds dependency-free unittest coverage.

Verification

Executed locally in the automation Python runtime:

python -m unittest -v test_compare_api.py

Result: 7/7 tests passed.

Covered negative/control cases:

  • class add/remove and inheritance change;
  • field type and method return-type change;
  • unique parameter-signature change;
  • added overload leaves the existing overload untouched;
  • global add/remove/change;
  • unchanged input produces an empty diff;
  • semantically identical differently ordered input serializes byte-identically;
  • empty snapshot identity is rejected.

GitHub compare reports this branch 0 commits behind current main.

Remaining #13 work

This intentionally does not close #13. Remaining work includes integrating explicit build identity into generated snapshot metadata where appropriate, exercising the comparator against two real extracted builds, and adding the lightweight Changes viewer/report surface after the artifact contract is proven in repository use.

Refs #13

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.

Generate API change reports between extracted Project Zomboid builds

1 participant