Skip to content

chore(docs): restructure Policy page and extract Obligations#281

Merged
marythought merged 4 commits intomainfrom
chore/274-c-policy-restructure
Apr 8, 2026
Merged

chore(docs): restructure Policy page and extract Obligations#281
marythought merged 4 commits intomainfrom
chore/274-c-policy-restructure

Conversation

@marythought
Copy link
Copy Markdown
Contributor

@marythought marythought commented Apr 7, 2026

Summary

Major restructure of the Policy SDK page and extraction of Obligations.

preview:
https://opentdf-docs-pr-281.surge.sh/sdks/policy
https://opentdf-docs-pr-281.surge.sh/sdks/obligations

Policy Page

  • Add Setup section with client init and JsAuthNote
  • Add shared docs: Metadata, Pagination, Action (with standard actions), Condition Structure (SubjectSet → ConditionGroup → Condition)
  • Strip boilerplate from all inline examples and imported code samples
  • Add Signature → Parameters → Example → Returns to all 28 operations
  • Type reference tables for all policy objects
  • Go examples use actual import statements

Obligations Page (new)

  • Extracted from Policy (different service accessor, Go + JS only)
  • Full structured docs for 14 operations (Definitions, Values, Triggers)
  • Type references: Obligation, Obligation Value, Obligation Trigger

Part of #274 (task 4)

Test plan

  • Verify Policy page renders all operations with structured docs
  • Verify type reference tables and internal links
  • Verify Obligations page renders as standalone
  • Verify code examples have correct Go imports

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Restructured policy operation docs with consistent Signature, Parameters, and Returns sections; updated headings to imperative form (e.g., "Create …").
    • Simplified per-language examples (Go, Java, JavaScript) to focused call-site snippets and removed full client/auth boilerplate.
    • Improved list and filter examples and pagination guidance.
  • New Documentation
    • Added comprehensive Obligations guide covering objects, CRUD for obligations and values, trigger management, parameters, returns, and multi-language examples.

@marythought marythought requested review from a team as code owners April 7, 2026 16:31
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 944d1379-7e40-4fa3-b70d-660967bee561

📥 Commits

Reviewing files that changed from the base of the PR and between f10a1ba and 4b11b22.

📒 Files selected for processing (9)
  • code_samples/policy_code/create_attribute.mdx
  • code_samples/policy_code/create_namespace.mdx
  • code_samples/policy_code/create_subject_condition_set.mdx
  • code_samples/policy_code/create_subject_mapping.mdx
  • code_samples/policy_code/list_attributes.mdx
  • code_samples/policy_code/list_namespaces.mdx
  • code_samples/policy_code/list_subject_mapping.mdx
  • docs/sdks/obligations.mdx
  • docs/sdks/policy.mdx

📝 Walkthrough

Walkthrough

Standardized and simplified multiple policy-code MDX docs: added Signature/Parameters/Returns sections, replaced full client-setup examples with concise per-language call-site snippets for create/list operations, and added a new comprehensive Obligations API documentation page. All changes are documentation-only.

Changes

Cohort / File(s) Summary
Create operations
code_samples/policy_code/create_attribute.mdx, code_samples/policy_code/create_namespace.mdx, code_samples/policy_code/create_subject_condition_set.mdx, code_samples/policy_code/create_subject_mapping.mdx
Renamed section summaries; added Signature, Parameters, and Returns sections; replaced full main()/client-init boilerplate with concise SDK/service call snippets; added metadata/with-metadata variants where applicable.
List operations
code_samples/policy_code/list_attributes.mdx, code_samples/policy_code/list_namespaces.mdx, code_samples/policy_code/list_subject_mapping.mdx
Converted single-language end-to-end examples into tabbed per-language Signature snippets; added Parameters (filters, pagination) and Returns sections; simplified examples to iterate responses and removed inline auth/client initialization.
New Obligations API docs
docs/sdks/obligations.mdx
Added new MDX page documenting Obligations, Obligation Values, and Triggers with object schemas, method parameter/return tables, and Go/JavaScript examples for list/get/create/update/delete and trigger management.

Sequence Diagram(s)

