Skip to content

feat(core): optional namespace in actions commands and re-enable actions/RR tests#775

Merged
elizabethhealy merged 29 commits intomainfrom
dspx-2540-add-namespaced-actions-support
Mar 25, 2026
Merged

feat(core): optional namespace in actions commands and re-enable actions/RR tests#775
elizabethhealy merged 29 commits intomainfrom
dspx-2540-add-namespaced-actions-support

Conversation

@elizabethhealy
Copy link
Copy Markdown
Member

@elizabethhealy elizabethhealy commented Mar 12, 2026

This pull request introduces a namespace flag for actions commands in the CLI, enhancing the uniqueness and organization of actions. It also re-enables previously disabled E2E tests and updates the documentation to reflect these changes.

Highlights

  • NamespaceFlag: The CLI commands for managing actions now have a namespace that can be specified. This change ensures that actions are unique within a given namespace, rather than globally unique.
  • E2E Tests Re-enabled: E2E tests for actions and registered resources have been re-enabled after incorporating the namespace requirement.
  • Documentation Updated: The documentation for actions commands has been updated to reflect the new namespace flag.

Summary by CodeRabbit

  • New Features

    • Actions are now namespaced; names must be unique within a namespace and a --namespace (-s) flag is supported across create/get/list/update/delete.
  • Bug Fixes

    • CLI action output now includes a Namespace column/row for get/list/create/update/delete.
  • Documentation

    • CLI docs and examples updated to require/illustrate --namespace and namespaced uniqueness.
  • Tests

    • E2E tests re-enabled and expanded to validate namespaced flows, lifecycle, and duplicate-name behavior.
  • Chores

    • Dependency version bumped and server-side namespace handling improved.

@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 introduces a namespace requirement for actions commands in the CLI, enhancing the uniqueness and organization of actions. It also re-enables previously disabled E2E tests and updates the documentation to reflect these changes.

Highlights

  • Namespace Requirement: The CLI commands for managing actions now require a namespace to be specified. This change ensures that actions are unique within a given namespace, rather than globally unique.
  • E2E Tests Re-enabled: E2E tests for actions and registered resources have been re-enabled after incorporating the namespace requirement.
  • Documentation Updated: The documentation for actions commands has been updated to reflect the new namespace requirement.

🧠 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.

Activity
  • Namespace flag added to action commands (get, list, create, delete, update).
  • E2E tests re-enabled for actions and registered resources.
  • Documentation updated to reflect namespace requirement.
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.

@elizabethhealy elizabethhealy changed the title feat(cli): require namespace in actions commands and re-enable actions/RR e2e paths feat(core): require namespace in actions commands and re-enable actions/RR e2e paths Mar 12, 2026
@elizabethhealy elizabethhealy changed the title feat(core): require namespace in actions commands and re-enable actions/RR e2e paths feat(core): require namespace in actions commands and re-enable actions/RR tests Mar 12, 2026
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 correctly adds the required namespace flag to all CLI actions commands and updates the underlying handlers and documentation. The E2E tests are also re-enabled and updated accordingly. My review includes a few suggestions to reduce code duplication in both the CLI command setup and the request handlers. I also found a potential bug in the UpdateAction handler where the new namespace parameter is not being used in the update request, which should be addressed.

Comment thread pkg/handlers/actions.go Outdated
Comment thread cmd/policy/actions.go Outdated
Comment thread pkg/handlers/actions.go Outdated
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 namespace support for policy actions by adding a required --namespace flag to all otdfctl policy actions CLI commands (get, list, create, update, delete). The changes include updating command definitions, modifying handler functions to accept and process the namespace (distinguishing between ID and FQN), and updating documentation and end-to-end tests. Review comments highlight opportunities to improve maintainability by extracting helper functions to reduce code duplication for both adding the namespace flag to CLI commands and for parsing the namespace string (UUID vs FQN) in the handler functions.

Comment thread cmd/policy/actions.go Outdated
Comment thread pkg/handlers/actions.go Outdated
@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

