@ultimat3/policy 31.32.0 → 31.33.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/policy",
3
- "version": "31.32.0",
3
+ "version": "31.33.0",
4
4
  "description": "The one authz rule, evaluated identically in every surface",
5
5
  "keywords": [
6
6
  "ultimate",
@@ -42,6 +42,6 @@
42
42
  "test": "bun test"
43
43
  },
44
44
  "dependencies": {
45
- "@ultimat3/core": "31.32.0"
45
+ "@ultimat3/core": "31.33.0"
46
46
  }
47
47
  }
package/src/errors.ts CHANGED
@@ -1,8 +1,10 @@
1
- // The policy layer's stable error codes. `X_POLICY_MISSING` is enforced by the TYPE system,
2
- // not by a throw: `ActionDef.policy` is a required field (`@ultimat3/action`'s `action.ts`), so
3
- // an action with no policy never compiles. The code and its factory stay published for a
4
- // declaration site that cannot express the requirement in a type — a config-driven route table,
5
- // a policy resolved by name — and `policyMissing()` is how such a site says it.
1
+ // The policy layer's stable error codes. `X_POLICY_MISSING` is enforced by the TYPE system, not by
2
+ // a throw: `ActionDef.policy` is a required field (`@ultimat3/action`'s `action.ts`), so an action
3
+ // with no policy never compiles.
4
+ //
5
+ // The code and its factory stay published for a declaration site that cannot express the
6
+ // requirement in a type — a config-driven route table, a policy resolved by name — and
7
+ // `policyMissing()` is how such a site says it.
6
8
  import {
7
9
  deniedCallerFix,
8
10
  type ErrorRetry,
package/src/evaluate.ts CHANGED
@@ -1,8 +1,9 @@
1
- // One entry point for evaluating a policy, and the only place a decision trace is
2
- // built. The trace is what makes an authz denial debuggable: `/_x` renders it, policy
3
- // tests assert on it, and an agent reading a 403 can see which clause decided.
4
- // It is also the one place a `policy.decision` event is emitted — allowed decisions
5
- // included, since "who was let in" is the half an audit actually needs.
1
+ // One entry point for evaluating a policy, and the only place a decision trace is built. The trace
2
+ // is what makes an authz denial debuggable: `/_x` renders it, policy tests assert on it, and an
3
+ // agent reading a 403 can see which clause decided.
4
+ //
5
+ // It is also the one place a `policy.decision` event is emitted — allowed decisions included, since
6
+ // "who was let in" is the half an audit actually needs.
6
7
  import { type Ctx, DEFAULT_ENVIRONMENT, tryResolveEnvironment } from '@ultimat3/core';
7
8
  import { decisionObserved, emitDecision } from './decisions';
8
9
  import type { Policy, PolicyDecision, TraceEntry } from './policy';
@@ -1,6 +1,8 @@
1
1
  // The one derived question a SURFACE asks of a policy tree: can an anonymous caller be allowed at
2
- // all. Apart from `policy.ts` so each file stays one responsibility — that one CONSTRUCTS trees,
3
- // this one projects a single boolean out of a built one — and in this package rather than in the
2
+ // all.
3
+ //
4
+ // Apart from `policy.ts` so each file stays one responsibility — that one CONSTRUCTS trees, this
5
+ // one projects a single boolean out of a built one — and in this package rather than in the
4
6
  // surfaces, because the answer is a property of the combinators and a copy per surface drifts from
5
7
  // them the first time one changes.
6
8
  import type { Policy, PolicyKind } from './policy';
@@ -1,8 +1,10 @@
1
1
  // What each built policy can decide BEFORE its input is parsed, stored beside the policy rather
2
- // than on it. A WeakMap keyed by the objects `policy.ts` builds, so a foreign `Policy` — one an
3
- // app assembled by hand, with a `run` this package never saw — has no entry and is answered
4
- // "depends on input": the before-input gate can only ever DEFER to the full evaluation for it,
5
- // never decide on its behalf.
2
+ // than on it.
3
+ //
4
+ // A WeakMap keyed by the objects `policy.ts` builds, so a foreign `Policy` — one an app assembled
5
+ // by hand, with a `run` this package never saw — has no entry and is answered "depends on input":
6
+ // the before-input gate can only ever DEFER to the full evaluation for it, never decide on its
7
+ // behalf.
6
8
  import type { Ctx } from '@ultimat3/core';
7
9
  import type { PolicyDecision, Recorder } from './policy';
8
10
  import type { Actor } from './roles';