Skip to content

Conversation

@pflynn-virtru
Copy link
Member

This pull request adds support for V2 assertion schemas in the test infrastructure, improves SDK compatibility checks for assertion verification, and updates relevant tests to skip cases where the decrypt SDK cannot verify assertions due to unsupported schema versions. The changes ensure that tests are self-documenting and future-proof as SDKs evolve.

Scenario Schema Used Java/JS Can Verify? Test Behavior
Go (4.2.2) → Java/JS V1 ✅ Yes ✅ Runs
Go (4.3.0) → Java/JS V2 ❌ No ⏭️ Skips
Java/JS → Go V1 ✅ Yes ✅ Runs
Go → Go V1 or V2 ✅ Yes ✅ Runs

Assertion schema compatibility improvements

  • Added "assertion_schema_v2" to the feature_type list in xtest/tdfs.py to represent support for the V2 assertion schema.
  • Updated the _uncached_supports method in xtest/tdfs.py to declare that only the Go SDK currently supports the V2 assertion schema.
  • Introduced the skip_assertion_schema_skew function in xtest/tdfs.py, which inspects the encrypted TDF file and skips tests if the decrypt SDK does not support the assertion schema used. This makes compatibility checks dynamic and avoids hardcoding SDK support.

Test updates for schema compatibility

  • Updated test_tdf_assertions_unkeyed, test_tdf_assertions_with_keys, and test_tdf_assertions_422_format in xtest/test_tdfs.py to call skip_assertion_schema_skew after encryption, ensuring tests are skipped if assertion verification would fail due to incompatible schemas. [1] [2] [3] [4] [5]
  • Introduced skip_assertion_schema_skew to handle cases where the decrypt SDK does not support assertion schemas used by the encrypted TDF.
  • Consolidated target_mode usage to reduce redundancy.
  • Updated test logic to ensure assertion schema compatibility is verified.

- Introduced `skip_assertion_schema_skew` to handle cases where the decrypt SDK does not support assertion schemas used by the encrypted TDF.
- Consolidated `target_mode` usage to reduce redundancy.
- Updated test logic to ensure assertion schema compatibility is verified.
@pflynn-virtru pflynn-virtru requested review from a team as code owners October 20, 2025 16:56
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @pflynn-virtru, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the test infrastructure's ability to handle varying assertion schema versions across different SDKs. By introducing dynamic compatibility checks, it ensures that tests involving V2 assertion schemas (currently only supported by the Go SDK) are appropriately skipped when a decrypting SDK lacks support, preventing false failures and making the test suite more robust and self-documenting as SDK capabilities evolve.

Highlights

  • V2 Assertion Schema Support: Added assertion_schema_v2 to the feature_type literal and updated the _uncached_supports method to correctly reflect that only the Go SDK currently supports V2 assertion schemas.
  • Dynamic Schema Compatibility Checks: Introduced a new function, skip_assertion_schema_skew, which inspects the encrypted TDF file's manifest to determine the assertion schema version and dynamically skips tests if the decrypting SDK does not support that specific schema.
  • Test Suite Updates for Schema Compatibility: Integrated skip_assertion_schema_skew into test_tdf_assertions_unkeyed, test_tdf_assertions_with_keys, and test_tdf_assertions_422_format to ensure tests are skipped when assertion verification would fail due to incompatible schemas.
  • Code Refinement: Consolidated the usage of target_mode in several test functions to reduce redundancy and improve code clarity.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@pflynn-virtru pflynn-virtru changed the title Add support for skipping tests with unsupported assertion schemas Assertion capability tests using schema (manifest and assertion) Oct 20, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for V2 assertion schemas in the test infrastructure, enhancing SDK compatibility checks and updating tests to accommodate scenarios where the decrypt SDK cannot verify assertions due to unsupported schema versions. The changes include adding assertion_schema_v2 to the feature_type list, updating the _uncached_supports method, and introducing the skip_assertion_schema_skew function. The tests have been updated to call skip_assertion_schema_skew after encryption.

@pflynn-virtru pflynn-virtru changed the title Assertion capability tests using schema (manifest and assertion) feat: Assertion capability tests using schema (manifest and assertion) Oct 20, 2025
xtest/tdfs.py Outdated
case ("ns_grants", ("go" | "java")):
return True
case ("assertion_schema_v2", "go"):
# Go SDK supports V2 assertion schema (urn:opentdf:system:metadata:v2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do all supported versions support the v2 schema? You may want to add a feature detector to the go/cli.sh for this somehow, e.g. by adding a note to the appropriate otdfctl --help document.

Copy link
Member Author

@pflynn-virtru pflynn-virtru Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old versions do not support new assertions (v2, x509, non-DEK/PK)


# Unknown schema - be conservative and skip
else:
pytest.skip(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should fail on these, not skip. Perhaps log a message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does a feature check first, then it will only skip if not supported.

xtest/tdfs.py Outdated
Comment on lines 545 to 546
for assertion in m.assertions:
if assertion.id == "system-metadata":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for assertion in m.assertions:
if assertion.id == "system-metadata":
system_assertions = (a for a in m.assertions if a.id == "system-metadata")
for assertion in system_assertions:

@sonarqubecloud
Copy link

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.

3 participants