Skip to content

test(storage): verify v11 storage compatibility with binary fixtures - #117

Open
ncooke3 wants to merge 5 commits into
pb-swiftfrom
nc.storage.compat
Open

test(storage): verify v11 storage compatibility with binary fixtures#117
ncooke3 wants to merge 5 commits into
pb-swiftfrom
nc.storage.compat

Conversation

@ncooke3

@ncooke3 ncooke3 commented Sep 12, 2026

Copy link
Copy Markdown
Member

Summary

Ensure full data persistence backward compatibility between App Check 11.x (Objective-C) and App Check 12 (Swift port on pb-swift).

Changes

  • UserDefaults Compatibility:

    • Restored legacy GACAppCheckDebugTokenRegistered_<service>_<resource> registration check and write-back in AppCheckCoreDebugProvider.
    • Added documentation comments marking internal testing scope for storage keys and suite names.
    • Added hermetic pre-write cleanup in AppCheckCoreAppAttestKeyIDStorageTests.
    • Added unit test testLegacyRegisteredDebugTokenCompatibility.
  • Keychain Storage Compatibility:

    • Generated frozen v11 binary property list (bplist00) fixtures using historical Objective-C models compiled via clang without runtime symbol collision:
      • GACAppCheckStoredToken.bin (468 bytes)
      • GACAppAttestStoredArtifact.bin (457 bytes)
    • Added compatibility doc comments above @objc(...) class declarations in AppCheckCoreStoredToken and AppCheckCoreAppAttestStoredArtifact.
    • Exposed static keychainService contract constants on AppCheckCoreStorage ("com.google.app_check_core.token_storage") and AppCheckCoreAppAttestArtifactStorage ("com.firebase.app_check.app_attest_artifact_storage").
    • Added unarchiving unit tests in AppCheckCoreStoredTokenTests and AppCheckCoreAppAttestStoredArtifactTests.
  • Test Infrastructure & Tooling:

    • Resolved Swift Package Manager test fixture bundle lookup on macOS by including Bundle.module.
    • Added standalone generator script tools/generate_storage_fixtures.sh with -h/--help documentation and Git ref validation. Validated with shellcheck (0 warnings).

Fixture Footprint

These immutable binary fixtures represent frozen serialization contracts and add negligible disk overhead:

  • GACAppAttestStoredArtifact.bin: 457 bytes (~0.45 KB)
  • GACAppCheckStoredToken.bin: 468 bytes (~0.47 KB)
  • Combined size: 925 bytes (< 1 KB)
  • Typical Swift source file in AppCheckCore: 2.2 KB to 6.8 KB (fixtures are 5x to 15x smaller than individual source files)

Verification

  • swift test: 136 tests passed, 0 failures.
  • shellcheck tools/generate_storage_fixtures.sh: 0 warnings.
  • Code style verified with scripts/style.sh.

Document internal testing scope for UserDefaults keys and suite names, ensure hermetic cleanup in AppAttestKeyIDStorageTests, and add behavioral regression test verifying registered debug token key formatting and write-back.
…tests

Extract legacy Objective-C models from tag 11.0.0 via tools/generate_storage_fixtures.sh, commit serialized binary fixtures for GACAppCheckStoredToken and GACAppAttestStoredArtifact, and add unit tests verifying NSSecureCoding unarchiving and Keychain service contracts.
Add -h/--help documentation to generate_storage_fixtures.sh and validate that supplied Git tags exist and contain legacy Objective-C models.
Assert that missing properties return nil for cache miss self-healing, test programmatic corrupted payload handling, and verify runtime class names and property types for downgrade safety.
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.

1 participant