Skip to content

feat(core): Make namespacing subject mappings and condition sets optional#776

Open
c-r33d wants to merge 2 commits intomainfrom
ns-scs-sm
Open

feat(core): Make namespacing subject mappings and condition sets optional#776
c-r33d wants to merge 2 commits intomainfrom
ns-scs-sm

Conversation

@c-r33d
Copy link
Copy Markdown
Contributor

@c-r33d c-r33d commented Mar 13, 2026

1.) Optionally allows a customer to namespace a subject mapping or subject condition set. The requirement will be driven by the server
2.) Pin to a platform feature branch to unravel the circular deps.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 enhances the policy management system by introducing optional namespacing for subject mappings and subject condition sets. This change provides users with the flexibility to organize and manage these policy components within defined namespaces, improving clarity and control, especially in complex environments. The updates span across CLI commands, internal handling logic, and documentation to seamlessly integrate this new capability.

Highlights

  • Optional Namespacing: Introduced an optional 'namespace' flag for the creation of subject mappings and subject condition sets, allowing users to associate these entities with a specific namespace.
  • CLI Command Updates: Updated the otdfctl policy subject-condition-set create and otdfctl policy subject-mapping create commands to accept and process the new optional --namespace flag.
  • Handler Logic Enhancement: Modified the internal handler functions to correctly parse the provided namespace (as either an ID or FQN) and include it in the respective creation requests to the backend service.
  • Documentation Updates: Updated the CLI documentation for subject condition set and subject mapping creation commands to reflect the new namespace flag and provide usage examples.
  • Dependency Update: Updated the github.com/opentdf/platform/protocol/go dependency to a newer version.

🧠 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
  • cmd/policy/subjectConditionSets.go
    • Added an optional 'namespace' flag to the createSubjectConditionSet command.
    • Modified the call to CreateSubjectConditionSet to pass the new namespace.
    • Included namespace FQN in the output display if a namespace is present.
  • cmd/policy/subjectMappings.go
    • Added an optional 'namespace' flag to the policyCreateSubjectMapping command.
    • Modified the call to CreateNewSubjectMapping to pass the new namespace.
    • Included namespace FQN in the output display if a namespace is present.
  • docs/man/policy/subject-condition-sets/create.md
    • Documented the new 'namespace' flag for the create command.
    • Updated example usage to include the --namespace flag.
  • docs/man/policy/subject-mappings/create.md
    • Documented the new 'namespace' flag for the create command.
    • Updated example usage to include the --namespace flag.
  • go.mod
    • Updated the version of github.com/opentdf/platform/protocol/go.
  • go.sum
    • Updated checksums for the github.com/opentdf/platform/protocol/go dependency.
  • pkg/handlers/subjectConditionSets.go
    • Modified the CreateSubjectConditionSet function signature to accept a namespace string.
    • Implemented logic to parse the namespace into an ID or FQN and include it in the creation request.
  • pkg/handlers/subjectmappings.go
    • Imported the github.com/google/uuid package.
    • Added a parseNamespaceIDOrFQN helper function to distinguish between namespace ID and FQN.
    • Modified the CreateNewSubjectMapping function signature to accept a namespace string.
    • Implemented logic to parse the namespace into an ID or FQN and include it in the creation request.
Activity
  • No specific activity (comments, reviews, progress) has been recorded for this pull request yet.
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.

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 introduces optional namespacing for subject mappings and condition sets, which is a valuable feature. The implementation is straightforward, adding a namespace flag to the relevant CLI commands and passing it through to the backend services. The documentation has also been updated accordingly. I've identified a couple of areas for improvement related to code duplication and configuration consistency, which I've detailed in the comments.

flags:
- name: namespace
description: Optional namespace ID or FQN for the subject mapping and any newly created subject condition set
required: false
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with other flag definitions (like in docs/man/policy/subject-condition-sets/create.md), it's best to explicitly add default: '' for the optional namespace flag. While the behavior might be correct without it due to zero-value defaults, explicitly defining it improves the clarity and robustness of the command definition parsing.

Suggested change
required: false
required: false
default: ''

Comment on lines +53 to +60
if namespace != "" {
namespaceID, namespaceFQN := parseNamespaceIDOrFQN(namespace)
if namespaceID != "" {
req.NamespaceId = namespaceID
} else {
req.NamespaceFqn = namespaceFQN
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This logic for setting the namespace on the request is duplicated in pkg/handlers/subjectConditionSets.go. To improve maintainability and avoid future bugs, consider extracting this logic into a private helper function within the handlers package. This function could be used in both CreateNewSubjectMapping and CreateSubjectConditionSet to centralize the namespace handling.

@github-actions
Copy link
Copy Markdown

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.

1 participant