@elizabethhealy elizabethhealy marked this pull request as ready for review March 12, 2026 18:51
@elizabethhealy elizabethhealy requested review from a team as code owners March 12, 2026 18:51
@elizabethhealy
Copy link
Copy Markdown
Member Author

/gemini summary

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

This pull request introduces a fundamental change to how 'actions' are managed by enforcing a mandatory namespace requirement for all related CLI commands. This transition from globally unique actions to namespace-scoped actions significantly improves organization and prevents potential naming collisions. The changes also include the re-enabling and updating of end-to-end tests to validate the new behavior, alongside comprehensive documentation updates to guide users through the revised command structure.

Highlights

  • Namespace Requirement for Actions: All policy actions CLI commands (get, list, create, update, delete) now require a namespace to be specified, shifting from globally unique actions to namespace-scoped actions.
  • E2E Tests Re-enabled: Previously disabled end-to-end tests for actions and registered resources have been re-enabled and updated to reflect the new namespace requirement.
  • Documentation Updates: The documentation for policy actions commands has been updated to clearly describe the new namespace-scoped behavior and flag requirements.
  • Code Refactoring: Helper functions were introduced to reduce code duplication for consistent namespace handling and CLI flag injection across action commands.

🧠 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/actions.go
    • Modified policyGetAction to accept a namespace parameter, added validation for namespace when using name, and updated the underlying h.GetAction call.
    • Updated policyListActions to include a namespace parameter and modified the h.ListActions call.
    • Changed policyCreateAction to accept a namespace parameter and updated the h.CreateAction call.
    • Adjusted policyDeleteAction to pass empty strings for name and namespace to h.GetAction when only an ID is provided.
    • Added a new injectNamespaceFlag function to encapsulate the logic for adding the namespace flag to command documents.
    • Integrated injectNamespaceFlag into initActionsCommands for getDoc, listDoc, and createDoc to reduce code duplication.
  • docs/man/policy/actions/_index.md
    • Updated the description of custom actions to clarify that they are unique within a namespace, rather than globally unique.
  • docs/man/policy/actions/create.md
    • Added a required namespace flag with shorthand 's' and description 'Namespace ID or FQN'.
    • Revised the description of action names to state they must be unique within a namespace.
    • Updated the example command to include the --namespace flag.
  • docs/man/policy/actions/get.md
    • Added a namespace flag with shorthand 's' and description 'Namespace ID or FQN'.
    • Included a note stating that --namespace is required when using --name.
    • Updated the example command to include the --namespace flag.
  • docs/man/policy/actions/list.md
    • Added a required namespace flag with shorthand 's' and description 'Namespace ID or FQN'.
    • Updated the example command to include the --namespace flag.
  • docs/man/policy/actions/update.md
    • Updated the description for the name flag to indicate that it must be unique within a namespace.
  • e2e/actions.bats
    • Exported ACTION_NAMESPACE in setup_file for use in tests.
    • Modified run_otdfctl_action to automatically append --namespace $ACTION_NAMESPACE to commands.
    • Unset ACTION_NAMESPACE in teardown_file.
    • Removed skip directives from several tests, re-enabling them.
    • Updated command calls for UPDATE_ACTION_ID, STANDARD_ACTION, ACTION_TO_UPDATE, and DELETABLE_ACTION to explicitly include the --namespace flag.
  • e2e/registered-resources.bats
    • Updated CUSTOM_ACTION_ID and READ_ACTION_ID assignments in setup_file to include the --namespace flag.
    • Modified the policy actions delete call in teardown_file to include the --namespace flag.
    • Removed skip directives from several tests, re-enabling them.
  • go.mod
    • Updated the version of the github.com/opentdf/platform/protocol/go dependency to v0.17.1-0.20260312144647-bedc9b353661.
  • go.sum
    • Updated checksums for the github.com/opentdf/platform/protocol/go dependency to reflect the new version.
  • pkg/handlers/actions.go
    • Added a new private helper function getNamespaceIDAndFQN to determine if a given namespace string is an ID or an FQN.
    • Modified GetAction to accept a namespace parameter, utilize getNamespaceIDAndFQN, and populate req.NamespaceId and req.NamespaceFqn.
    • Updated ListActions to accept a namespace parameter, use getNamespaceIDAndFQN, and populate req.NamespaceId and req.NamespaceFqn.
    • Changed CreateAction to accept a namespace parameter, use getNamespaceIDAndFQN, and populate req.NamespaceId and req.NamespaceFqn.
    • Modified UpdateAction to return the updated policy.Action directly from the SDK response instead of making a subsequent GetAction call.
