chore(examples): wrap file I/O errors with context#3141
Conversation
Adds an integration test verifying that when using the Keycloak ERS, subject mapping selectors must match the Keycloak user object structure rather than raw JWT claim names. Custom Keycloak user attributes are nested under `.attributes.<name>[]` in the resolved user object, so a selector like `.department` will not match even when the JWT contains `"department": "Finance"`. The correct selector is `.attributes.department[]`. This test was motivated by a community discussion (orgs/opentdf/discussions/3115) where a user experienced decryption failures due to this mismatch. The test spins up a real Keycloak container, creates a user with a custom attribute, and asserts both the correct and incorrect selector behaviors explicitly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
Addresses code review feedback by splitting the two subject mapping assertions into t.Run sub-tests for clearer output and more granular test results. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…havior Documents that `.department` matches when ERS is configured with mode: "claims" (entity is JWT private claims), whereas the correct selector for Keycloak ERS (default) is `.attributes.department[]`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Expand TestClaimsERSSubjectMapping to cover both multi-valued OFF (string claim → .department) and multi-valued ON (array claim → .department[]) mapper configurations - Add nolint:unparam to buildAttributeSubjectMapping so the parameter remains available for future callers with different FQNs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace manual setupKeycloakContainer + extended 60s retry block + initializeKeycloakClient + createTestRealm calls with a single adapter.SetupTestData call, matching the pattern used in TestKeycloakEntityResolutionV2. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
Bare os.Open/os.Create/os.ReadDir errors gave no indication of which file failed or what operation was attempted. Wrap with fmt.Errorf so errors like "permission denied" include the file path and operation. Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
Summary of ChangesHello, 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 primarily focuses on improving the diagnostic capabilities of file I/O operations within 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. Changelog
Activity
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. Error, vague and bare, Context added, path made clear, Debugging light. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces two distinct sets of changes. The first, as described, wraps file I/O errors in the example command-line tools with additional context, which improves error diagnostics. The second, larger change adds new integration tests for the Entity Resolution Service (ERS) subject mapping functionality. These tests clarify and verify the behavior of subject mapping selectors for both 'claims' mode and the default 'keycloak' mode. While the error wrapping is a good improvement and the new tests are valuable for documenting and ensuring the correctness of the subject mapping feature, it would be better to split these unrelated changes into separate pull requests for clarity and easier review, as the current PR title and description are misleading.
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
X-Test Failure Report✅ go-v0.9.0 |
These tests are unrelated to this PR and belong in a separate change. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
## Summary - Adds File Permission Errors section to `getting-started/managing-platform` troubleshooting — covers Docker volume ownership mismatches, unreadable `/etc/resolv.conf`/`/etc/hosts`, and install directory permissions. Documents the `"server misbehaving"` gRPC error as a common symptom. - Adds File Permission Errors section to `sdks/troubleshooting` — covers SDK-level file I/O errors with cross-reference to the platform guide - Adds home directory writability check to `check.sh` - Adds Linux file permission troubleshooting callout to the quickstart "Need Help?" section Platform examples to be merged in: opentdf/platform#3141 ## Test plan - [ ] Verify surge preview renders new troubleshooting sections in both pages - [ ] Confirm anchor link `/getting-started/managing-platform#file-permission-errors-linux` resolves correctly - [ ] Run `check.sh` and confirm new home directory check appears in output 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Mary Dickson <mary.dickson@virtru.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
encrypt.go: wrapos.Createerror to include the output file pathdecrypt.go: wrapos.ReadDirandos.Openerrors to include the file/directory pathBare errors from these calls gave no indication of which file failed or what operation was attempted, making permission errors and similar issues difficult to diagnose.
Test plan
go test ./examples/...passesgolangci-lint run ./examples/...passes (pre-existing deprecation warning inexamples.gois unrelated)🤖 Generated with Claude Code