Skip to content

Commit 6d3a43c

Browse files
committed
update
1 parent 46d1324 commit 6d3a43c

109 files changed

Lines changed: 2073 additions & 9881 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agent/naming-audit/abacpolicies.md

Lines changed: 15 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
**Path:** `packages/abacpolicies/src/v1/`
44
**Versions audited:** v1
55
**Inferred domain:** Attribute-Based Access Control (ABAC) policies on Unity Catalog securables — create/get/list/update/delete row-filter and column-mask policies.
6-
**Total weird names flagged:** 26
6+
**Total weird names flagged:** 13
77

88
## Summary
99
| Severity | Count |
1010
| --- | --- |
11-
| High | 5 |
12-
| Medium | 12 |
13-
| Low | 5 |
11+
| High | 3 |
12+
| Medium | 2 |
13+
| Low | 4 |
1414
| Observation | 4 |
1515

1616
## High severity
@@ -27,143 +27,65 @@
2727
- **Suggested name:** Keep the name but type it `SecurableType`.
2828
- **Rationale:** Same field name with two different types across four request DTOs forces callers to remember which one is loose. This is almost certainly a generator bug worth flagging upstream.
2929

30-
### 3. `onSecurableFullname``src/v1/model.ts:66,94,103,150,234`
31-
- **Why weird:** `fullname` is one un-camelCased word. Should be `fullName` to match field-naming conventions used everywhere else in the same model (`functionName`, `pageToken`, etc.).
32-
- **Category:** 3 (acronym/casing inconsistency — `name` is one word and should follow camelCase, so `Fullname` is wrong).
33-
- **Suggested name:** `onSecurableFullName` (wire stays `on_securable_fullname`).
34-
- **Rationale:** Internal consistency. JS/TS convention treats `fullName` as two words; the Go SDK collapses `Fullname` but TS shouldn't blindly inherit that.
35-
36-
### 4. `MatchColumn``src/v1/model.ts:130`
30+
### 3. `MatchColumn``src/v1/model.ts:130`
3731
- **Why weird:** Reads as a verb (`MatchColumn`) — could be a method or a type. The field that uses it is plural (`matchColumns: MatchColumn[]`), which then reads as "match columns are an array of `MatchColumn`", and a `MatchColumn` is actually a "column matcher / condition + alias pair".
3832
- **Category:** 6 (misleading verb-as-noun), 9 (singular noun whose meaning is unclear).
3933
- **Suggested name:** `ColumnMatcher` or `ColumnMatchCondition`.
4034
- **Rationale:** Type names should be nouns; the verb form misleads. `ColumnMatcher` makes `matchColumns: ColumnMatcher[]` clearly read as "the matchers".
4135

42-
### 5. `forSecurableType` / `onSecurableType` field prefixes — `src/v1/model.ts:145,170`
43-
- **Why weird:** Two different prefixes for related concepts on the same struct: `on_securable_type` and `for_securable_type`. The `on`/`for` split (carrier vs. target securable) is subtle and easily confused. Field names alone do not communicate which is which.
44-
- **Category:** 1 (vague — the preposition does the disambiguation), 6 (misleading without docs).
45-
- **Suggested name:** Rename `forSecurableType` to `appliesToSecurableType` (or similar) and `onSecurableType` to `definedOnSecurableType` to make the distinction explicit.
46-
- **Rationale:** A user reading the type should not have to consult the JSDoc to tell `for` from `on`. These names sit beside each other and look interchangeable.
47-
4836
## Medium severity
4937

50-
### 6. `SecurableType.STAGING_TABLE``src/v1/model.ts:33`
38+
### 4. `SecurableType.STAGING_TABLE``src/v1/model.ts:33`
5139
- **Why weird:** Enum value pinned by a comment that says it isn't a real securable yet: "TODO: [UC-2980] Staging tables aren't full-fleged securables yet." Internal TODOs in generated SDK enums leak abstraction.
5240
- **Category:** 18 (questionable enum value).
5341
- **Suggested name:** Remove until it actually is a securable, or mark `@experimental`.
5442
- **Rationale:** Public SDK enums shouldn't contain TODO-tagged speculative values.
5543

