RFC-0050 · Reference catalog
Versioned draft snapshot
RFCs, reference catalogs, and evidence reflect Spec 3b2e3e7a114fb826b1445d39a48756b8fff629cd. Counts and pending/status notes belong to that snapshot. Read the dated project update for later progress.
Source repositories are private during staging. Links marked “repository access required” need access to the linked repository.
Generated reference catalog. This page renders structured Lean data for RFC-0050: defined terms, diagnostics, dependencies, and invariants. It does not establish proof coverage or runtime conformance. The authored narrative lives in
RFC-0050.This page is generated from the
lean/Gnomon/Spec/module for RFC-0050. Edit that source and regenerate this catalog.
Title: Template-Mediated Creation Contract
Status: draft
Owners: Compiler, Module Platform, Runtime
Diagnostic range: M50000-M50099
Depends on: RFC-0001, RFC-0005, RFC-0006, RFC-0007, RFC-0008, RFC-0010, RFC-0024, RFC-0033, RFC-0036, RFC-0037, RFC-0038, RFC-0039, RFC-0040, RFC-0041, RFC-0042, RFC-0048, RFC-0049
Proof citations in source: 12 / 12. Standalone proof verification is pending.
Definitions
| Term | Meaning |
|---|---|
| Lineage subgraph | The closure of provenance statements rooted at any gnomon: the template, its arguments, the calling template (if any), the module, the principal. |
| Privileged write path | A small, named set of paths permitted to write graph.resource/graph.statement directly: the bootstrap loader, the system installer principal during install, and db.graph.unrestricted capability holders. |
| Provenance statement | An edge-gnomon that records one fact about a created gnomon’s origin. There are six provenance predicates. |
| Template invocation context | The runtime context active during a template execution: the calling principal, the active transaction, the parent invocation, and the input arguments. |
| Template-mediated creation | An gnomon is created exclusively as the result of a template instantiation; never via direct DB write from outside db.graph. |
Diagnostics
| Code | Severity | Description |
|---|---|---|
M50010 | Error | Direct write to graph.resource/graph.statement attempted outside a template invocation context |
M50011 | Error | Database-layer rejection of direct write (RLS gate); usually a defense-in-depth catch of M50010 |
M50012 | Error | Operation effects block contains direct resource/statement effect not wrapped in template.compose |
M50020 | Error | db.graph.unrestricted capability invoked without mandatory audit emission |
M50021 | Error | Application module declares db.graph.unrestricted in tokens:; this capability is reserved to system contexts |
M50030 | Info | Module manifest’s objects of type resource/statement produce gnomons with reduced provenance (install-time path) |
M50040 | Error | Required provenance statement(s) missing from a created gnomon |
M50050 | Info | Graph contains legacy gnomons without provenance statements (count emitted at install time) |
M50060 | Warning | core.lineage traversal exceeded lineage-max-depth; result is truncated |
M50070 | Defect | Template marker present in graph client context but executor frame stack is empty (state divergence) |
M50080 | Warning | Sensitive argument detected in template.with argument record; redaction applied — verify upstream caller intent |
Dependency neighborhood
graph LR
nRFC_0050["RFC-0050"]
nRFC_0001["RFC-0001"]
nRFC_0050 --> nRFC_0001
nRFC_0005["RFC-0005"]
nRFC_0050 --> nRFC_0005
nRFC_0006["RFC-0006"]
nRFC_0050 --> nRFC_0006
nRFC_0007["RFC-0007"]
nRFC_0050 --> nRFC_0007
nRFC_0008["RFC-0008"]
nRFC_0050 --> nRFC_0008
nRFC_0010["RFC-0010"]
nRFC_0050 --> nRFC_0010
nRFC_0024["RFC-0024"]
nRFC_0050 --> nRFC_0024
nRFC_0033["RFC-0033"]
nRFC_0050 --> nRFC_0033
nRFC_0036["RFC-0036"]
nRFC_0050 --> nRFC_0036
nRFC_0037["RFC-0037"]
nRFC_0050 --> nRFC_0037
nRFC_0038["RFC-0038"]
nRFC_0050 --> nRFC_0038
nRFC_0039["RFC-0039"]
nRFC_0050 --> nRFC_0039
nRFC_0040["RFC-0040"]
nRFC_0050 --> nRFC_0040
nRFC_0041["RFC-0041"]
nRFC_0050 --> nRFC_0041
nRFC_0042["RFC-0042"]
nRFC_0050 --> nRFC_0042
nRFC_0048["RFC-0048"]
nRFC_0050 --> nRFC_0048
nRFC_0049["RFC-0049"]
nRFC_0050 --> nRFC_0049
Invariants
- Cross-template-call lineage is captured via template.instantiated_from chains walkable by closure.
- Direct INSERT into graph.resource/graph.statement outside a template marker or admin session is rejected by RLS (M50011). (enforced by: RLS)
- Every gnomon is either the output of a template instantiation or of a privileged-write path; direct writes to graph.resource/graph.statement from elsewhere are prohibited. (enforced by: compile-time + runtime + RLS)
- Provenance statements are emitted in the same transaction as the created gnomon and commit atomically with it. (enforced by: runtime)
- Sensitive arguments are redacted before hashing in template.with argument records. (enforced by: runtime)
- The privileged-write path is restricted to bootstrap, the system installer, and holders of db.graph.unrestricted. (enforced by: RLS)
- The runtime template-marker stack mirrors the template executor’s call stack. (enforced by: runtime)
- core.provenance(gnomonId) returns a complete provenance subgraph for any gnomon.
- db.graph.unrestricted MUST be reserved to system contexts; application modules MUST NOT request it (M50021). (enforced by: compile-time)
- template.instance_of, module.installed_by, principal.created_by, and transaction.created_in are mandatory on every gnomon (with the bootstrap exception); missing any is M50040. (enforced by: compile-time)
Normative Statements
Statements are structured source data. Proof citations, where present, have not passed a standalone Gnomon proof gate.
Compatibility and Migration
- MUST — The framework MUST tolerate legacy gnomons lacking provenance statements.
- MUST — The install engine MUST emit module.installed_by and principal.created_by for every install-time gnomon. (proof citation:
rfc0050_b6_grounded; verification pending)
Compile-Time Validation
- MUST — Direct resource/statement effects in operations MUST be wrapped in a template.compose step. (proof citation:
rfc0050_b0_grounded; verification pending) - MUST — User-namespace operations emitting direct resource/statement effects without template.compose produce M50012. (proof citation:
rfc0050_b20_grounded; verification pending)
Cross-Template-Call Lineage
- MUST — Gnomons produced by nested template calls record the calling template via template.instantiated_from. (proof citation:
rfc0050_b2_grounded; verification pending)
Invariants
- MUST — Every gnomon has either template.instance_of, or was created by a privileged path with module.installed_by and principal.created_by present.
- MUST — template.instance_of, module.installed_by, principal.created_by, and transaction.created_in are mandatory on every non-bootstrap gnomon. (proof citation:
rfc0050_b15_grounded; verification pending)
Provenance Schema
- MUST — Provenance statements are emitted in the same transaction as the gnomon they describe. (proof citation:
rfc0050_provenance_same_transaction; verification pending) - MUST — Sensitive argument fields are redacted before hashing in template.with records. (proof citation:
rfc0050_sensitive_redacted; verification pending)
Purpose
- MUST — All non-intrinsic, non-bootstrap gnomon creation MUST go through a template. (proof citation:
rfc0050_non_intrinsic_via_template; verification pending)
Runtime Validation
- MUST — Graph client write methods MUST reject calls when the template invocation marker stack is empty and the caller lacks db.graph.unrestricted. (proof citation:
rfc0050_empty_stack_unrestricted_check; verification pending)
The Privileged-Write Path
- MUST_NOT — Application modules MUST NOT request the db.graph.unrestricted capability. (proof citation:
rfc0050_app_modules_no_unrestricted; verification pending) - MUST — Every invocation of db.graph.unrestricted MUST emit an audit log entry with unrestrictedCapability: true.
- MUST — Module manifests declaring db.graph.unrestricted MUST be reviewed manually before approval. (proof citation:
rfc0050_b27_grounded; verification pending)
The Provenance Projection
- MUST — Lineage projection is depth-bounded (default 32).
The Single Rule
- MUST_NOT — Direct writes to graph.resource or graph.statement from outside privileged paths are prohibited. (proof citation:
rfc0050_no_direct_writes; verification pending) - MUST — Every gnomon is the output of either a template instantiation or a privileged-write path.
Linked References
| Direction | Target |
|---|---|
| Depends on | RFC-0001 |
| Depends on | RFC-0005 |
| Depends on | RFC-0006 |
| Depends on | RFC-0007 |
| Depends on | RFC-0008 |
| Depends on | RFC-0010 |
| Depends on | RFC-0024 |
| Depends on | RFC-0033 |
| Depends on | RFC-0036 |
| Depends on | RFC-0037 |
| Depends on | RFC-0038 |
| Depends on | RFC-0039 |
| Depends on | RFC-0040 |
| Depends on | RFC-0041 |
| Depends on | RFC-0042 |
| Depends on | RFC-0048 |
| Depends on | RFC-0049 |