Skip to content

Update agent policy and rule workspace handling#99

Open
qasim-nylas wants to merge 10 commits into
mainfrom
ps/cli-workspace-policy-rules
Open

Update agent policy and rule workspace handling#99
qasim-nylas wants to merge 10 commits into
mainfrom
ps/cli-workspace-policy-rules

Conversation

@qasim-nylas
Copy link
Copy Markdown
Collaborator

No description provided.

sourcesoft and others added 3 commits May 21, 2026 16:26
- Migrate agent integration tests to the workspace model: attach policies
  and rules via UpdateWorkspace and assert on workspace.PolicyID /
  workspace.RulesIDs instead of grant settings.policy_id / policy.rules.
  The policy.rules helpers are kept only for the non-agent (detached)
  policy exercised by the mixed-scope safety test.
- Show "Workspace ID" in `nylas agent account list` (parity with
  create/get/update); update docs/commands/agent.md example.
- Remove the legacy no-workspace fallback paths (attachRuleToPolicy,
  detachRuleFromPolicies, rollbackPolicyRuleUpdates,
  policiesLeftEmptyByRuleRemoval, refreshPolicies, buildRuleRefsByID shim,
  hasWorkspaceRefs branch, AllAgentPolicies scope field) now that the Nylas
  API backend performs that fallback server-side. Fail loud when an agent
  account has no workspace instead of silently no-oping rule create/delete.
  The cross-scope "shared with a non-agent policy" safety check is kept.
@qasim-nylas qasim-nylas requested a review from AaronDDM May 28, 2026 22:58
AaronDDM
AaronDDM previously approved these changes May 28, 2026
Copy link
Copy Markdown
Collaborator

@AaronDDM AaronDDM left a comment

Choose a reason for hiding this comment

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

LGTM 👍

… /v3/policies

- account list/status: resolve and display policy_id from workspace
- policy list: list all policies from /v3/policies with workspace refs
- Remove --all flag and resolveAgentAccountWorkspacePolicy (no longer needed)
…elete)

- Add ListWorkspaces, CreateWorkspace, DeleteWorkspace to port/adapter
- Add CreateWorkspaceRequest domain type
- Wire up nylas workspace CLI with aliases (workspaces, ws)
…rkspaces

- Remove --policy-id from account create and rule commands
- Remove --all from policy list and rule list
- Rules route through workspace rules_ids[] directly, not via policies
- Policy list and rule list call /v3/policies and /v3/rules directly
- Simplify detachRuleFromAgentWorkspaces to accept []policyAgentAccountRef
- Add rollback on delete failure, strict error variant for mutation paths
- Fix Air handlers to surface workspace fetch errors as 500s
- Fix RuleAction.Value any-type print handling
- Add workspace dedup in buildWorkspacePolicyRefs/buildWorkspaceRuleRefsStrict
- Validate workspace update requires at least one flag
- Update docs and integration tests to match new workspace flow
- Fix auth list regression test for changed error message
- Update agent-policy.md to remove --all flag and --policy-id on create
- Fix resolvePolicyForAgentOps error message referencing removed --all flag
- Add workspace package unit tests for command structure and flags
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.

3 participants