56-
### 7. `ColumnMaskOptions.using: FunctionArgument[]``src/v1/model.ts:54`
57-
- **Why weird:** Field named `using` — a SQL reserved word and a generic preposition. Doesn't say what is being used.
58-
- **Category:** 1 (vague), 10 (reserved-word-adjacent — `using` is a reserved-context keyword in JS dynamic import / TS).
59-
- **Suggested name:** `extraArguments` / `additionalArguments` / `argumentList`.
60-
- **Rationale:** `using` on its own carries no semantic load; readers must consult the doc to find out it's "additional positional args". Also appears on `RowFilterOptions` (model.ts:227) with the same problem.
61-
62-
### 8. `ColumnMaskOptions.onColumn``src/v1/model.ts:49`
63-
- **Why weird:** Preposition-prefixed field name (`onColumn`) that just identifies the masked column. Inconsistent with `functionName` (also on the same type, no preposition).
64-
- **Category:** 1 (vague), 17 (inconsistency).
65-
- **Suggested name:** `maskedColumnAlias` or `targetColumnAlias`.
66-
- **Rationale:** Names should describe what the field *is*, not its prepositional relationship.
67-
68-
### 9. `FunctionArgument.arg` discriminator field — `src/v1/model.ts:76`
69-
- **Why weird:** `FunctionArgument` has a field `arg` (one of two variants). Type name and field name are near-duplicates; the field name is also an abbreviation of the type.
70-
- **Category:** 5 (cryptic abbreviation), 11 (near-duplicate naming).
71-
- **Suggested name:** Rename the field to `value` or `kind`.
72-
- **Rationale:** `functionArgument.arg.$case === 'alias'` reads weirdly; the field name repeats an abbreviation of the type name.
73-
74-
### 10. `policyInfo` field on `CreatePolicyRequest` / `UpdatePolicyRequest``src/v1/model.ts:59,246`
75-
- **Why weird:** Field named after the entity's awkward type (`policyInfo: PolicyInfo`). If `PolicyInfo` is renamed to `Policy`, this becomes `policy: Policy` which is much cleaner.
76-
- **Category:** 20 (type-suffix tautology), 1 (`Info`).
77-
- **Suggested name:** `policy` (paired with type renamed to `Policy`).
78-
- **Rationale:** Tied to the `PolicyInfo` -> `Policy` rename (finding #1).
79-
80-
### 11. `policyType: PolicyType` field on `PolicyInfo``src/v1/model.ts:174`
81-
- **Why weird:** Type-suffix tautology (`policyType` field of type `PolicyType`).
82-
- **Category:** 20 (type-suffix tautology).
83-
- **Suggested name:** `type: PolicyType` if `PolicyInfo` is renamed to `Policy`; otherwise tolerate.
84-
- **Rationale:** Rule 20 in spec. The wire field is `policy_type` so the marshalled JSON stays unchanged.
85-
86-
### 12. `onSecurableType` / `forSecurableType` type-suffix tautology — `src/v1/model.ts:145,170`
87-
- **Why weird:** Same as above — fields named `onSecurableType` of type `SecurableType` and `forSecurableType` of type `SecurableType`.
88-
- **Category:** 20 (type-suffix tautology).
89-
- **Suggested name:** Drop `Type` from the field once renaming (`onSecurable: SecurableType`, `forSecurable: SecurableType`) — though it conflicts with finding #5. Better to combine the two renames (`definedOnSecurable: SecurableType`, `appliesToSecurable: SecurableType`).
90-
- **Rationale:** Reduces tautology and clarifies semantics at once.
91-
92-
### 13. Inconsistent rename style for `*Options` types — `src/v1/model.ts:36,215`
44+
### 5. Inconsistent rename style for `*Options` types — `src/v1/model.ts:36,215`
9345
- **Why weird:** `ColumnMaskOptions` and `RowFilterOptions` — two near-identical types describing variants of policy options. Each is a discriminator member; the `Options` suffix is redundant given the discriminator already says "this is the X options".
9446
- **Category:** 8 (redundant suffix), 12 (duplicate concept across similar types).
9547
- **Suggested name:** Either keep current names but acknowledge as boilerplate, or rename to `RowFilter`, `ColumnMask` (the `$case` discriminator already disambiguates).
9648
- **Rationale:** Generator artefact; flagging because near-identical types is the moment to ask whether the API surface should collapse.
9749

98-
### 14. `whenCondition` field — `src/v1/model.ts:172`
99-
- **Why weird:** `when` prefix is a SQL keyword; the field is a free-form condition expression. Just `condition` would suffice given the field already lives on `PolicyInfo`.
100-
- **Category:** 1 (vague prefix), 10 (reserved-word-adjacent).
101-
- **Suggested name:** `condition` or `conditionExpression`.
102-
- **Rationale:** `when_condition` is wire-only; the TS name can drop the redundant `when_`.
103-
104-
### 15. `toPrincipals` / `exceptPrincipals` field names — `src/v1/model.ts:162,164`
105-
- **Why weird:** Preposition-prefixed names mirror SQL `TO`/`EXCEPT` syntax (this is an ABAC-on-UC policy, the API mimics SQL `GRANT ... TO ... EXCEPT ...`). For programmatic SDK consumers, `principals` and `excludedPrincipals` would read more naturally.
106-
- **Category:** 1 (vague), 14 (Go/SQL-style names not idiomatic for TS).
107-
- **Suggested name:** `appliedPrincipals` / `excludedPrincipals` (or `principals` and `excludePrincipals`).
108-
- **Rationale:** Consumers who don't know the SQL syntax will misread `to_principals` as "principal list to apply to" and miss that `except_principals` is the complement.
109-
110-
### 16. `MatchColumn.condition: string``src/v1/model.ts:132`
111-
- **Why weird:** A `MatchColumn` has a field called `condition` (matched column condition expression) and an `alias`. The condition could equally well be called `expression`; "condition" implies boolean, but it's actually a column-selector expression evaluated to a column.
112-
- **Category:** 6 (misleading).
113-
- **Suggested name:** `columnExpression` or `selector`.
114-
- **Rationale:** Domain reading: "match columns where condition = X" suggests filtering rows; here it actually selects which columns the policy applies to. Easy to misread.
115-
116-
### 17. `PolicyInfo.id``src/v1/model.ts:139`
117-
- **Why weird:** Bare `id` field on `PolicyInfo` alongside `name`, `onSecurableFullname`, etc. — multiple identifier-like fields; bare `id` is underspecified.
118-
- **Category:** 19 (underspecified id when multiple ids exist).
119-
- **Suggested name:** `policyId`.
120-
- **Rationale:** Disambiguates from securable identifiers in the same struct.
121-
12250
## Low severity
12351

124-
### 18. `PolicyInfo.comment``src/v1/model.ts:157`
125-
- **Why weird:** Doc says "Optional description of the policy" but the field is named `comment`. SQL stores DDL comments, sure, but a TS-facing field that the JSDoc calls a description should be `description`.
126-
- **Category:** 6 (misleading — doc says description, name says comment).
127-
- **Suggested name:** `description`.
128-
- **Rationale:** Match the doc and avoid the SQL-DDL leak.
129-
130-
### 19. `PACKAGE_SEGMENT` constant — `src/v1/client.ts:38`
52+
### 6. `PACKAGE_SEGMENT` constant — `src/v1/client.ts:38`
13153
- **Why weird:** `Segment` is a generic CS term. Comment explains it's the User-Agent identity segment; without the comment the constant name doesn't communicate that.
13254
- **Category:** 1 (vague), 15 (generic field name).
13355
- **Suggested name:** `USER_AGENT_PACKAGE` or `PKG_USER_AGENT_SEGMENT`.
13456
- **Rationale:** Minor; only one place in the file but flagged for consistency review across the SDK.
13557

136-
### 20. `flattenQueryParams``src/v1/utils.ts:123`
58+
### 7. `flattenQueryParams``src/v1/utils.ts:123`
13759
- **Why weird:** Function is exported but not used in this package (no caller in `client.ts`). Dead-looking surface area.
13860
- **Category:** Observation / 11 (unused public helper).
13961
- **Suggested name:** Either remove the export (if it's an unused generator default), or document why it ships per-package.
14062
- **Rationale:** Not a name-quality issue per se, but flagged because each generated package will carry this and grep for unused exports across all packages will turn it up.
14163

142-
### 21. `readAll``src/v1/utils.ts:40`
64+
### 8. `readAll``src/v1/utils.ts:40`
14365
- **Why weird:** Function reads an entire response body stream into a buffer. Name is fine but generic; collides cognitively with `Array.prototype` or stream utilities.
14466
- **Category:** 1 (vague).
14567
- **Suggested name:** `drainStream` / `readStreamToEnd`.
14668
- **Rationale:** Internal helper, low cost. Skip if generated.
14769

148-
### 22. `executeCall` / `executeHttpCall` naming pair — `src/v1/utils.ts:26,65`
70+
### 9. `executeCall` / `executeHttpCall` naming pair — `src/v1/utils.ts:26,65`
14971
- **Why weird:** Two functions with nearly identical names handling very different layers (retry/rate-limit wrapper vs raw HTTP send + logging). Easy to confuse at call site.
15072
- **Category:** 1 (vague), 17 (inconsistent).
15173
- **Suggested name:** `runWithCallOptions` / `sendHttp` (or `wrapCall` / `dispatchHttp`).
15274
- **Rationale:** Names should differ in more than the `Http` infix.
15375

15476
## Observations
15577

156-
### 23. Wire/TS divergence is heavy
78+
### 10. Wire/TS divergence is heavy
15779
The model file is ~497 lines for ~9 user-facing types; >half is marshal/unmarshal/FieldMaskSchema scaffolding. Not a naming problem, but the audit surfaces just how much generator boilerplate dominates each package — worth raising at the SDK-design level.
15880

159-
### 24. Action-verb conventions in `Client`
81+
### 11. Action-verb conventions in `Client`
16082
The client uses `Create`/`Get`/`List`/`Update`/`Delete` consistently. No mixed `Fetch`/`Retrieve`/`Read`. This is good. (Listed as observation per rule 17 since the audit asked us to flag inconsistencies; here we explicitly note consistency.)
16183

162-
### 25. Acronym casing for `Http` / `Url` / `Id` in `utils.ts` / `client.ts`
84+
### 12. Acronym casing for `Http` / `Url` / `Id` in `utils.ts` / `client.ts`
16385
The codebase uses `Http` (`HttpClient`, `HttpRequest`, `executeHttpCall`) and `URLSearchParams` (Web standard) and `url` (lowercase) and `userAgent`. Mixing `Http` (PascalCase capital-then-lower) with the imported `URLSearchParams` (ALLCAPS) is inconsistent — common across JS ecosystem and probably not worth changing, but worth noting.
16486
- **Category:** 3 (acronym casing).
16587

166-
### 26. `abac` abbreviation only appears in package name
88+
### 13. `abac` abbreviation only appears in package name
16789
The package directory is `abacpolicies` but neither type, field, comment, nor enum mentions `abac`. The package name acts as a domain keyword the SDK is otherwise silent about. May confuse users searching by acronym.
16890
- **Category:** 5 (cryptic abbreviation in package name).
16991

@@ -180,14 +102,3 @@ The package directory is `abacpolicies` but neither type, field, comment, nor en
180102
- `src/v1/client.ts` (250 lines): read fully.
181103
- `src/v1/utils.ts` (150 lines): read fully.
182104
- `src/v1/index.ts` (20 lines): read fully.
183-
184-
## Fixed
185-
- #2 `DeletePolicy` (originally cited at `src/v1/model.ts:72`): Fixed in regeneration on 2026-05-20 — renamed to `DeletePolicyRequest`; siblings `CreatePolicyRequest`, `GetPolicyRequest`, `ListPoliciesRequest`, `UpdatePolicyRequest` also gained the `Request` suffix.
186-
- #1 (partial — Deny/Grant values) `PolicyType.POLICY_TYPE_DENY` / `POLICY_TYPE_GRANT` (originally cited at `src/v1/model.ts:7-14`): Fixed in regeneration on 2026-05-20 — Deny and Grant enum values removed.
187-
- #6 `FunctionArgExpression` (originally cited at `src/v1/model.ts:98`): Fixed in regeneration on 2026-05-20 — type removed entirely.
188-
- #7 `useSessionIdentity` field (originally cited at `src/v1/model.ts:292`): Fixed in regeneration on 2026-05-20 — field removed from `PolicyInfo`.
189-
- #14 `FunctionArgExpression.expr` (originally cited at `src/v1/model.ts:99`): Fixed in regeneration on 2026-05-20 — type removed.
190-
- #15 `TagIntrospectionExpression.expr` (originally cited at `src/v1/model.ts:313`): Fixed in regeneration on 2026-05-20 — type removed.
191-
- #16 `ColumnTagValueExtraction` / `TagValueExtraction` (originally cited at `src/v1/model.ts:60,328`): Fixed in regeneration on 2026-05-20 — both types removed.
192-
- #20 (partial) `DenyOptions` / `GrantOptions` (originally cited at `src/v1/model.ts:84,142`): Fixed in regeneration on 2026-05-20 — both types removed; only `ColumnMaskOptions` and `RowFilterOptions` remain, but the `Options`-suffix issue still applies (now finding #14).
193-
- #21 `ListPolicies` request type (originally cited at `src/v1/model.ts:152`): Fixed in regeneration on 2026-05-20 — renamed to `ListPoliciesRequest`.

0 commit comments

Comments
 (0)