Activity
  • Gemini Code Assist provided an initial summary of changes and identified several areas for code improvement, including applying the DRY principle to flag injection and namespace parsing logic, and a potential bug in the UpdateAction handler.
  • The author, elizabethhealy, responded to one of Gemini's review comments, indicating a change was made.
  • Multiple automated test runs, posted by github-actions[bot], reported successful outcomes for various language builds and test suites.
  • The code improvements suggested by Gemini Code Assist, specifically the introduction of helper functions for flag injection and namespace parsing, were implemented in the pull request.

@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

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: 2

♻️ Duplicate comments (1)
e2e/actions.bats (1)

93-93: ⚠️ Potential issue | 🟡 Minor

Use run_otdfctl_action ... --json for these ID lookups.

These raw $(./otdfctl ... | jq ...) captures bypass the helper and make the failing lookup much harder to localize when one of these commands breaks. Please capture the JSON via run_otdfctl_action, assert_success, and then parse .id from $output.

💡 Example
-  UPDATE_ACTION_ID=$(./otdfctl policy actions get --name update --namespace "$ACTION_NAMESPACE" --json $HOST $WITH_CREDS | jq -r '.id')
+  run_otdfctl_action get --name update --namespace "$ACTION_NAMESPACE" --json
+    assert_success
+  UPDATE_ACTION_ID=$(echo "$output" | jq -er '.id')

Run the following script to confirm the helper exists and these lookups still bypass it:

#!/bin/bash
rg -n -C1 -F 'run_otdfctl_action ()' e2e/actions.bats
rg -n -C1 -F '=$(./otdfctl policy actions' e2e/actions.bats

Expected: the second search should return the remaining direct policy actions lookups at the lines called out above.

Also applies to: 156-156, 190-190, 196-196

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

