Skip to content

Commit 596e3ac

Browse files
authored
chore: rename "mint" terminology to "generate" (#16)
PR: #16
1 parent d83f04a commit 596e3ac

14 files changed

Lines changed: 24 additions & 24 deletions

csharp/03-nullability-and-the-type-system.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ public static class UserParser
1515
if (dto is null) return new Result<User, string>.Err("dto was null");
1616
if (string.IsNullOrWhiteSpace(dto.Email)) return new Result<User, string>.Err("email required");
1717

18-
var id = UserId.From(dto.Id); // validated factory mints the brand (3.7)
18+
var id = UserId.From(dto.Id); // validated factory generates the brand (3.7)
1919
var roles = dto.Roles ?? []; // null from the wire collapses to empty, here (3.4)
2020
return new Result<User, string>.Ok(new User(id, dto.Email, roles));
2121
}
2222
}
2323
```
2424

25-
The boundary receives a nullable `UserDto?` and either returns a fully non-null `User` or a typed failure — no `!`, no `default!`, no `dynamic` (3.1, 3.3, 3.5). The one place a `null` from the wire is handled is explicit and local (3.4). `UserId` is a branded value type minted by a validating factory (3.7), and every public field is a `record` property carrying value semantics (3.8). The interior never sees an absence value it did not ask for.
25+
The boundary receives a nullable `UserDto?` and either returns a fully non-null `User` or a typed failure — no `!`, no `default!`, no `dynamic` (3.1, 3.3, 3.5). The one place a `null` from the wire is handled is explicit and local (3.4). `UserId` is a branded value type generated by a validating factory (3.7), and every public field is a `record` property carrying value semantics (3.8). The interior never sees an absence value it did not ask for.
2626

2727
## Rules
2828

csharp/05-methods-and-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public string Describe() // good — bloc
112112

113113
**Reasoning, step by step:**
114114
1. A call with three or more positional arguments is a row of unlabelled values at the call site — `Settle(amount, rate, account, true)` — where a reader cannot tell which `decimal` is which and a transposed pair compiles silently. Collecting them into an immutable `record` gives every argument a name at the call site, lets the caller use object-initializer or `with` syntax, and makes adding a field a non-breaking change instead of another positional slot (chapter [06](./06-types-and-data-modeling.md)).
115-
2. The record also becomes the home for the validation and the defaults: `required` members force the caller to supply what matters, `init` defaults fill the rest, and the parse-don't-validate boundary (chapter [03](./03-nullability-and-the-type-system.md)) can mint a proven options value once. Two well-named parameters need no ceremony; the threshold is three, where the loss of labelling starts to cost correctness.
115+
2. The record also becomes the home for the validation and the defaults: `required` members force the caller to supply what matters, `init` defaults fill the rest, and the parse-don't-validate boundary (chapter [03](./03-nullability-and-the-type-system.md)) can generate a proven options value once. Two well-named parameters need no ceremony; the threshold is three, where the loss of labelling starts to cost correctness.
116116

117117
**Worked example:**
118118
```csharp

csharp/06-types-and-data-modeling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public readonly record struct ExpiryMonth
109109
: new Result<ExpiryMonth, string>.Err("month out of range");
110110
}
111111
```
112-
**Enforcement:** review of boundary modules; the private constructor makes the factory the only mint.
112+
**Enforcement:** review of boundary modules; the private constructor makes the factory the only generator.
113113

114114
### 6.5 — Force construction-time completeness with `required` and `init`, not multi-step setters.
115115

ruby/05-methods.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def tax_for(subtotal, jurisdiction:)
3939
end
4040
```
4141

