@adbayb/stack 3.5.3 → 3.6.0-next.1793710633879.40ee21e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ Depth: each dimension is exhaustive within scope. Walk every Evidence item again
|
|
|
8
8
|
|
|
9
9
|
Rules: `software-design` reference `api-surface.md`.
|
|
10
10
|
|
|
11
|
-
- Evidence: YAGNI gate per resource/field/flag/option/export (requirement, add-later cost, removal cost), including unused "future" hooks, duplicate routes, and default-expanded relations; one purpose per unit and CQS (queries that mutate, commands returning more than identity/Result); parameter count (Parameter Object only when inputs are cohesive), boolean traps, observable behavior becoming an accidental contract (Hyrum's Law), `any`/wide inputs; leaked infrastructure types (ORM entities, `Request`/`Response`, SDK DTOs, driver rows/cursors/errors) and hidden mechanisms (ordering, retries, batching, storage); lowest sufficient scope (importers checked, counterpart exported before first consumer, implementations exported instead of contracts); invariant ownership across every entry path and invalid state combinations (flags vs discriminated unions, exhaustiveness, mutable aliases); money/quantity/time-zone units, precision, and rounding; transaction boundary at the use case, partial-failure recovery (outbox/compensation only where the required consistency needs it), unit-of-work ownership in the application layer, transaction held across network calls; read-check-write races and conflict behavior; typed stable errors without stack traces or driver messages; versioning, and source/wire/storage/behavioral compatibility (error shapes, defaults, mixed-version readers/writers); callers and slices touched (blast radius).
|
|
11
|
+
- Evidence: YAGNI gate per resource/field/flag/option/export (requirement, add-later cost, removal cost), including unused "future" hooks, duplicate routes, and default-expanded relations; one purpose per unit and CQS (queries that mutate, commands returning more than identity/Result); parameter count (Parameter Object only when inputs are cohesive), parameter order (required inputs after an options object, options holding required settings), boolean traps, observable behavior becoming an accidental contract (Hyrum's Law), `any`/wide inputs; leaked infrastructure types (ORM entities, `Request`/`Response`, SDK DTOs, driver rows/cursors/errors) and hidden mechanisms (ordering, retries, batching, storage); lowest sufficient scope (importers checked, counterpart exported before first consumer, implementations exported instead of contracts); invariant ownership across every entry path and invalid state combinations (flags vs discriminated unions, exhaustiveness, mutable aliases); money/quantity/time-zone units, precision, and rounding; transaction boundary at the use case, partial-failure recovery (outbox/compensation only where the required consistency needs it), unit-of-work ownership in the application layer, transaction held across network calls; read-check-write races and conflict behavior; typed stable errors without stack traces or driver messages; versioning, and source/wire/storage/behavioral compatibility (error shapes, defaults, mixed-version readers/writers); callers and slices touched (blast radius).
|
|
12
12
|
- Deltas: trace each finding to a current consumer or contract; distinguish an internal signature change from an incompatible published contract. Apply reference exceptions; generated code/test doubles exempt.
|
|
13
13
|
|
|
14
14
|
## B. Structure
|
|
@@ -16,7 +16,7 @@ If (1) has no answer, do not add it. Speculative Generality and Second-System Ef
|
|
|
16
16
|
|
|
17
17
|
- **One purpose per unit.** Endpoints, functions, and classes serve one cohesive purpose. Split commands from queries (CQS): `createOrder(input): Result<OrderId>` mutates and returns a Result; `getOrder(id)` does not change business state. Read-side I/O and adapter observability are allowed.
|
|
18
18
|
This is the documented exception: a command may return the created identity or a Result; queries never mutate.
|
|
19
|
-
- **Few, explicit parameters.** Prefer at most 3 parameters. At 4+, check whether the function has multiple responsibilities or its inputs form a cohesive Parameter Object; use an object when it improves clarity, otherwise keep the simple signature. No boolean traps: `send(email, true)` -> `sendWelcome(email)` / `sendReset(email)`.
|
|
19
|
+
- **Few, explicit parameters.** Prefer at most 3 parameters. At 4+, check whether the function has multiple responsibilities or its inputs form a cohesive Parameter Object; use an object when it improves clarity, otherwise keep the simple signature. Put required inputs first and at most one options object last, holding only optional settings so callers can omit it and it can grow without reordering; a newly required input becomes positional before it: `scan(path, options, signal)` -> `scan(path, signal, options)`. Platform conventions such as callback-last APIs still win. No boolean traps: `send(email, true)` -> `sendWelcome(email)` / `sendReset(email)`.
|
|
20
20
|
- **Narrow interfaces.** Prefer `create(order: Order)` over `create(data: any)`. Return domain types, not driver rows. Keep storage-native cursors, SQL fragments, and SDK errors internal; expose an opaque pagination token only when a current contract needs it.
|
|
21
21
|
- **Input and invariants.** Follow `security.md` for untrusted-input validation. Parse transport shape at the adapter; enforce business invariants in domain constructors and transitions for every entry path, including internal callers. Use types to prevent invalid states where practical; do not repeat transport parsing inside the domain.
|
|
22
22
|
- **Hide what can change.** Keep ordering, retries, batching, and storage choices internal. Expose facts and intents, not mechanisms.
|