Uh oh!
There was an error while loading. Please reload this page.
feat(docs): document WithPolicyFrom re-wrap helper - #323
Conversation
📝 WalkthroughWalkthroughThis pull request adds documentation for a new Go SDK function ChangesWithPolicyFrom Go SDK documentation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request adds documentation for the WithPolicyFrom function in the Go SDK, which allows binding a source TDF's policy to a new TDF. Feedback was provided regarding an inconsistency in the documentation concerning the Init(ctx) requirement for Reader.DataAttributes. Additionally, the example code contains a logic error where a return statement is missing after a validation check, and the SDK client variable naming is inconsistent with the rest of the document.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
❌ Surge preview build failed — no preview was deployed. Check the workflow logs for details. Once the build passes, the preview will be at: https://opentdf-docs-pr-323.surge.sh Common cause: If the build failed on vendored YAML validation, run the following locally and commit the result: |
Adds a tdf.mdx section for sdk.WithPolicyFrom, the option-builder helper landing as part of DSPX-2603. The function returns a TDFOption that binds the source TDF's policy (attribute FQNs) to a new TDF being created — useful in re-wrap pipelines where the policy should carry forward without callers handling base64+JSON manifest encoding. Demo output of the /docs-drift skill — example block is mined verbatim from the function's godoc, no inference. Section placed after IsValidTdf since both are re-wrap-flavored helpers. Skill's name-only sniff proposed a new with-policy-from.mdx file; placement overridden manually to match the existing tdf.mdx structure. Not for merge until the underlying sdk.WithPolicyFrom function lands in opentdf/platform. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
- Reader.Init is not required; DataAttributes reads from the manifest which LoadTDF already populated. Calling Init triggers an unnecessary KAS rewrap. - Add missing return after IsValidTdf check - Add error handling for LoadTDF - Use `client` instead of `s` for consistency with the rest of the page Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
e8f0d10 to
18221fcCompare❌ Surge preview build failed — no preview was deployed. Check the workflow logs for details. Once the build passes, the preview will be at: https://opentdf-docs-pr-323.surge.sh Common cause: If the build failed on vendored YAML validation, run the following locally and commit the result: |
❌ Surge preview build failed — no preview was deployed. Check the workflow logs for details. Once the build passes, the preview will be at: https://opentdf-docs-pr-323.surge.sh Common cause: If the build failed on vendored YAML validation, run the following locally and commit the result: |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/sdks/tdf.mdx`:
- Around line 636-642: The example incorrectly ignores the error from IsValidTdf
and mixes return types; update the IsValidTdf check so you first handle a
non-nil err (return that err) and only treat ok==false as "not a valid TDF"
(return nil to pass through); then call client.LoadTDF(file) and propagate its
err consistently (return err) so both failure paths return an error while the
non-TDF path returns nil; reference IsValidTdf, the ok and err variables, and
client.LoadTDF/file/reader when making the changes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Adds a
tdf.mdxsection forsdk.WithPolicyFrom, a newTDFOptionbuilder that binds the source TDF's policy — its attribute value FQNs — to a new TDF being created. Targets re-wrap pipelines where the source policy should carry forward without callers handling the manifest's base64 + JSON encoding themselves.Call site is a single line, matching the existing
With*option-builder idiom:Reader.Initis not required —DataAttributesreads the policy from the manifest, whichLoadTDFhas already populated.Companion PR
Documents the function landing in opentdf/platform#3476. Draft until that PR merges — the example references a symbol that doesn't exist in the SDK yet.
How this was drafted
Generated by the docs-drift skill mining the function's godoc example block verbatim. No example code was invented; the snippet shown is exactly what the function's author wrote in the godoc.
Test plan
tdf.mdxafterIsValidTdf, beforeBulkDecrypt)🤖 Generated with Claude Code
Summary by CodeRabbit
CreateTDFoperations.