In `@e2e/actions.bats` at line 93, Replace the raw capture of the otdfctl JSON
with the test helper: call run_otdfctl_action to run "./otdfctl policy actions
get --name update --namespace \"$ACTION_NAMESPACE\" --json $HOST $WITH_CREDS",
then call assert_success to ensure it succeeded and parse the ID from the
helper's $output (e.g. UPDATE_ACTION_ID=$(echo "$output" | jq -r '.id')). Do the
same replacement for the other direct captures flagged (the other policy actions
get invocations) so all JSON lookups use run_otdfctl_action + assert_success +
parsing from $output.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e/actions.bats`:
- Around line 60-63: Re-enable the e2e tests that assert failure when
--namespace is omitted and remove the passing list-without-namespace test by
making the namespace flag required for actions create and list; specifically
update the flag registration in cmd/policy/actions.go (the code that defines the
namespace flag for the "create" and "list" commands) to mark it required (or
return an error if missing) so the reinstated tests in e2e/actions.bats fail
when --namespace is not provided, then un-comment the failure-case in the e2e
test and delete/modify the passing list test that omits --namespace.

In `@e2e/registered-resources.bats`:
- Around line 25-28: The test currently resolves the "read" action globally and
may pick the wrong ID; update the lookup that sets READ_ACTION_ID to resolve
within the test namespace by passing the namespace flag (use the existing NS_ID)
to the otdfctl call that uses READ_ACTION_NAME and produces READ_ACTION_ID so
the command queries the namespace-scoped action; touch the
READ_ACTION_NAME/READ_ACTION_ID assignment (the otdfctl invocation that pipes to
jq -r '.id') to include the namespace flag so the test fetches the namespaced
action ID.

---

Duplicate comments:
In `@e2e/actions.bats`:
- Line 93: Replace the raw capture of the otdfctl JSON with the test helper:
call run_otdfctl_action to run "./otdfctl policy actions get --name update
--namespace \"$ACTION_NAMESPACE\" --json $HOST $WITH_CREDS", then call
assert_success to ensure it succeeded and parse the ID from the helper's $output
(e.g. UPDATE_ACTION_ID=$(echo "$output" | jq -r '.id')). Do the same replacement
for the other direct captures flagged (the other policy actions get invocations)
so all JSON lookups use run_otdfctl_action + assert_success + parsing from
$output.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ce270ff7-7295-41a0-83d2-5807991ff889

📥 Commits

Reviewing files that changed from the base of the PR and between 1a1be87 and 94feb41.

📒 Files selected for processing (3)
  • e2e/actions.bats
  • e2e/obligations.bats
  • e2e/registered-resources.bats

Comment thread e2e/actions.bats Outdated
Comment thread e2e/registered-resources.bats
Comment thread cmd/policy/actions.go Outdated
Comment thread cmd/policy/actions.go Outdated
Comment thread pkg/handlers/actions.go Outdated
Comment thread e2e/actions.bats
c-r33d
c-r33d previously approved these changes Mar 25, 2026
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.

♻️ Duplicate comments (3)
e2e/actions.bats (3)

33-44: ⚠️ Potential issue | 🟡 Minor

Make these cleanup paths fail closed.

The namespaced create path still scrapes the rendered table to find the ID, and the cleanup deletes here ignore run failure. If either step breaks, the test can leave actions behind and poison later runs. Create with --json, parse .id, and assert the delete succeeded.

💡 Example pattern
-  run_otdfctl_action create --name test_action_create_namespaced --namespace "$ACTION_NAMESPACE"
-    assert_output --partial "SUCCESS"
-    assert_line --regexp "Name.*test_action_create_namespaced"
-    assert_line --regexp "Namespace.*$ACTION_NAMESPACE"
-    assert_output --partial "Id"
-    assert_output --partial "Created At"
-    assert_line --partial "Updated At"
+  run_otdfctl_action create --name test_action_create_namespaced --namespace "$ACTION_NAMESPACE" --json
+    assert_success
+  assert_equal "$(echo "$output" | jq -r '.name')" "test_action_create_namespaced"
+  assert_equal "$(echo "$output" | jq -r '.namespace.fqn')" "$ACTION_NAMESPACE"

-  created_id=$(echo "$output" | grep Id | awk -F'│' '{print $3}' | xargs)
-  run_otdfctl_action delete --id $created_id --force
+  created_id=$(echo "$output" | jq -er '.id')
+  [ -n "$created_id" ]
+  run_otdfctl_action delete --id "$created_id" --force
+    assert_success

Verification: inspect the changed regions for table scraping and unasserted cleanup deletes. Expected: the script reports the table parse on Line 43 and cleanup deletes in these changed blocks.

#!/bin/bash
python - <<'PY'
from pathlib import Path

lines = Path("e2e/actions.bats").read_text().splitlines()
for lineno, line in enumerate(lines, 1):
    if 33 <= lineno <= 44 or 89 <= lineno <= 100:
        if "grep Id | awk" in line or "run_otdfctl_action delete --id" in line:
            print(f"{lineno}: {line}")
PY

Also applies to: 89-100

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

In `@e2e/actions.bats` around lines 33 - 44, The namespaced create path uses table
scraping to get the ID and the delete run ignores failures; change the create
invocation (run_otdfctl_action create --name test_action_create_namespaced
--namespace ...) to use --json output, extract the created id from the JSON
(parse the .id field) instead of grepping the table, and then call
run_otdfctl_action delete --id <parsed_id> --force while asserting the delete
command succeeded (fail the test if the delete run exits non‑zero or its output
is not the expected success marker). Ensure you update the ID variable
assignment to use the JSON parser and replace the unguarded delete invocation so
failures are asserted.

215-218: ⚠️ Potential issue | 🟠 Major

This negative delete test can pass for the wrong reason.

If the lookup on Line 215 returns null/empty, delete --id "$STANDARD_ACTION" still fails and assert_failure passes without ever exercising the "cannot delete standard action" path. Resolve the ID via run_otdfctl_action get --json, assert that lookup succeeded, and assert the returned ID is non-empty before the delete.

💡 Safer setup for the negative case
-  STANDARD_ACTION=$(./otdfctl policy actions get --name update --namespace "$ACTION_NAMESPACE" $HOST $WITH_CREDS --json | jq -r '.id')
+  run_otdfctl_action get --name update --namespace "$ACTION_NAMESPACE" --json
+    assert_success
+  STANDARD_ACTION=$(echo "$output" | jq -er '.id')
+  [ -n "$STANDARD_ACTION" ]
   run_otdfctl_action delete --id "$STANDARD_ACTION" --force
     assert_failure

Verification: inspect the negative delete case. Expected: the setup currently captures the ID via jq -r and only asserts that delete failed.

#!/bin/bash
python - <<'PY'
from pathlib import Path

lines = Path("e2e/actions.bats").read_text().splitlines()
for i in range(214, 219):
    print(f"{i}: {lines[i-1]}")
PY
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e/actions.bats` around lines 215 - 218, The negative delete test can pass
spuriously when STANDARD_ACTION is empty; change the setup to call
run_otdfctl_action get --json for the "update" action (instead of using otdfctl
policy actions get | jq -r) capture and parse the returned JSON to extract the
id, then assert the get call succeeded and that STANDARD_ACTION (the extracted
id variable) is non-empty before calling run_otdfctl_action delete --id
"$STANDARD_ACTION" --force; update the test to fail early if the lookup fails so
the delete assertion truly verifies the "cannot delete standard action" path.