42-
`Money` is minted in exactly one place — `Money.parse`, the parse-constructor that validates the integer-cents value before returning an immutable value object. Nothing else creates a `Money`. The public method sits above the two helpers it calls, so the file reads top-down (5.4). Guard clauses assert the preconditions and leave the happy path flush left (5.3). The keyword argument `now:` keeps the call site legible without a positional slot that callers can transpose (5.4 rule). A postcondition pair verifies the sum from both of its parts before return (5.12). Each method holds one level of abstraction — `settle_order` orchestrates named steps and touches no arithmetic itself (5.2). The helpers reach a `Money` only through `Money.parse`, the single parse-constructor that validates (per chapter 03).
42+
`Money` is generated in exactly one place — `Money.parse`, the parse-constructor that validates the integer-cents value before returning an immutable value object. Nothing else creates a `Money`. The public method sits above the two helpers it calls, so the file reads top-down (5.4). Guard clauses assert the preconditions and leave the happy path flush left (5.3). The keyword argument `now:` keeps the call site legible without a positional slot that callers can transpose (5.4 rule). A postcondition pair verifies the sum from both of its parts before return (5.12). Each method holds one level of abstraction — `settle_order` orchestrates named steps and touches no arithmetic itself (5.2). The helpers reach a `Money` only through `Money.parse`, the single parse-constructor that validates (per chapter 03).
4343

4444
## Rules
4545

skills/typescript-bun-styleguide/reference/checklist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Bun runtime additions on top of `typescript-styleguide`. Additive only — never
3232
- Every route declares request AND response schemas; the outbound `.parse()` is a leak tripwire.
3333
- Handlers are thin: parse already-validated input, call one plain domain function, return; no Hono types in domain code. Test via `app.request()`, not a live socket or MSW.
3434
- One centralized `app.onError(mapError)` maps domain errors to `problem+json`; handlers never craft a 5xx; unknown errors map to a generic 500 carrying only the correlation id.
35-
- Every request carries a `correlationId`, minted or accepted once at the edge, propagated through `AsyncLocalStorage` via `store.run`.
35+
- Every request carries a `correlationId`, generated or accepted once at the edge, propagated through `AsyncLocalStorage` via `store.run`.
3636
- Set server timeouts explicitly: `idleTimeout` on the `Bun.serve` config and a per-route `timeout(...)`, kept under the upstream LB idle timeout.
3737
- Rate-limit at the edge with bounded store state (LRU max size or Redis TTL), `429` + `Retry-After`.
3838
- Health endpoints are honest: liveness does no dependency I/O (restart signal); readiness checks dependencies and fails first during drain (traffic signal).

skills/typescript-styleguide/reference/checklist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ One section per chapter. Read on demand for a full audit; the SKILL digest cover
3939
- Prefer optional `?` over `| undefined` in object types (`exactOptionalPropertyTypes` enforces the difference).
4040
- Narrow with the weakest tool that works: discriminant, then `typeof`/`instanceof`/`in`, then a custom guard.
4141
- Unit-test every custom type guard (`x is T`) with positive and negative cases.
42-
- Brand domain primitives in high-rigor modules; mint only through a validating constructor (the one sanctioned `as`).
42+
- Brand domain primitives in high-rigor modules; generate only through a validating constructor (the one sanctioned `as`).
4343
- Put `readonly`/`ReadonlyArray`/`Readonly<T>` in every public signature.
4444
- Constrain every generic; add no gratuitous type parameters; annotate variance (`in`/`out`) on public generic interfaces.
4545
- Write erasable syntax only: no `enum`, runtime `namespace`, parameter properties, or `import =`. Consume a codegen `enum` only at the boundary, convert to a union inside.

typescript-bun/03-http-services.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { mapError } from './error-map.ts'; // the one domain-error
1818
const app = new Hono();
1919

