The destination of the wayfinder map: directory and module structure, the domain model as real schema files, permission boundaries expressed as code, and typed seams where the undecided parts land. Satisfies the four structural requirements earlier resolutions handed to a layout that did not exist: - a single database entry point (#11) — the pool is not exported - a scheduler entry point with actor context and no request (#13) - an entitlement assertion helper (#20, #34) — its call sites are the paid-feature list - an enumerated list of privileged RLS bypasses (#33) — three of them Seams carry real types and throw with the ticket that owns them, so the skeleton wires up and fails only where a decision is genuinely missing. Verified: tsc --noEmit clean; drizzle-kit generate produces RLS on 18 tables and 6 policies calling the release-level functions. Resolves #35 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
27 lines
974 B
TypeScript
27 lines
974 B
TypeScript
import { Seam } from '../seam.js'
|
|
|
|
/**
|
|
* Rate function evaluation. Shape closed by #29.
|
|
*
|
|
* Price is NOT a scalar (#22). Real structures look like:
|
|
* - unit cost x frequency x quantity, where frequency hides in a footnote
|
|
* - MAX(1/12 x minimum annual guarantee, % of gross receipts)
|
|
* - piecewise bands varying by category, threshold, or contract year
|
|
*
|
|
* This is deterministic by #15 decision 2 — a model may never evaluate it and
|
|
* there is no fallback path. So the v1 rate structure types must be CLOSED and
|
|
* computable: a shape the code cannot evaluate has nowhere to go.
|
|
*/
|
|
export interface RateStructure {
|
|
readonly kind: string
|
|
}
|
|
|
|
export interface ScenarioQuantities {
|
|
[priceLineId: string]: number
|
|
}
|
|
|
|
/** Produces derived_cost: a comparison figure against the declared scenario, never contract value. */
|
|
export function evaluate(_rate: RateStructure, _q: ScenarioQuantities): number {
|
|
throw new Seam('#29', 'the v1 rate structure types')
|
|
}
|