(Skipped — documentation-only changes; no new multi-component control flow to visualize.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related PRs

Suggested reviewers

  • elizabethhealy
  • jp-ayyappan
  • eugenioenko

Poem

🐰 I hopped through docs to tidy the trail,
Signatures trimmed and examples made hale.
Boilerplate gone, the snippets now sing,
Obligations added — a neat little thing.
I nibble a carrot and do a small jig. 🥕🐇

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly reflects the main changes: restructuring the Policy documentation page and extracting Obligations into a separate page.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/274-c-policy-restructure

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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 standardizes the documentation for policy-related operations by introducing a consistent structure for signatures, parameters, examples, and return values across multiple MDX files. It also adds a comprehensive new guide for the Obligations service. The review feedback identifies several instances where Go and Java code snippets are missing essential imports, such as context, log, and java.util.Collections, which are required for the examples to be self-contained and executable.

Comment thread code_samples/policy_code/create_attribute.mdx
Comment thread code_samples/policy_code/create_namespace.mdx
Comment thread code_samples/policy_code/create_namespace.mdx
Comment thread docs/sdks/obligations.mdx
Comment thread docs/sdks/obligations.mdx
Comment thread code_samples/policy_code/create_subject_condition_set.mdx
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

📄 Preview deployed to https://opentdf-docs-pr-281.surge.sh

@marythought
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
code_samples/policy_code/list_attributes.mdx (1)

68-70: ⚠️ Potential issue | 🟠 Major

Imported Java example doesn't match documented parameters.

The parameter table documents namespaceId (UUID), state, pagination.limit, and pagination.offset, but the Java example uses .setNamespace(namespaceName) with a string name instead of a UUID and doesn't demonstrate pagination or state filtering. Update the Java example to align with the documented parameter contract, or update the parameter table to match what the example actually uses.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@code_samples/policy_code/list_attributes.mdx` around lines 68 - 70, The
imported Java example (ListAttributesExample in
`@site/code_samples/java/list-attributes.mdx`) doesn't match the documented
params—replace the current .setNamespace(namespaceName) usage with the
UUID-based parameter (e.g., .setNamespaceId(UUID.fromString(...)) or the method
that accepts a UUID), and add examples showing state filtering and pagination
(use the request builder/methods for state and
pagination.limit/pagination.offset) so the Java sample demonstrates namespaceId
(UUID), state, pagination.limit, and pagination.offset as documented;
alternatively, if the Java client API truly lacks UUID/ pagination/state params,
update the parameter table to reflect the actual Java method names/types
instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@code_samples/policy_code/create_attribute.mdx`:
- Line 40: The `values` field description is a sentence fragment; update the
`values` entry (type `[]string`) so it reads as a complete sentence—for example:
state that these are the initial values to create with the attribute and end
with a period, and follow with a separate complete sentence noting that values
can also be added later via the "Create an Attribute Value" link; update the
line in create_attribute.mdx for the `values` description accordingly so it
conforms to Vale prose style.

In `@code_samples/policy_code/create_subject_condition_set.mdx`:
- Around line 35-38: Update the parameter table to match the actual request
shape used in the examples by changing the top-level parameter name from
`subjectSets` to `subjectConditionSet.subjectSets` (or `subjectConditionSet`
with a nested `subjectSets` row if you prefer), and ensure the description and
"Required" flag reflect that `subjectSets` is nested under
`subjectConditionSet`; update the Parameter column entry and any example links
referencing `subjectSets` so they reference the nested path used by the examples
(look for `subjectConditionSet` and `subjectSets` in the file to locate where to
change).

In `@code_samples/policy_code/create_subject_mapping.mdx`:
- Around line 39-40: Update the parameter table so that both
`existingSubjectConditionSetId` and `newSubjectConditionSet` are marked as
conditional-required (e.g., change their "Yes*" status to indicate "Yes*" for
both), and adjust the description for each to state they are mutually exclusive
and required only when the other is absent (e.g., for
`existingSubjectConditionSetId` add "Required unless `newSubjectConditionSet` is
provided" and for `newSubjectConditionSet` add "Required unless
`existingSubjectConditionSetId` is provided; mutually exclusive"). Ensure the
symbols `existingSubjectConditionSetId` and `newSubjectConditionSet` are updated
in the table and descriptions to reflect this conditional-required semantics.
- Around line 67-70: The snippet assigns to err without declaration; change the
assignment to use a short variable declaration so Go compiles — replace the
current call to SubjectMapping.CreateSubjectMapping (the line with _, err =
client.SubjectMapping.CreateSubjectMapping(context.Background(),
subjectMapping)) with a short-declare form (using := for the returned values,
e.g., assigning the first return to _ and err via :=) so CreateSubjectMapping
and err are declared correctly before the subsequent log.Fatal(err) check.

In `@code_samples/policy_code/list_namespaces.mdx`:
- Around line 113-115: The example call to platform.v1.namespace.listNamespaces
uses the wrong enum string; change the state property in the object passed to
platform.v1.namespace.listNamespaces from 'ACTIVE_STATE_ENUM_INACTIVE' to one of
the documented values ('ACTIVE', 'INACTIVE', or 'ANY') so it matches the table
convention (e.g., set state: 'INACTIVE').

In `@docs/sdks/obligations.mdx`:
- Line 331: The `values` parameter description is a sentence fragment; update
the `values` row in the obligations table so the fragment becomes a full
sentence—e.g., change "Can also be added later via [Create Obligation
Value](`#create-obligation-value`)." to a complete sentence such as "They can also
be added later via [Create Obligation Value](`#create-obligation-value`)." Ensure
the `values` cell reads as one or two complete sentences and passes Vale linting
for docs.

---

Outside diff comments:
In `@code_samples/policy_code/list_attributes.mdx`:
- Around line 68-70: The imported Java example (ListAttributesExample in
`@site/code_samples/java/list-attributes.mdx`) doesn't match the documented
params—replace the current .setNamespace(namespaceName) usage with the
UUID-based parameter (e.g., .setNamespaceId(UUID.fromString(...)) or the method
that accepts a UUID), and add examples showing state filtering and pagination
(use the request builder/methods for state and
pagination.limit/pagination.offset) so the Java sample demonstrates namespaceId
(UUID), state, pagination.limit, and pagination.offset as documented;
alternatively, if the Java client API truly lacks UUID/ pagination/state params,
update the parameter table to reflect the actual Java method names/types
instead.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4df1c091-3551-4005-8d6e-63605a7760c1

📥 Commits

Reviewing files that changed from the base of the PR and between d999665 and 3340545.

📒 Files selected for processing (9)
  • code_samples/policy_code/create_attribute.mdx
  • code_samples/policy_code/create_namespace.mdx
  • code_samples/policy_code/create_subject_condition_set.mdx
  • code_samples/policy_code/create_subject_mapping.mdx
  • code_samples/policy_code/list_attributes.mdx
  • code_samples/policy_code/list_namespaces.mdx
  • code_samples/policy_code/list_subject_mapping.mdx
  • docs/sdks/obligations.mdx
  • docs/sdks/policy.mdx

Comment thread code_samples/policy_code/create_attribute.mdx
Comment thread code_samples/policy_code/create_subject_condition_set.mdx
Comment thread code_samples/policy_code/create_subject_mapping.mdx Outdated
Comment thread code_samples/policy_code/create_subject_mapping.mdx
Comment thread code_samples/policy_code/list_namespaces.mdx
Comment thread docs/sdks/obligations.mdx
Copy link
Copy Markdown
Contributor

@jp-ayyappan jp-ayyappan left a comment

Choose a reason for hiding this comment

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

LGTM

marythought and others added 4 commits April 8, 2026 12:56
- Add Setup section with client init for Go, Java, JS
- Add shared type docs: Metadata, Pagination, Action, Condition Structure
- Strip SDK init boilerplate from all examples and imported code samples
- Add Signature/Parameters/Example/Returns to all 28 Policy operations
- Add type reference tables: Namespace, Attribute, Attribute Value,
  Subject Condition Set (with full condition tree), Subject Mapping,
  Action, SubjectProperty
- Extract Obligations into own page with full structured docs for all
  14 operations and 3 type references

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use full ActiveStateEnum values in parameter tables (ACTIVE_STATE_ENUM_*)
- Fix subjectSets parameter path to subjectConditionSet.subjectSets
- Mark newSubjectConditionSet as Yes* (conditionally required)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@marythought marythought force-pushed the chore/274-c-policy-restructure branch from 34521e7 to 4b11b22 Compare April 8, 2026 19:56
@marythought marythought merged commit 2cacf47 into main Apr 8, 2026
7 of 9 checks passed
@marythought marythought deleted the chore/274-c-policy-restructure branch April 8, 2026 19:57
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.

2 participants