11-11: ⚠️ Potential issue | 🟡 Minor

Fail fast when capturing IDs from otdfctl.

These bare $(./otdfctl ... | jq -r '.id') assignments can keep going with a null/empty ID and hide the real lookup/create failure behind the jq step. In the tests, prefer run_otdfctl_action ... --json + assert_success; in setup_file, at least use jq -er '.id' with pipefail so fixture setup aborts immediately.

Verification: inspect the remaining direct ./otdfctl ... | jq -r '.id' captures. Expected: Lines 11, 111, 181, and 221 are reported.

#!/bin/bash
python - <<'PY'
from pathlib import Path

path = Path("e2e/actions.bats")
for lineno, line in enumerate(path.read_text().splitlines(), 1):
    if "./otdfctl" in line and "jq -r '.id'" in line:
        print(f"{lineno}: {line}")
PY

Also applies to: 111-111, 181-181, 221-221

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

In `@e2e/actions.bats` at line 11, The setup assigns NS_ID using a subshell that
pipes otfdctl into jq -r '.id', which will silently produce empty/null IDs on
upstream failures; change these captures (e.g. the NS_ID export line and the
other direct captures at the reported locations) to fail-fast: in test helpers
use the existing run_otdfctl_action ... --json + assert_success pattern, and in
setup_file enable pipefail and use jq -er '.id' so jq fails on missing/null id,
ensuring the script aborts immediately on otfdctl failure rather than continuing
with a null ID.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@e2e/actions.bats`:
- Around line 33-44: The namespaced create path uses table scraping to get the
ID and the delete run ignores failures; change the create invocation
(run_otdfctl_action create --name test_action_create_namespaced --namespace ...)
to use --json output, extract the created id from the JSON (parse the .id field)
instead of grepping the table, and then call run_otdfctl_action delete --id
<parsed_id> --force while asserting the delete command succeeded (fail the test
if the delete run exits non‑zero or its output is not the expected success
marker). Ensure you update the ID variable assignment to use the JSON parser and
replace the unguarded delete invocation so failures are asserted.
- Around line 215-218: The negative delete test can pass spuriously when
STANDARD_ACTION is empty; change the setup to call run_otdfctl_action get --json
for the "update" action (instead of using otdfctl policy actions get | jq -r)
capture and parse the returned JSON to extract the id, then assert the get call
succeeded and that STANDARD_ACTION (the extracted id variable) is non-empty
before calling run_otdfctl_action delete --id "$STANDARD_ACTION" --force; update
the test to fail early if the lookup fails so the delete assertion truly
verifies the "cannot delete standard action" path.
- Line 11: The setup assigns NS_ID using a subshell that pipes otfdctl into jq
-r '.id', which will silently produce empty/null IDs on upstream failures;
change these captures (e.g. the NS_ID export line and the other direct captures
at the reported locations) to fail-fast: in test helpers use the existing
run_otdfctl_action ... --json + assert_success pattern, and in setup_file enable
pipefail and use jq -er '.id' so jq fails on missing/null id, ensuring the
script aborts immediately on otfdctl failure rather than continuing with a null
ID.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ef8f4795-a16f-4ccb-af7c-3e0599aa7cf8

📥 Commits

Reviewing files that changed from the base of the PR and between 1a1be87 and 19f8881.

📒 Files selected for processing (8)
  • cmd/policy/actions.go
  • e2e/actions.bats
  • e2e/obligations.bats
  • e2e/registered-resources.bats
  • pkg/handlers/actions.go
  • pkg/handlers/namespaces.go
  • pkg/handlers/obligations.go
  • pkg/handlers/registeredResources.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/handlers/namespaces.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • e2e/registered-resources.bats
  • pkg/handlers/actions.go
  • cmd/policy/actions.go

@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

X-Test Failure Report

test-cases-mapping-report
bats-test-results

Comment thread cmd/policy/actions.go Outdated
Comment thread cmd/policy/actions.go Outdated
Comment thread cmd/policy/actions.go Outdated
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.

♻️ Duplicate comments (1)
e2e/actions.bats (1)

43-45: ⚠️ Potential issue | 🟡 Minor

Assert cleanup deletions to avoid false-green tests.

Line 44, Line 57, Line 100, Line 190, Line 191, and Line 225 run cleanup deletes without validating success. If cleanup fails, later tests can be polluted by leftover actions.

Suggested fix
   run_otdfctl_action delete --id "$created_id" --force
+    assert_success

   run_otdfctl_action delete --id "$created_id" --force
+    assert_success

   run_otdfctl_action delete --id "$conflict_action_id" --force
+    assert_success

   run_otdfctl_action delete --id "$created_id" --force
+    assert_success
   run_otdfctl_action delete --id "$created_id_2" --force
+    assert_success

   run_otdfctl_action delete --id "$ACTION_TO_UPDATE" --force
+    assert_success

Also applies to: 56-57, 99-101, 190-191, 225-226

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

In `@e2e/actions.bats` around lines 43 - 45, The cleanup delete commands (the
lines that set created_id and call run_otdfctl_action delete --id $created_id
--force) must be asserted so failures don't leave leftover resources: capture
the delete command's exit status/output and add an assertion that it succeeded
(e.g., check $status is 0 or that the delete output contains an expected success
message), and optionally verify the resource is gone by listing/getting the id
and asserting it is not present; apply this change to every cleanup delete
invocation that uses created_id or run_otdfctl_action delete (the occurrences
around lines 44, 56-57, 99-101, 190-191, 225-226) so each delete is validated.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@e2e/actions.bats`:
- Around line 43-45: The cleanup delete commands (the lines that set created_id
and call run_otdfctl_action delete --id $created_id --force) must be asserted so
failures don't leave leftover resources: capture the delete command's exit
status/output and add an assertion that it succeeded (e.g., check $status is 0
or that the delete output contains an expected success message), and optionally
verify the resource is gone by listing/getting the id and asserting it is not
present; apply this change to every cleanup delete invocation that uses
created_id or run_otdfctl_action delete (the occurrences around lines 44, 56-57,
99-101, 190-191, 225-226) so each delete is validated.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 38c51c94-59f6-4dee-b241-b76e649139a8