2020
app.use('*', async (c, next) => { // 3.6 — correlate before any handler runs
21-
const correlationId = c.req.header('x-request-id') ?? randomUUID(); // accept inbound or mint
21+
const correlationId = c.req.header('x-request-id') ?? randomUUID(); // accept inbound or generate
2222
await runWithRequestContext({ correlationId }, next); // store.run wraps the rest of the request (ch. 06)
2323
});
2424
app.onError(mapError); // 3.5 — handlers never craft 5xx; one map owns error → problem+json
@@ -35,7 +35,7 @@ app.get(
3535
export default { fetch: app.fetch, idleTimeout: 30 }; // 3.7 — Bun.serve picks this up; idleTimeout is the slowloris guard
3636
```
3737

38-
Every byte is parsed before the handler sees it and every reply field is schema-checked on the way out (3.3); the handler is glue over `getUser`, a function the unit tests call with no HTTP in sight (3.4); failures route through one `onError` (3.5); a correlation id is minted or accepted once and threaded through `AsyncLocalStorage` so every downstream log line carries it (3.6); the server idle timeout is set explicitly on the exported `Bun.serve` config (3.7). This is the Hono-on-`Bun.serve` idiom (3.1) the rest of the chapter justifies rule by rule.
38+
Every byte is parsed before the handler sees it and every reply field is schema-checked on the way out (3.3); the handler is glue over `getUser`, a function the unit tests call with no HTTP in sight (3.4); failures route through one `onError` (3.5); a correlation id is generated or accepted once and threaded through `AsyncLocalStorage` so every downstream log line carries it (3.6); the server idle timeout is set explicitly on the exported `Bun.serve` config (3.7). This is the Hono-on-`Bun.serve` idiom (3.1) the rest of the chapter justifies rule by rule.
3939

4040
## Rules
4141

@@ -128,14 +128,14 @@ app.onError((err, c) => {
128128
### 3.6 — Every request carries a correlation id.
129129

130130
**Reasoning, step by step:**
131-
1. A middleware registered with `app.use('*', ...)` either accepts an inbound `x-request-id` (so a trace spans services) or mints a fresh UUID when none arrives, via `randomUUID` from `node:crypto`. The id is decided once, at the very front of the request, before any handler or domain call.
131+
1. A middleware registered with `app.use('*', ...)` either accepts an inbound `x-request-id` (so a trace spans services) or generates a fresh UUID when none arrives, via `randomUUID` from `node:crypto`. The id is decided once, at the very front of the request, before any handler or domain call.
132132
2. It propagates through `AsyncLocalStorage` ([06](./06-logging.md)), which works unchanged on Bun, not by threading a parameter through every function. The middleware binds it with `store.run` wrapping the request continuation — `await store.run(ctx, next)` — the scoped form [06 §6.2](./06-logging.md) mandates over the mid-handler accessor it bans for leaking context into whatever runs next on the loop. Any code in the request's async context — domain function, repository, error handler — then reads the id from the store, so correlation survives `await` boundaries without polluting signatures.
133133
3. Every log line during the request carries that id, which makes the one boundary log (3.5) joinable to all that led to it — parity with the kotlin-jvm correlation contract ([kotlin-jvm 06](../kotlin-jvm/06-logging.md)): one id, set at the edge, on every line, across the whole call tree.
134134
4. The canonical log key is `correlationId`, set once here at the edge and read everywhere downstream ([06 §6.2](./06-logging.md)) — one name for the id in the child logger, the `AsyncLocalStorage` store, and every line, so a trace joins without reconciling synonyms.
135135

136136
```ts
137137
app.use('*', async (c, next) => {
138-
const correlationId = c.req.header('x-request-id') ?? randomUUID(); // accept inbound or mint
138+
const correlationId = c.req.header('x-request-id') ?? randomUUID(); // accept inbound or generate
139139
await runWithRequestContext({ correlationId }, next); // store.run wraps the request continuation, the scoped form ch. 06 §6.2 mandates
140140
});
141141
```

typescript-bun/05-serialization-and-validation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,6 @@ const stored = await s3.file(`thumbs/${id}`).bytes(); // s3.file (S3
163163
## Cross-references
164164

165165
- zod at the boundary, `z.infer` as the single source of type truth: [core 10.7](../typescript/10-api-design.md). Boundary route rule, `unknown` inward, `any` banned, `undefined` over `null`: [core 03's §3.2, §3.5, §3.6](../typescript/03-the-type-system.md).
166-
- Branded `Cents`, integer minor units, the parse-mint constructor: [core 05](../typescript/05-functions.md).
166+
- Branded `Cents`, integer minor units, the parse-generate constructor: [core 05](../typescript/05-functions.md).
167167
- Null-versus-absent and time types, JVM parity: [kotlin-jvm serialization](../kotlin-jvm/05-serialization.md).
168168
- Parse every boundary, crash-only boot, dependency justification: BUN-3, BUN-1, BUN-4 ([README](./README.md)). Rows parsed at the edge: [persistence](./04-persistence.md). HTTP body limits and handlers: [HTTP services](./03-http-services.md).

typescript-bun/06-logging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ log().info(`order ${orderId} placed with ${itemCount} items`); // bad — data m
7171
**Reasoning, step by step:**
7272
1. Every log line for a request needs the same cross-cutting context: a correlation id, the principal, the tenant. Threading a `logger` or `ctx` parameter through every function to achieve that pollutes signatures all the way down and breaks the moment one layer forgets to pass it.
7373
2. `AsyncLocalStorage` from `node:async_hooks` is the answer, and the direct analog of SLF4J's MDC in [kotlin-jvm/06-logging.md](../kotlin-jvm/06-logging.md) §6.6. Bun ships it through its `node:async_hooks` compatibility, and it works for this pattern: the store follows the async call graph across every `await`, timer, and microtask — the store set before an `await` is the store seen after it. Where the JVM bridges MDC across coroutine suspensions with `MDCContext`, here no bridging is needed.
74-
3. Bind the store once at the boundary with `runWithRequestContext(ctx, fn)` and read it through a `log()` accessor that does `root.child(store.getStore())`. Correlation id and principal then appear on every line in that request's async subtree, no parameter passed. The canonical context key is `correlationId` — one name in the store, the child logger, and every line, so a trace joins downstream without reconciling synonyms ([03 §3.6](./03-http-services.md) mints it at the edge). Use `store.run` to scope it; never `enterWith` mid-handler, which leaks the context into whatever runs next on the loop.
74+
3. Bind the store once at the boundary with `runWithRequestContext(ctx, fn)` and read it through a `log()` accessor that does `root.child(store.getStore())`. Correlation id and principal then appear on every line in that request's async subtree, no parameter passed. The canonical context key is `correlationId` — one name in the store, the child logger, and every line, so a trace joins downstream without reconciling synonyms ([03 §3.6](./03-http-services.md) generates it at the edge). Use `store.run` to scope it; never `enterWith` mid-handler, which leaks the context into whatever runs next on the loop.
7575

7676
```ts
7777
app.use('*', (c, next) => runWithRequestContext({ correlationId: c.req.header('x-request-id') ?? randomUUID(), principal: c.get('principal') }, next));

typescript-bun/08-build-and-distribution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ await Bun.build({
119119

120120
**Reasoning, step by step:**
121121
1. Supply-chain integrity runs in both directions, and both directions need a guarantee. Outbound: a consumer installing your package wants proof the tarball was built from the source it claims and not swapped by a compromised token. Inbound: your build wants proof the dependency tree it resolves is the exact one that was reviewed.
122-
2. Outbound is npm provenance plus 2FA. `bun publish` carries the tarball, the access flag, and 2FA (`--auth-type`, `--otp`), but as of this writing it does not emit a provenance attestation — there is no `--provenance` flag. So the publish step in CI runs `npm publish --provenance` (from a CI runner with an OIDC identity), which attaches a signed, verifiable link from the artifact back to the commit and workflow that produced it. This is a registry-tooling choice, not a workflow regression: `bun` builds, installs, and audits the package; the one publish call that mints the attestation goes through `npm` until Bun ships provenance. 2FA on the publish step means a stolen token alone cannot push a release, and a laptop cannot mint provenance — which is the point: publishing moves to CI (BUN-4). When `bun publish` gains `--provenance`, the call swaps and the rest of the pipeline is unchanged.
122+
2. Outbound is npm provenance plus 2FA. `bun publish` carries the tarball, the access flag, and 2FA (`--auth-type`, `--otp`), but as of this writing it does not emit a provenance attestation — there is no `--provenance` flag. So the publish step in CI runs `npm publish --provenance` (from a CI runner with an OIDC identity), which attaches a signed, verifiable link from the artifact back to the commit and workflow that produced it. This is a registry-tooling choice, not a workflow regression: `bun` builds, installs, and audits the package; the one publish call that generates the attestation goes through `npm` until Bun ships provenance. 2FA on the publish step means a stolen token alone cannot push a release, and a laptop cannot generate provenance — which is the point: publishing moves to CI (BUN-4). When `bun publish` gains `--provenance`, the call swaps and the rest of the pipeline is unchanged.
123123
3. Inbound is the committed lockfile, no exceptions. `bun.lock` pins every transitive dependency to an exact version and integrity hash, so `bun install` resolves the reviewed tree and not a freshly-floated one. An uncommitted or `.gitignore`d lockfile means every install is an unreviewed code change ([../security.md](../security.md), BUN-4).
124124

125125
```jsonc

0 commit comments

Comments
 (0)