fix(xtest): Fix EC wrapping tests and add debugging guide#388
fix(xtest): Fix EC wrapping tests and add debugging guide#388dmihalcik-virtru wants to merge 6 commits intoopentdf:mainfrom
Conversation
Rename test fixture KAS names to align with CI workflow naming: - value1 -> alpha (port 8181, KASURL1) - value2 -> beta (port 8282, KASURL2) - attr -> gamma (port 8383, KASURL3) - ns -> delta (port 8484, KASURL4) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add shell scripts using tmux to run xtest integration tests locally, replacing the CI composite actions. Scripts structure: - local-test.sh: Main entry point (start/stop/status/attach/logs) - lib/common.sh: Shared config and utilities - lib/tmux-helpers.sh: tmux session management - services/docker-up.sh: Container management - services/platform-start.sh: Main platform service - services/kas-start.sh: Individual KAS instances - services/provision.sh: Keycloak + fixtures provisioning - setup/init-keys.sh: Cryptographic key generation - setup/trust-cert.sh: macOS certificate trust - cleanup.sh: Full teardown tmux session layout: - Window 0: control (status/commands) - Window 1: platform (port 8080) - Windows 2-5: kas-alpha/beta/gamma/delta (ports 8181-8484) - Windows 6-7: kas-km1/km2 (ports 8585-8686, key management) - Window 8: docker logs - Window 9: tests Co-Authored-By: Claude Opus 4.5 <[email protected]>
Summary of ChangesHello @dmihalcik-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 improves the stability and debuggability of the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe 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
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 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
|
|
There was a problem hiding this comment.
Code Review
This pull request significantly improves the xtest framework by addressing critical EC wrapping and key management issues, enhancing test reliability, and providing comprehensive debugging documentation. The changes ensure consistent root key handling across KAS instances, update the manifest schema for ec-wrapped KAOs, and introduce robust shell scripts for local environment management. The new AGENTS.md guide is a valuable addition for developers and AI agents, though some minor inconsistencies in tmux session and window names should be addressed for maximum clarity.
| ./local-test.sh | ||
|
|
||
| # This creates tmux session 'local-test' with windows: | ||
| # - platform: Main OpenTDF platform (port 8080) |
There was a problem hiding this comment.
The tmux session name mentioned here ('local-test') is inconsistent with the actual session name defined in xtest/scripts/lib/common.sh (xtest). Please update this to reflect the correct session name for consistency.
| # - platform: Main OpenTDF platform (port 8080) | |
| # This creates tmux session 'xtest' with windows: |
| # - alpha: KAS instance (port 8181) | ||
| # - beta: KAS instance (port 8282) | ||
| # - gamma: KAS instance (port 8383) | ||
| # - delta: KAS instance (port 8484) | ||
| # - km1: Key management KAS (port 8585) | ||
| # - km2: Key management KAS (port 8686) |
There was a problem hiding this comment.
The window names listed here (e.g., alpha, beta) do not match the actual window names created by tmux-helpers.sh (e.g., kas-alpha, kas-beta). Please update these descriptions to accurately reflect the window names for better guidance.
| # - alpha: KAS instance (port 8181) | |
| # - beta: KAS instance (port 8282) | |
| # - gamma: KAS instance (port 8383) | |
| # - delta: KAS instance (port 8484) | |
| # - km1: Key management KAS (port 8585) | |
| # - km2: Key management KAS (port 8686) | |
| # - platform: Main OpenTDF platform (port 8080) | |
| # - kas-alpha: KAS instance (port 8181) | |
| # - kas-beta: KAS instance (port 8282) | |
| # - kas-gamma: KAS instance (port 8383) | |
| # - kas-delta: KAS instance (port 8484) | |
| # - kas-km1: Key management KAS (port 8585) | |
| # - kas-km2: Key management KAS (port 8686) |
|
|
||
| ```bash | ||
| # Attach to tmux session | ||
| tmux attach -t local-test |
| # Or: Ctrl-B w (shows window list) | ||
|
|
||
| # Detach from tmux | ||
| # Ctrl-B d |
| **Debug**: | ||
| ```bash | ||
| # Check KAS logs for which key was used | ||
| tmux attach -t local-test |
| pkill -9 -f "opentdf-kas" | ||
|
|
||
| # Kill tmux session | ||
| tmux kill-session -t local-test |
|
|
||
| ### Individual KAS Restart | ||
| ```bash | ||
| # Attach to tmux |



Summary
Fixes test failures related to EC wrapping and key management by ensuring proper configuration and key consistency across KAS instances. Adds comprehensive debugging documentation for AI agents and developers working with the xtest framework.
Changes
1. Fix KAS Key Management Root Key Handling (
xtest/scripts/services/kas-start.sh)Problem: Key management KAS instances (km1, km2) were generating their own root keys instead of using the platform's root key. When the platform advertises a
base_keyfor EC wrapping, the SDK automatically uses EC wrapping, which derives keys fromroot_key + base_key. Different root keys resulted in "cipher: message authentication failed" errors during decrypt.Fix: Updated
kas-start.shto:opentdf-dev.yamlfor key management instancesImpact: Fixes 9 ABAC test failures that were failing with decrypt errors.
2. Update Manifest Schema (
xtest/manifest.schema.json)Problem: Manifest validation tests were failing because the schema only allowed
["wrapped", "remote"]as valid KAO types, but EC wrapping produces"ec-wrapped"type KAOs.Fix: Added
"ec-wrapped"to the enum of valid key access object types.Impact: Fixes 2 manifest validity test failures.
3. Add Comprehensive Debugging Guide (
AGENTS.md)New file: Created a 400+ line debugging guide documenting:
Purpose: Help AI agents (Haiku LLM) and developers debug test failures more efficiently by understanding the xtest framework architecture and common pitfalls.
4. Update .gitignore
Added
/xtest/logs/to prevent committing local test execution logs.Test Results
Before fixes: 25 passed, 18 failed, 8 skipped, 4 errors
After fixes: 38 passed, 8 failed, 8 skipped, 0 errors
The remaining 8 failures are legacy tests that require specific encryption keys used when creating golden TDFs (expected failures).
Example: Running a Specific Test
Related Issues
Checklist