📥 Commits

Reviewing files that changed from the base of the PR and between 19f8881 and 8c13444.

📒 Files selected for processing (1)
  • e2e/actions.bats

c-r33d
c-r33d previously approved these changes Mar 25, 2026
@github-actions
Copy link
Copy Markdown

X-Test Failure Report

test-cases-mapping-report
bats-test-results

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.

🧹 Nitpick comments (1)
cmd/policy/actions.go (1)

187-194: Optional cleanup: cache the namespace doc flag once in helper.

This reduces repeated lookups and makes the helper easier to scan.

♻️ Suggested refactor
 func injectNamespaceFlag(doc *man.Doc) {
+	nsFlag := doc.GetDocFlag("namespace")
 	doc.Flags().StringP(
-		doc.GetDocFlag("namespace").Name,
-		doc.GetDocFlag("namespace").Shorthand,
-		doc.GetDocFlag("namespace").Default,
-		doc.GetDocFlag("namespace").Description,
+		nsFlag.Name,
+		nsFlag.Shorthand,
+		nsFlag.Default,
+		nsFlag.Description,
 	)
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/policy/actions.go` around lines 187 - 194, Cache the result of
doc.GetDocFlag("namespace") into a local variable inside injectNamespaceFlag and
use that variable's Name, Shorthand, Default, and Description fields when
calling doc.Flags().StringP; this avoids calling doc.GetDocFlag("namespace")
multiple times and makes injectNamespaceFlag easier to read (reference:
injectNamespaceFlag and doc.GetDocFlag("namespace")).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@cmd/policy/actions.go`:
- Around line 187-194: Cache the result of doc.GetDocFlag("namespace") into a
local variable inside injectNamespaceFlag and use that variable's Name,
Shorthand, Default, and Description fields when calling doc.Flags().StringP;
this avoids calling doc.GetDocFlag("namespace") multiple times and makes
injectNamespaceFlag easier to read (reference: injectNamespaceFlag and
doc.GetDocFlag("namespace")).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 03a645c4-ea9b-4708-a71a-5060522eada6

📥 Commits

Reviewing files that changed from the base of the PR and between 8c13444 and 43daf53.

📒 Files selected for processing (1)
  • cmd/policy/actions.go

@github-actions
Copy link
Copy Markdown

@elizabethhealy elizabethhealy merged commit 29a2eb1 into main Mar 25, 2026
22 checks passed
@elizabethhealy elizabethhealy deleted the dspx-2540-add-namespaced-actions-support branch March 25, 2026 15:54
alkalescent pushed a commit that referenced this pull request Mar 31, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.30.0](v0.29.0...v0.30.0)
(2026-03-31)


### Features

* **core:** Add optional namespace flag for subject mappings and
condtion sets ([#779](#779))
([9e849c4](9e849c4))
* **core:** add scope support for client creds
([#752](#752))
([9ca9e43](9ca9e43))
* **core:** migrate registered resources
([#772](#772))
([2b49a7d](2b49a7d))
* **core:** optional namespace in actions commands and re-enable
actions/RR tests ([#775](#775))
([29a2eb1](29a2eb1))
* **core:** support namespaced registered resources
([#767](#767))
([4d786b5](4d786b5))


### Bug Fixes

* **ci:** Temporarily skip namespaced-actions impacted BATS cases
([#773](#773))
([633728a](633728a))
* **core:** bump toolchain to go 1.24.13
([#747](#747))
([6804b93](6804b93))
* **core:** disable RR E2E tests
([#768](#768))
([0821b8c](0821b8c))
* **core:** make namespacing registered resources optional
([#785](#785))
([8e6eb31](8e6eb31))
* **core:** refactor `ListAttributesValues` to use `Get`
([#769](#769))
([a82f7b7](a82f7b7))
* **core:** unsafe update result output values order
([#759](#759))
([baeba0f](baeba0f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
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