# Proposal admission

> Decide if a router's proposal joins the app. A stale, unclear or clashing proposal never becomes part of it.

Inspired by UOR-Foundation/foundry (https://github.com/UOR-Foundation/foundry), live at https://uor-foundation.github.io/foundry/. Prism AI Foundry: describe an app, and it is built, proved and published. Pattern: Decision table, OMG DMN 1.5, hit policy FIRST. To write one of your own, follow How to build a decision table app (../../guides/decision-table/index.md). The prompt below is data, quoted from the example.

**Figure: What the Proposal admission app does.** A request goes in, the rules decide, and the Lean kernel has already proved what the rules promise.

| Step | What happens |
| --- | --- |
| 1. Request | revision, ambiguity, constraints, conflicts |
| 2. 4 rules | the first that matches wins |
| 3. Answer | admit, refuse, open |
| 4. Proved | 4 theorems, 36 tests |

Verified by prismpm verify in the pinned SDK. Fingerprint: 71f1aad34ee8501f5d7814505ea88b91f00c04a676593938c491404a4148a9be. Acceptance vectors: 36. Claims: 7.

## The prompt

```json
{
  "schema": "prism/prompt/1",
  "goal": "Decide if a router's proposal joins the app. A stale, unclear or clashing proposal never becomes part of it.",
  "pattern": "decisionTable",
  "repository": "UOR-Foundation/foundry",
  "app": {
    "name": "proposal-admission",
    "title": "Proposal admission",
    "purpose": "Decide whether a router's proposal is admitted, refused, or returned with an open issue, from whether its intent and registry revision are current, whether it is ambiguous, whether its constraints are resolved and how many selected features conflict.",
    "fields": [
      {
        "name": "revision",
        "kind": "choice",
        "values": [
          "current",
          "stale"
        ],
        "means": "whether the intent and registry revision match the expected ones"
      },
      {
        "name": "ambiguity",
        "kind": "choice",
        "values": [
          "none",
          "ambiguous"
        ],
        "means": "whether the proposal lists an unresolved ambiguity"
      },
      {
        "name": "constraints",
        "kind": "choice",
        "values": [
          "resolved",
          "unresolved"
        ],
        "means": "whether the proposal lists an unresolved constraint"
      },
      {
        "name": "conflicts",
        "kind": "number",
        "min": 0,
        "means": "selected features that conflict with another"
      }
    ],
    "outcomes": [
      "admit",
      "refuse",
      "open"
    ],
    "meanings": {
      "admit": "the selected features join the composition",
      "refuse": "refused: stale, or the composition is rejected",
      "open": "refused with an unresolved issue, ambiguity or constraint, to resolve and propose again"
    },
    "rules": [
      {
        "when": [
          {
            "field": "revision",
            "op": "is",
            "value": "stale"
          }
        ],
        "then": "refuse",
        "why": "app/src/ProposalAdmission.lex.tex admitProposal: staleIntent and staleRegistry are checked first (staleIntentRefused, staleRegistryRefused)"
      },
      {
        "when": [
          {
            "field": "ambiguity",
            "op": "is",
            "value": "ambiguous"
          }
        ],
        "then": "open",
        "why": "admitProposal: any ambiguity is unresolvedAmbiguity, never a default (ambiguityRefused)"
      },
      {
        "when": [
          {
            "field": "constraints",
            "op": "is",
            "value": "unresolved"
          }
        ],
        "then": "open",
        "why": "admitProposal: an unresolved constraint is unresolvedConstraint (constraintRefused)"
      },
      {
        "when": [
          {
            "field": "conflicts",
            "op": ">=",
            "value": 1
          }
        ],
        "then": "refuse",
        "why": "app/src/FeatureComposition.lex.tex hasConflict: admitComposition rejects conflicting features (compositionRejected)"
      }
    ],
    "otherwise": "admit",
    "otherwiseWhy": "current, unambiguous, resolved and consistent: admitProposal returns the features",
    "properties": [
      {
        "kind": "never",
        "when": [
          {
            "field": "ambiguity",
            "op": "is",
            "value": "ambiguous"
          }
        ],
        "then": "admit",
        "why": "no silent defaults"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "constraints",
            "op": "is",
            "value": "unresolved"
          }
        ],
        "then": "admit",
        "why": "unresolved issues refuse acceptance"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "conflicts",
            "op": ">=",
            "value": 1
          }
        ],
        "then": "admit",
        "why": "the composition stays consistent"
      },
      {
        "kind": "never",
        "when": [
          {
            "field": "revision",
            "op": "is",
            "value": "stale"
          }
        ],
        "then": "admit",
        "why": "a proposal against an old registry or intent is never admitted"
      }
    ],
    "examples": [
      {
        "request": "current none resolved 0",
        "response": "admit"
      },
      {
        "request": "current ambiguous resolved 0",
        "response": "open"
      },
      {
        "request": "current none unresolved 2",
        "response": "open"
      },
      {
        "request": "current none resolved 2",
        "response": "refuse"
      },
      {
        "request": "stale none resolved 0",
        "response": "refuse"
      },
      {
        "request": "current ambiguous resolved 3",
        "response": "open"
      }
    ]
  },
  "stakeholders": [
    {
      "name": "App builder",
      "text": "Describes an app in plain words and needs only current, unambiguous, consistent parts to reach it.",
      "concerns": [
        "Proved guarantees",
        "Correct answers"
      ]
    },
    {
      "name": "Registry maintainer",
      "text": "Publishes versioned feature contracts and needs a proposal made against an older registry revision to be refused.",
      "concerns": [
        "Proved guarantees"
      ]
    }
  ],
  "components": [
    {
      "name": "Router",
      "text": "The model that reads the description and proposes versioned feature references with a confidence; inference belongs to the runner, not the kernel.",
      "kind": "externalSystem"
    },
    {
      "name": "Feature registry",
      "text": "The registry of canonical versioned feature contracts that admission resolves references against.",
      "kind": "database"
    }
  ],
  "threats": [
    {
      "name": "Confidence as permission",
      "text": "A router's high confidence is taken as a grant, budget or evidence for a proposal.",
      "stride": "elevationOfPrivilege",
      "asset": "request",
      "likelihood": "medium",
      "impact": "major",
      "control": {
        "name": "Confidence grants nothing",
        "text": "Admission never reads confidence to decide, and the kernel proves confidence cannot grant a permission or raise a budget.",
        "evidence": [
          {
            "kind": "review",
            "reference": "app/src/ProposalAdmission.lex.tex confidenceCannotGrantPermission"
          },
          {
            "kind": "review",
            "reference": "app/src/ProposalAdmission.lex.tex confidenceCannotIncreaseBudget"
          }
        ]
      }
    },
    {
      "name": "Stale registry",
      "text": "A proposal written against an older registry revision is admitted with contracts that changed.",
      "stride": "tampering",
      "asset": "request",
      "likelihood": "medium",
      "impact": "major",
      "control": {
        "name": "Revision match proved",
        "text": "A stale proposal is never admitted, proved for every request.",
        "evidence": [
          {
            "kind": "proof",
            "reference": "ProposalAdmissionProofs::inv004Holds"
          }
        ]
      }
    },
    {
      "name": "Router-authored contract",
      "text": "A router supplies its own contract text in place of the registered one.",
      "stride": "spoofing",
      "asset": "source",
      "likelihood": "low",
      "impact": "major",
      "accepted": "Admission resolves canonical contracts from the supplied registry by key and version and never accepts router-authored contracts (proposalBoundary); the app sees only the outcome of that resolution."
    }
  ],
  "quality": [
    {
      "characteristic": "Interaction capability",
      "subcharacteristic": "User error protection",
      "requirement": "Ambiguity returned, never guessed",
      "text": "Every ambiguous or unresolved proposal is answered open, so the builder resolves it.",
      "measure": "Guessed proposals",
      "measureText": "Requests with an ambiguity or unresolved constraint answered admit.",
      "threshold": 0
    }
  ],
  "journeys": [
    {
      "stakeholder": "App builder",
      "steps": [
        "REQ-002",
        "REQ-003",
        "REQ-004",
        "otherwise"
      ]
    },
    {
      "stakeholder": "Registry maintainer",
      "steps": [
        "REQ-001",
        "INV-004",
        "INV-003"
      ]
    }
  ],
  "concerns": [],
  "license": "MIT OR Apache-2.0",
  "axioms": {}
}
```

## Claims

- PA-01: The app never answers admit when ambiguity is ambiguous
- PA-02: The app never answers admit when constraints is unresolved
- PA-03: The app never answers admit when conflicts is at least 1
- PA-04: The app never answers admit when revision is stale
- PA-05: The architecture description declares every stakeholder, concern, component, edge, viewpoint and view it references
- PA-06: The ISO/IEC 25010 quality model numbers every characteristic, subcharacteristic, requirement and measure, and every parent it names is declared
- PA-07: Every compliance obligation is numbered in order and names its evidence

## Pattern

Decision table: OMG DMN 1.5, hit policy FIRST. The rules are tried in order, and the first one that matches gives the answer. If none matches, the default answer applies. This is a DMN decision table with the FIRST hit policy.

| Pattern | Standard | Answers |
| --- | --- | --- |
| Decision table | OMG DMN 1.5, hit policy FIRST | admit, refuse, open |

**Figure: Rules for each answer.** Each bar counts the rules that give one answer. When no rule matches, the answer is admit.

|  | rules |
| --- | --- |
| admit | 0 |
| refuse | 2 |
| open | 2 |

## Behavior

A request is revision, ambiguity, constraints, conflicts, separated by spaces. The first rule that matches decides. If none matches, the answer is admit. A request over 112 bytes, or in any other form, is answered invalid.

| Rule | When | Answer | Why |
| --- | --- | --- | --- |
| REQ-001 | revision is stale | refuse | app/src/ProposalAdmission.lex.tex admitProposal: staleIntent and staleRegistry are checked first (staleIntentRefused, staleRegistryRefused) |
| REQ-002 | ambiguity is ambiguous | open | admitProposal: any ambiguity is unresolvedAmbiguity, never a default (ambiguityRefused) |
| REQ-003 | constraints is unresolved | open | admitProposal: an unresolved constraint is unresolvedConstraint (constraintRefused) |
| REQ-004 | conflicts is at least 1 | refuse | app/src/FeatureComposition.lex.tex hasConflict: admitComposition rejects conflicting features (compositionRejected) |
| otherwise | no rule matches | admit | current, unambiguous, resolved and consistent: admitProposal returns the features |

## Properties Lean proves

Each property is a theorem about the same definitions the app is built from. It is proved for every request, not only the tested ones.

| Property | Statement | Theorem | Why |
| --- | --- | --- | --- |
| INV-001 | It never answers admit when ambiguity is ambiguous. | ProposalAdmissionProofs::inv001Holds | no silent defaults |
| INV-002 | It never answers admit when constraints is unresolved. | ProposalAdmissionProofs::inv002Holds | unresolved issues refuse acceptance |
| INV-003 | It never answers admit when conflicts is at least 1. | ProposalAdmissionProofs::inv003Holds | the composition stays consistent |
| INV-004 | It never answers admit when revision is stale. | ProposalAdmissionProofs::inv004Holds | a proposal against an old registry or intent is never admitted |

## Architecture

Stakeholders and the concerns each one views the app through (ISO/IEC/IEEE 42010).

| Stakeholder | Who they are | Concerns |
| --- | --- | --- |
| App builder | Describes an app in plain words and needs only current, unambiguous, consistent parts to reach it. | Proved guarantees, Correct answers |
| Registry maintainer | Publishes versioned feature contracts and needs a proposal made against an older registry revision to be refused. | Proved guarantees |
| Verifier | Anyone who loads the holo, checks its fingerprint and replays its acceptance vectors before trusting an answer. | Integrity of the published app, Refused malformed requests, Proved guarantees |

## Concerns

What the stakeholders care about, and the model each is viewed in.

| Concern | What it means | Model |
| --- | --- | --- |
| Correct answers | Every well-formed request is answered by the first rule that matches it, or admit when none does, as the spec states. | quality |
| Integrity of the published app | What a visitor runs is the holo the build verified, with its fingerprint and signed provenance beside it. | security |
| Proved guarantees | Each of the 4 properties of the spec holds for every request, proved by the Lean kernel. | quality |
| Refused malformed requests | A request that is not the 4 fields in order, or is longer than 112 bytes, is answered invalid and never guessed. | security |

## Components

8 components and 11 edges between them.

| Component | Kind | What it is |
| --- | --- | --- |
| Browser | externalSystem | The visitor's web browser, which loads the page and runs the Proposal admission guest. |
| Feature registry | database | The registry of canonical versioned feature contracts that admission resolves references against. |
| GitHub Pages | externalSystem | Serves the page and the holo from the repository Pages workflow. |
| Prism build | cliAdapter | prismpm verify in the SDK image prismpm.lock pins: it checks every theorem, builds the guest and replays every vector. |
| Proposal admission guest | service | The Core-Wasm guest built from the model: it answers one request of at most 112 bytes with one answer of at most 64. |
| Proposal admission page | staticSite | The page the template publishes: the holo, its fingerprint, its provenance and its acceptance vectors. |
| Router | externalSystem | The model that reads the description and proposes versioned feature references with a confidence; inference belongs to the runner, not the kernel. |
| Source repository | externalSystem | The repository that holds the prompt, the model and its gate. |

## Design views

The SDK checks each view against the system model and draws it as OPL and PlantUML.

| View | Diagram | Viewpoint |
| --- | --- | --- |
| Deciding a Proposal admission request | opmObjectProcess | App builder: Correct answers |
| Components of Proposal admission | umlComponent | Verifier: Integrity of the published app |
| Answering a Proposal admission request | umlSequence | App builder: Correct answers |
| States of the Proposal admission guest | umlStateMachine | Verifier: Refused malformed requests |

## Features and journeys

10 features. Each names the definitions that do the work and the tests that accept it. Each stakeholder has one journey.

| Feature | Calls | Accepted by |
| --- | --- | --- |
| When revision is stale, the answer is refuse. | ProposalAdmission::rule1, ProposalAdmission::judge | ProposalAdmission::application |
| When ambiguity is ambiguous, the answer is open. | ProposalAdmission::rule2, ProposalAdmission::judge | ProposalAdmission::application |
| When constraints is unresolved, the answer is open. | ProposalAdmission::rule3, ProposalAdmission::judge | ProposalAdmission::application |
| When conflicts is at least 1, the answer is refuse. | ProposalAdmission::rule4, ProposalAdmission::judge | ProposalAdmission::application |
| When no rule matches, the answer is admit. | ProposalAdmission::judge | ProposalAdmission::application |
| A request that is not revision, ambiguity, constraints, conflicts in order, separated by single spaces, or is over 112 bytes, is answered invalid. | ProposalAdmission::dispatch, ProposalAdmission::decodeField1 | ProposalAdmission::application |
| It never answers admit when ambiguity is ambiguous. | ProposalAdmission::judge | ProposalAdmissionProofs::inv001Holds |
| It never answers admit when constraints is unresolved. | ProposalAdmission::judge | ProposalAdmissionProofs::inv002Holds |
| It never answers admit when conflicts is at least 1. | ProposalAdmission::judge | ProposalAdmissionProofs::inv003Holds |
| It never answers admit when revision is stale. | ProposalAdmission::judge | ProposalAdmissionProofs::inv004Holds |

## Journeys

The ordered features each stakeholder takes.

| Stakeholder | Steps |
| --- | --- |
| App builder | REQ-002 → REQ-003 → REQ-004 → otherwise |
| Registry maintainer | REQ-001 → INV-004 → INV-003 |
| Verifier | refuse → INV-001 → INV-002 → INV-003 → INV-004 |

## Security and threat model

13 threats against 4 assets. Each has a STRIDE category, and either a control with evidence or a risk that is accepted on purpose.

| Threat | STRIDE | Asset | Risk | Answered by |
| --- | --- | --- | --- | --- |
| Answer that breaks INV-001 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-001: proof ProposalAdmissionProofs::inv001Holds |
| Answer that breaks INV-002 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-002: proof ProposalAdmissionProofs::inv002Holds |
| Answer that breaks INV-003 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-003: proof ProposalAdmissionProofs::inv003Holds |
| Answer that breaks INV-004 | repudiation | Answer | medium likelihood, critical impact | Proof of INV-004: proof ProposalAdmissionProofs::inv004Holds |
| Confidence as permission | elevationOfPrivilege | Request bytes | medium likelihood, major impact | Confidence grants nothing: review app/src/ProposalAdmission.lex.tex confidenceCannotGrantPermission; review app/src/ProposalAdmission.lex.tex confidenceCannotIncreaseBudget |
| Granted capability | informationDisclosure | Answer | low likelihood, major impact | No capability granted: gate prism-code check refuses an ungranted guest import |
| Malformed request | tampering | Request bytes | high likelihood, major impact | Strict decoder: gate malformed-request acceptance vectors, replayed in the compiled guest by prismpm verify |
| Oversized request | denialOfService | Request bytes | medium likelihood, minor impact | Bounded request: gate acceptance vectors at the request bound, one byte over it, and at the guest allocation bound, replayed by prismpm verify |
| Router-authored contract | spoofing | Model source | low likelihood, major impact | accepted: Admission resolves canonical contracts from the supplied registry by key and version and never accepts router-authored contracts (proposalBoundary); the app sees only the outcome of that resolution. |
| Stale registry | tampering | Request bytes | medium likelihood, major impact | Revision match proved: proof ProposalAdmissionProofs::inv004Holds |
| Substituted holo | spoofing | Published holo | low likelihood, critical impact | Fingerprint and provenance: gate actions/attest-build-provenance in the pages workflow; gate prism-code check of the holo identities in the page |
| Substituted host | spoofing | Published holo | low likelihood, critical impact | accepted: A page cannot defend against its own host. The holo carries signed build provenance a visitor can check, and the app can be rebuilt from its prompt. |
| Tampered model | tampering | Model source | low likelihood, major impact | Regenerated from the prompt: gate prismpm verify in the SDK image prismpm.lock pins; review app/prompt.json |

## Quality

ISO/IEC 25010:2023 requirements. Each has a measure and a threshold that a theorem pins.

| Requirement | Characteristic | Measure | Threshold |
| --- | --- | --- | --- |
| Ambiguity returned, never guessed: Every ambiguous or unresolved proposal is answered open, so the builder resolves it. | Interaction capability: User error protection | Guessed proposals | 0 |
| Bounded allocation: The guest allocates at most 224 bytes for one request. | Performance efficiency: Resource utilization | Guest allocation bytes | 224 |
| Bounded request: A request over 112 bytes is refused before any field is read. | Performance efficiency: Time behaviour | Request bytes read | 112 |
| Every property proved: All 4 properties are theorems the Lean kernel checks. | Security: Integrity | Unproved properties | 0 |
| Every request answered: Every request gets an answer: a rule, admit otherwise, or invalid. | Functional suitability: Functional completeness | Unanswered requests | 0 |
| Every vector replays: All 36 acceptance vectors replay in the compiled guest, the shortest 0 bytes long. | Reliability: Faultlessness | Failed vectors | 0 |
| Examples answered as stated: Every one of the 6 examples of the spec is answered as it states. | Functional suitability: Functional correctness | Example mismatches | 0 |

## Compliance

One obligation per standard, each naming its evidence.

| Standard | Subject | Evidence |
| --- | --- | --- |
| ISO/IEC/IEEE 42010:2022 | Architecture description | Architecture::architectureDescriptionHolds |
| ISO/PAS 19450:2015 and OMG UML 2.5.1 | Design views | Design::viewOpmDecide, Design::viewUmlComponents, Design::viewUmlRequest, Design::viewUmlStates |
| ISO/IEC 25010:2023 | Product quality | Quality::qualityModelHolds |
| ISO/IEC 27034-1:2011 and ISO/IEC 27005:2022 | Application security and risk | Security::controlSet |
| OMG DMN 1.5, hit policy FIRST | Decision table | ProposalAdmission::judge |
| OpenSpec | Requirements | ProposalAdmission::application |
| SPDX MIT OR Apache-2.0 | Licensing | ProposalAdmission::application |

## Rendered design views

Written by the SDK from the design records when it verified the app.

### design/Design.viewOpmDecide.opl

```
View: Design::viewOpmDecide
Title: Deciding a Proposal admission request
Viewpoint: Architecture::viewpointAppBuilderCorrectAnswers
Notation: ISO/PAS 19450:2015 OPM, Prism OPL profile

componentBrowser is an object.
componentProposalAdmissionGuest is an object.
componentProposalAdmissionGuest can be stateDeciding or stateIdle.
processDecide is a process.
processEncodeAnswer is a process.
processJudge is a process.
processParseRequest is a process.
componentProposalAdmissionGuest handles processDecide.
processParseRequest requires componentBrowser.
processEncodeAnswer affects componentBrowser.
processJudge invokes processEncodeAnswer.
processParseRequest invokes processJudge.
processDecide zooms into processParseRequest, processJudge, and processEncodeAnswer, in that sequence.

```

### design/Design.viewUmlComponents.puml

```
@startuml
' UML 2.5.1 component diagram
' view: Design::viewUmlComponents
' viewpoint: Architecture::viewpointVerifierIntegrityOfThePublishedApp
title Components of Proposal admission
component "componentBrowser" as c0
component "componentFeatureRegistry" as c1
component "componentGitHubPages" as c2
component "componentPrismBuild" as c3
component "componentProposalAdmissionGuest" as c4
component "componentProposalAdmissionPage" as c5
component "componentRouter" as c6
component "componentSourceRepository" as c7
c0 --> c4 : edgeBrowserToProposalAdmissionGuest
c1 --> c4 : edgeFeatureRegistryToProposalAdmissionGuest
c2 --> c0 : edgeGitHubPagesToBrowser
c3 --> c4 : edgePrismBuildToProposalAdmissionGuest
c3 --> c5 : edgePrismBuildToProposalAdmissionPage
c4 --> c0 : edgeProposalAdmissionGuestToBrowser
c4 --> c1 : edgeProposalAdmissionGuestToFeatureRegistry
c4 --> c6 : edgeProposalAdmissionGuestToRouter
c5 --> c2 : edgeProposalAdmissionPageToGitHubPages
c6 --> c4 : edgeRouterToProposalAdmissionGuest
c7 --> c3 : edgeSourceRepositoryToPrismBuild
@enduml

```

### design/Design.viewUmlRequest.puml

```
@startuml
' UML 2.5.1 sequence diagram
' view: Design::viewUmlRequest
' viewpoint: Architecture::viewpointAppBuilderCorrectAnswers
title Answering a Proposal admission request
participant "componentBrowser" as p0
participant "componentProposalAdmissionGuest" as p1
p0 -> p1 : processDecide
p1 --> p0 : processDecide
@enduml

```

### design/Design.viewUmlStates.puml

```
@startuml
' UML 2.5.1 state machine diagram
' view: Design::viewUmlStates
' viewpoint: Architecture::viewpointVerifierRefusedMalformedRequests
title States of the Proposal admission guest
state "stateAnsweredAdmit" as s0
state "stateAnsweredOpen" as s1
state "stateAnsweredRefuse" as s2
state "stateDeciding" as s3
state "stateIdle" as s4
state "stateRefused" as s5
[*] --> s4
s4 --> s3 : processParseRequest
s4 --> s5 : processParseRequest
s3 --> s2 : processRule1
s3 --> s1 : processRule2
s3 --> s1 : processRule3
s3 --> s2 : processRule4
s3 --> s0 : processOtherwise
s0 --> s4 : processEncodeAnswer
s2 --> s4 : processEncodeAnswer
s1 --> s4 : processEncodeAnswer
s5 --> s4 : processEncodeAnswer
@enduml

```

## Prism source

Every file the builder wrote, laid out as a repository created from UOR-Foundation/template; the download prism-proposal-admission.zip has them all.

- app/src/Architecture.lex.tex (392 lines)
- app/src/Compliance.lex.tex (56 lines)
- app/src/Design.lex.tex (549 lines)
- app/src/Features.lex.tex (130 lines)
- app/src/Quality.lex.tex (361 lines)
- app/src/Security.lex.tex (593 lines)
- app/src/ProposalAdmission.lex.tex (233 lines)
- app/src/ProposalAdmissionProofs.lex.tex (141 lines)
- app/lexlean.toml (43 lines)
- app/prompt.json (294 lines)
- model/ids.toml (65 lines)
- features/suites/proposal\_admission.feature (44 lines)
- crates/conformance/tests/proposal\_admission.rs (132 lines)
- site/app.json (113 lines)
- openspec/specs/proposal-admission/spec.md (171 lines)
