Skip to content

feat(ACLs): Add missing acls: simulatorsAcl, cogUnitsAcl, appHostingAcl, chartsAdminAcl#2693

Open
haakonvt wants to merge 2 commits into
masterfrom
add-missing-acls
Open

feat(ACLs): Add missing acls: simulatorsAcl, cogUnitsAcl, appHostingAcl, chartsAdminAcl#2693
haakonvt wants to merge 2 commits into
masterfrom
add-missing-acls

Conversation

@haakonvt

Copy link
Copy Markdown
Contributor

No description provided.

@haakonvt haakonvt requested review from a team as code owners June 16, 2026 22:09

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request adds several new capability access control lists (ACLs) including AppHostingAcl, ChartsAdminAcl, CogUnitsAcl, and SimulatorsAcl, along with the AppExternalIdScope scope class and corresponding unit tests. The feedback suggests implementing a post_init method in AppExternalIdScope to convert external_ids to strings, ensuring type safety and consistency with other scope classes in the codebase.

Comment on lines +545 to +551
@dataclass(frozen=True)
class AppExternalIdScope(Capability.Scope):
_scope_name = "appExternalIdScope"
external_ids: list[str]

def as_tuples(self) -> set[tuple[str, str]]:
return {(self._scope_name, s) for s in self.external_ids}

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.

high

To ensure type safety and prevent comparison failures in compare_capabilities (e.g., if external IDs are parsed as integers or other types), convert external_ids to strings in a __post_init__ method. This is consistent with other scopes like PostgresGatewayUsersScope and DataSetScope.

Suggested change
@dataclass(frozen=True)
class AppExternalIdScope(Capability.Scope):
_scope_name = "appExternalIdScope"
external_ids: list[str]
def as_tuples(self) -> set[tuple[str, str]]:
return {(self._scope_name, s) for s in self.external_ids}
@dataclass(frozen=True)
class AppExternalIdScope(Capability.Scope):
_scope_name = "appExternalIdScope"
external_ids: list[str]
def __post_init__(self) -> None:
object.__setattr__(self, "external_ids", [str(i) for i in self.external_ids])
def as_tuples(self) -> set[tuple[str, str]]:
return {(self._scope_name, s) for s in self.external_ids}
References
  1. Consistency: Follow established patterns across the codebase (e.g., converting list elements to their expected type in post_init as done in other scopes like PostgresGatewayUsersScope and DataSetScope). (link)

@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.66%. Comparing base (aa2316c) to head (b4d8e86).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
cognite/client/data_classes/capabilities.py 98.07% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2693      +/-   ##
==========================================
- Coverage   93.68%   93.66%   -0.03%     
==========================================
  Files         498      498              
  Lines       50391    50443      +52     
==========================================
+ Hits        47209    47246      +37     
- Misses       3182     3197      +15     
Files with missing lines Coverage Δ
.../tests_unit/test_data_classes/test_capabilities.py 100.00% <ø> (ø)
cognite/client/data_classes/capabilities.py 97.00% <98.07%> (+0.05%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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