Skip to content

Commit a2ef758

Browse files
committed
docs(plugin-security): say why this reader branches on the answer where the sibling branches on the container (#15298)
`resolveStackCollection` (packages/cli/src/utils/stack-collections.ts, #15006) landed on main branching on the container, and is right to: it returns a whole collection, so a present top-level key has already answered. This reader extracts a distinguished element out of the collection, so "present" and "answers" are different facts here. Recording the reason in the docblock so the convergence pass reads two readers that differ AND say why, rather than two that differ while appearing to agree. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHvF5hyiZjnCyExFnfQB8m
1 parent f151fe1 commit a2ef758

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

packages/plugins/plugin-security/src/app-default-permission-set.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,19 @@ export function appDefaultPermissionSetName(permissions: unknown): string | unde
132132
* `[]`-is-truthy trap for free. The answer is the only condition that cannot
133133
* be wrong in either direction, so the answer is what this branches on.
134134
*
135+
* ⚠️ That is deliberately NOT the shape of the sibling reader's condition, and
136+
* the difference is a property of the readers, not an inconsistency to
137+
* converge away. `resolveStackCollection` (`packages/cli/src/utils/
138+
* stack-collections.ts`, #15006) branches on the CONTAINER — `if
139+
* (Array.isArray(top)) return top;` — and is right to: it returns a whole
140+
* collection, so a top level that carries the key has, by construction,
141+
* already answered, and `composeStacks` flattened that array into the union.
142+
* This reader extracts a DISTINGUISHED ELEMENT out of the collection instead,
143+
* so "the key is present" and "the key answers" are two different facts here
144+
* and one of them is the wrong one to branch on. Same discipline — start from
145+
* the expression this program replaced, consult `packages[]` only where it came
146+
* back empty — read against what each reader's expression actually returns.
147+
*
135148
* ## The order is `resolveArtifactPackageOrder`'s, not the array's
136149
*
137150
* The first package body that names a default wins, so with more than one

0 commit comments

Comments
 (0)