IF Commons GitHub

Identity principals

0032Active

0032-identity-principals · owner if · domain data

Requirements

FR-001checkpassing

A principal MUST have a kind (user, machine, device, agent or group), a status (pending, active, suspended, disabled or deleted) with its reason and the time it changed, the time it was made, an optional owning tenant and an optional owner that is a principal.

Enforced (check): .github: cd commons/data && bun run verify — suite/identity.test.ts: the whole composition binds for each dialect and loads into each real engine, and on every engine a principal of any of the five kinds has a status and an owner that is not itself, and a tenant has a unique slug and is not its own parent

Proved by: data/suite/identity.test.ts

Written in: data/models/identity/kit.ts

Tests: passed: suite/identity.test.ts the whole composition binds for each dialect and loads into each real engine, and on every

FR-002checkpassing

A principal MUST NOT be its own owner, MUST refuse a kind or a status that is not one of its code list's, MUST refuse an owner that is not a principal, and the same table MUST hold a principal of every kind, so that a role, a credential, an attribute, a group membership and an audit event refer to any kind alike.

Enforced (check): .github: cd commons/data && bun run verify — suite/identity.test.ts: the whole composition binds for each dialect and loads into each real engine, and on every engine a principal of any of the five kinds has a status and an owner that is not itself, and a tenant has a unique slug and is not its own parent

Proved by: data/suite/identity.test.ts

Tests: passed: suite/identity.test.ts the whole composition binds for each dialect and loads into each real engine, and on every

FR-003checkpassing

Every kind, status and method that a concept of any identity module names MUST be a code list with a definition of each code, closed unless it says it is open (so that a module can add a kind of credential), and the helpers the modules are written with MUST be public so that every module says things the same way.

Enforced (check): .github: cd commons/data && bun run verify — suite/identity.test.ts: every kind, status and method of every module is a code list with a definition of each code, closed unless it says it is open

Proved by: data/suite/identity.test.ts

Tests: passed: suite/identity.test.ts every kind, status and method of every module is a code list with a definition of each cod

Out of scope

  • The operations that do the business of this module: a later specification, run by the operations runtime (0031).
  • How a decision is made from these tables: the decision engine is a later specification.

Edge cases

  • A kind of principal that has no table of its own in this module: it is held by the principal and its roles alone, per FR-001.
  • DuckDB loads this schema and can read it, and cannot update a row that another row refers to; operations that change principals, runs or delegations are for PostgreSQL and SQLite, per FR-001.

Assumptions

  • The application makes identifiers, hashes and timestamps; the database stores them and refuses what the constraints say.

Open questions

OQ-1open question

The constraints that governance cannot say (acyclic hierarchies, a subtype row only for a principal of its kind) are checks of the operations and of invariant queries, not of the schema.

Key entities

  • Principals - what this module holds, as its requirements say.

Success criteria

SC-001success criterion

A project composes this module only when it needs it, and the database refuses what the requirements say it must refuse.

Review & acceptance checklist

  • [x] Every requirement is testable (MUST / MUST NOT), not aspirational
  • [x] No company fact is asserted here
  • [x] Every open item is marked, not silently decided

Cited by

Data, models/identity/kit

Titles, headings, exports, tables, columns and requirements. Esc closes.