Skip to content

Commit 5eeba2c

Browse files
cemililikclaude
andcommitted
docs(decisions): record the PR #45 review disposition in ADR-0099
ADR-0099 gains Amendment 9: the behavior now implemented as the record says, and the decisions the record was silent on (transport revocation, a nonconforming broker, a test no one finishes, the detail read as an exception to GET, the carrier list, the five steps, the adapter not reading the idp mapper, the persistence of a pre-registered link, the undelivered confirm-link copy and a superseded Complete). The false mapper-readback statement gets two inline errata. ADR-0021's key-name correction is a dated blockquote instead of a code comment. Standards 01, 03, 04, 05, 07, 11 and 21, the identity module spec, the glossary and the Keycloak guide follow the code; Phase 11 now owns the production realm invariants, pre-registered accounts and the confirm-link copy. The Phase 03 delivery log records each review finding's disposition, what was not changed and why, the second review round of Step 0, and the verification run. ADR: 0099 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent d9c2925 commit 5eeba2c

19 files changed

Lines changed: 339 additions & 34 deletions

‎docs/decisions/0021-feature-based-entitlement.md‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ Adopt **Option A**: feature-based entitlements.
131131

132132
### Typed key registries
133133

134+
> **Erratum (2026-11-13, [ADR-0099](0099-confined-tenant-federation.md)).** The SSO
135+
> keys in this block are spelled `sso.saml.enabled` and `sso.oidc.enabled`; the
136+
> implemented keys are `identity.sso.saml` and `identity.sso.oidc`. See
137+
> [the dated amendment below](#2026-11-13--sso-key-names).
138+
134139
```csharp
135140
namespace LearnStack.SharedKernel.FeatureFlags;
136141

@@ -216,6 +221,9 @@ refreshed on `tenant.entitlement.updated` integration event.
216221

217222
A `Plan` row in Hub's database carries:
218223

224+
> **Erratum (2026-11-13, [ADR-0099](0099-confined-tenant-federation.md)).** The `sso.saml.enabled` key in this example is
225+
> `identity.sso.saml` in the implemented registry. See [the dated amendment below](#2026-11-13--sso-key-names).
226+
219227
```json
220228
{
221229
"id": "plan-growth-monthly",
@@ -537,6 +545,6 @@ speculatively. No key is invented, and a key the contract does not name is not a
537545
[ADR-0045 Amendment 2](0045-entitlement-and-feature-flag-socket.md) says the same of
538546
`FeatureKeys` and `KillswitchKeys`.
539547

540-
### Amendment 1 — SSO key names (2026-11-13)
548+
### 2026-11-13 — SSO key names
541549

542550
The SSO feature keys are `identity.sso.saml` and `identity.sso.oidc`. Both are plan-projected, default false and fail-closed in both repositories. The `sso.saml.enabled` and `sso.oidc.enabled` spellings in the sketch above were never the implemented names; the inline erratum records that. [ADR-0099](../decisions/0099-confined-tenant-federation.md) gates OIDC connections on `identity.sso.oidc`, and no Hub plan row carries that key yet.

‎docs/decisions/0099-confined-tenant-federation.md‎

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,14 @@ Realm reconciliation owns these, and the Step 3 tests assert them:
277277
The adapter cannot read these invariants. Phase 11's production identity provisioning must
278278
replicate them; this record does not assume that.
279279

280+
> **Erratum (2026-11-18,
281+
> [Amendment 9](#amendment-9--pr-review-behavior-corrected-to-this-record-and-decisions-recorded-2026-11-18)).**
282+
> The Realm invariants bullet above and the Residual in § Host binding say that
283+
> enablement requires a readback of the `idp` mapper. That was false when written: the
284+
> adapter holds `manage-identity-providers` only and cannot read a client's mappers, as
285+
> the paragraph above says. Realm reconciliation creates the mapper, verifies it and
286+
> refuses a second emitter; enablement checks nothing about it.
287+
280288
### Bounded egress
281289

282290
`IFederationEgressFetcher` retrieves OIDC discovery and JWKS documents or SAML metadata.
@@ -383,6 +391,11 @@ Outcomes:
383391
mapper readback, and startup reconciliation detects drift. Manual realm edits by an operator are
384392
outside this contract.
385393

394+
> **Erratum (2026-11-18,
395+
> [Amendment 9](#amendment-9--pr-review-behavior-corrected-to-this-record-and-decisions-recorded-2026-11-18)).**
396+
> Enablement requires no mapper readback; see the erratum in § Realm invariants. Realm
397+
> reconciliation, not the adapter, detects a missing or second `idp` emitter.
398+
386399
### Lifecycle and test
387400

388401
| State | Provider enabled | Advertised | Brokered sessions admitted |
@@ -966,3 +979,101 @@ of Amendments 6 and 7 is unchanged. The Decision is unchanged.
966979

967980
The [Phase 03 delivery log](../roadmap/phase-03-delivery-log.md) holds the review record
968981
and its proof.
982+
983+
### Amendment 9 — PR review: behavior corrected to this record, and decisions recorded (2026-11-18)
984+
985+
The independent reviews of PR #45 found three places where the code did not do what this
986+
record says, and several where this record was silent or its carrier list was stale. The
987+
Decision is unchanged.
988+
989+
**Behavior now as this record says.**
990+
991+
1. **Entitlement lapse.** § Lifecycle says the broker is disabled by the next operation
992+
or readback after a lapse. The detail read now runs the ordinary Disable for an
993+
Active connection whose protocol is no longer entitled, with its own MUST audit row
994+
and the reading administrator as its actor. A Draft or Disabled connection advertises
995+
nothing and a test window ends on its own, so nothing is written for them.
996+
997+
2. **A lost test start.** Resume of a pending test start no longer opens a test. The
998+
attempt belongs only to the server-side owner that started it (Amendment 6 item 2),
999+
and a browser-driven Resume is not that owner. The start settles as
1000+
`resubmit_required`, the connection stays in Draft, and the next readback disables a
1001+
broker found enabled.
1002+
1003+
3. **An unconfirmed desired state.** A refused Rename of an Active connection leaves the
1004+
provider at its old, confirmed state, which the "recorded once" rule counted as
1005+
already recorded. Recording drift returns a connection to Draft, so a connection that
1006+
is not in Draft and whose provider differs from the desired state has not recorded
1007+
it, and the next readback records the drift (§ Provider writes).
1008+
1009+
**Decisions recorded.** None changes behavior.
1010+
1011+
4. **Transport revocation.** Egress does not check certificate revocation, for
1012+
tenant-chosen and allow-listed hosts alike. That is the platform default, and an OCSP
1013+
or CRL fetch is an outbound request to a host the certificate names, a fetch surface
1014+
of its own. The address-class guard, SNI and chain validation stand.
1015+
1016+
5. **A nonconforming broker.** One that holds an extra mapper or a changed fixed profile
1017+
is recorded as drift and left as found. No corrective write starts from a state the
1018+
adapter cannot prove, so the corrective disabling write of § Provider writes does
1019+
not apply to it. The P03-9 operator step repairs it, and Studio shows the drift.
1020+
1021+
6. **A test no one finishes.** A test completed by a subject without administrator
1022+
authority cannot record its failure, and a test whose browser closes records nothing.
1023+
Both end when the window closes; that expiry is the abandonment path of § Lifecycle,
1024+
and Reconfigure or Delete is available meanwhile. The sign-in itself shares the BFF's
1025+
five-minute transaction ceiling, inside the ten-minute window.
1026+
1027+
7. **Any exception after Begin settles uncertain.** The catch is broad on purpose. An
1028+
exception nobody foresaw still leaves the operation pending, never silently applied,
1029+
and Resume settles it by readback.
1030+
1031+
8. **The detail read is a recorded exception to GET without side effects**, stated in
1032+
[API Standards](../standards/04-api-design.md) § Etiquette.
1033+
1034+
9. **Carriers.** The carriers that landed with the steps are Standards 01 (the
1035+
intent-first tier, added by the review), 04, 05, 06, 07, 11, 12, 18, 19, 20 and 21,
1036+
the glossary and the module specifications. Standards 09 and 10 are unchanged:
1037+
federation adds no error-code family and no telemetry rule, and egress
1038+
instrumentation is suppressed because its destination is tenant-chosen.
1039+
1040+
10. **Steps.** The record lists five steps, 0 to 4. The Status line's "four steps,
1041+
including the pin move" miscounts them.
1042+
1043+
11. **The `idp` mapper is not read by the adapter.** The erratum in § Realm invariants
1044+
corrects the claim that enablement reads it. What holds is realm reconciliation: it
1045+
creates the mapper, verifies it and refuses a second emitter, and it runs with
1046+
`make seed` and `make demo`. A production realm that lacks the mapper makes brokered
1047+
tokens look local and opens the host binding, so
1048+
[Phase 11](../roadmap/phase-11-production-hardening.md) replicates and verifies
1049+
every realm invariant of this record before a production tenant enables federation.
1050+
1051+
12. **A pre-registered account stays linked.** Under open registration with
1052+
`verifyEmail` false, a person can register another person's address with a password
1053+
they know. If their own IdP then asserts that address, the link-only flow links it,
1054+
since they hold the account's credentials. The address owner's later password reset
1055+
replaces the password but does not remove the link, so that IdP keeps a way into the
1056+
account and into a fresh credential action. Before federation a reset ended such a
1057+
registration. § Linking is right that federation does not create it and wrong that
1058+
nothing changes: the link makes it persistent. The residual stays accepted for the
1059+
development realm, whose registration is open by design.
1060+
[Phase 11](../roadmap/phase-11-production-hardening.md) decides, before a production
1061+
realm admits federation, whether linking requires a verified address or registration
1062+
is closed; removing a link is account review (Decision Q1).
1063+
1064+
13. **The confirm-link copy is not delivered.** § Linking says that Studio, the runbook
1065+
and the confirm-link copy state the delegation risk. The realm ships no localization
1066+
text or theme, so the confirm-link page is Keycloak's own. Studio, beside the single
1067+
sign-on form, and the Keycloak guide carry the warning; a themed confirm-link page
1068+
belongs to the production realm theme that
1069+
[Phase 11](../roadmap/phase-11-production-hardening.md) owns.
1070+
1071+
14. **A superseded Complete records no drift.** § Intent-first operations says it does;
1072+
the code does not and is right. A superseded identifier's Complete changes nothing
1073+
and its MUST audit row records that it arrived. Drift is recorded only by a readback
1074+
that finds it, and a connection whose state moved on is owned by the operation that
1075+
moved it.
1076+
1077+
The
1078+
[Phase 03 delivery log](../roadmap/phase-03-delivery-log.md#p03-8-pr-review-disposition-2026-11-18)
1079+
holds the review record, each finding's disposition and its proof.

‎docs/decisions/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ records hosted qualification. Phase 11 owns production qualification.
141141
| 0096 | [P03-5 Administration Contract Baseline](0096-p035-administration-contract-baseline.md) | Accepted 2026-11-10 after maintainer review and development-only/no-active-use confirmation: one exact snapshot/finding/comparator-bound incompatibility, with coordinated consumers and separate runtime/CI proof. Delivery stays in the [Phase 03 Status](../roadmap/phase-03-identity-admin.md). |
142142
| 0097 | [Retained Provider Events and Tenant Audit Mirror](0097-retained-provider-events-and-tenant-audit-mirror.md) | Accepted 2026-11-11 after maintainer review: confined machine intake, finite pull recovery, nonblocking durable problem handling and frozen tenant Audit targets; implementation/qualification stay in the [Phase 03 Status](../roadmap/phase-03-identity-admin.md). |
143143
| 0098 | [Session-Targeted Back-Channel Logout](0098-session-targeted-back-channel-logout.md) | Accepted 2026-11-12 after maintainer review: signed sid-targeted native notification, bounded replay/late-publication fences and owned callback-only TLS reachability; delivery/proof remain in the [Phase 03 Status](../roadmap/phase-03-identity-admin.md). |
144-
| 0099 | [Confined Tenant Federation](0099-confined-tenant-federation.md) | Accepted 2026-11-13 after three review rounds and the maintainer's decisions: a fixed-alias, LearnStack-owned connection per tenant; a dedicated Admin adapter with a fixed broker profile; a bounded egress guard with a documented Standard 11 A10 exception; a link-only first-broker flow with no broker-created accounts and no self-unlink; the broker enabled at the provider only in test windows and when Active; host-bound brokered sessions; serialized, readback-verified provider writes. Implementation Step 0 (Keycloak pin to 26.7.5) is committed in `ed168594`; Step 1 (registry v4 key, connection aggregate and storage) is committed in `7928fc8b`–`37af223c` with fixes through `30d94bb5`; Step 2 (application operations and API) is committed in `8e435ed6`–`91501770` with round-one and round-two review corrections; Step 3 (egress fetcher, Keycloak adapter and realm invariants) is committed in `d166e12d` with round-one and round-two review corrections; Step 4 (native BFF host binding and `federation_test`, the Studio page and the brokered SAML proof) is committed with round-one review corrections and awaits its second review round. [Amendment 2](0099-confined-tenant-federation.md#amendment-2--keycloak-pin-decision-2026-11-13) pins 26.7.5 because no 26.6.5 image is published; [Amendment 3](0099-confined-tenant-federation.md#amendment-3--a-changed-oidc-configuration-needs-a-fresh-secret-2026-11-14) requires a fresh secret for a changed OIDC configuration; [Amendment 4](0099-confined-tenant-federation.md#amendment-4--corrective-disable-writes-and-gated-rotate-and-activate-2026-11-14) records the corrective disabling writes and the gated Rotate secret and Activate; [Amendment 5](0099-confined-tenant-federation.md#amendment-5--step-3-review-egress-adapter-and-linking-decisions-2026-11-14) records the Step 3 egress, allow-list, adapter-defence and reset-action decisions and the open brokered SAML login; [Amendment 6](0099-confined-tenant-federation.md#amendment-6--host-alias-carrier-and-test-record-carrier-2026-11-14) records the host-alias setter and the `federation.test_record` carrier; [Amendment 7](0099-confined-tenant-federation.md#amendment-7--step-4-review-purposes-test-freshness-and-detail-loads-2026-11-15) records the Step 4 review's purpose, test-freshness, detail-load and availability statements. |
144+
| 0099 | [Confined Tenant Federation](0099-confined-tenant-federation.md) | Accepted 2026-11-13 after three review rounds and the maintainer's decisions: a fixed-alias, LearnStack-owned connection per tenant; a dedicated Admin adapter with a fixed broker profile; a bounded egress guard with a documented Standard 11 A10 exception; a link-only first-broker flow with no broker-created accounts and no self-unlink; the broker enabled at the provider only in test windows and when Active; host-bound brokered sessions; serialized, readback-verified provider writes. Implementation Step 0 (Keycloak pin to 26.7.5) is committed in `ed168594`; Step 1 (registry v4 key, connection aggregate and storage) is committed in `7928fc8b`–`37af223c` with fixes through `30d94bb5`; Step 2 (application operations and API) is committed in `8e435ed6`–`91501770` with round-one and round-two review corrections; Step 3 (egress fetcher, Keycloak adapter and realm invariants) is committed in `d166e12d` with round-one and round-two review corrections; Step 4 (native BFF host binding and `federation_test`, the Studio page and the brokered SAML proof) is committed with round-one and round-two review corrections. [Amendment 2](0099-confined-tenant-federation.md#amendment-2--keycloak-pin-decision-2026-11-13) pins 26.7.5 because no 26.6.5 image is published; [Amendment 3](0099-confined-tenant-federation.md#amendment-3--a-changed-oidc-configuration-needs-a-fresh-secret-2026-11-14) requires a fresh secret for a changed OIDC configuration; [Amendment 4](0099-confined-tenant-federation.md#amendment-4--corrective-disable-writes-and-gated-rotate-and-activate-2026-11-14) records the corrective disabling writes and the gated Rotate secret and Activate; [Amendment 5](0099-confined-tenant-federation.md#amendment-5--step-3-review-egress-adapter-and-linking-decisions-2026-11-14) records the Step 3 egress, allow-list, adapter-defence and reset-action decisions and the open brokered SAML login; [Amendment 6](0099-confined-tenant-federation.md#amendment-6--host-alias-carrier-and-test-record-carrier-2026-11-14) records the host-alias setter and the `federation.test_record` carrier; [Amendment 7](0099-confined-tenant-federation.md#amendment-7--step-4-review-purposes-test-freshness-and-detail-loads-2026-11-15) records the Step 4 review's purpose, test-freshness, detail-load and availability statements; [Amendment 8](0099-confined-tenant-federation.md#amendment-8--step-4-review-round-2-test-session-replacement-and-scope-confinement-2026-11-15) records the test-session replacement and scope-confinement corrections; [Amendment 9](0099-confined-tenant-federation.md#amendment-9--pr-review-behavior-corrected-to-this-record-and-decisions-recorded-2026-11-18) records the PR review's behavior corrections and recorded decisions. |
145145
| 0100 | [P03-8 Federation Contract Transition](0100-p038-federation-contract-transition.md) | Accepted 2026-11-18 after the maintainer's review, four independent reviews and the development-only/no-active-use confirmation: one exact snapshot-, finding- and comparator-bound incompatibility for registry v4, federation administration and the self `federationAlias`, one carrier per ADR and a stated end of the exception's basis; the later growth of the closed grant contract stays open as G20; delivery and proof remain in the [Phase 03 Status](../roadmap/phase-03-identity-admin.md). |
146146

147147
## Proposed ADRs

‎docs/glossary.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ This glossary defines LearnStack-specific terms. When a term is ambiguous across
5353
| **Provider session target** | Exact verified issuer and opaque provider `sid`, optionally constrained by the token's subject. It identifies provider SSO rather than a tenant, browser handle or application scope; [ADR-0098](decisions/0098-session-targeted-back-channel-logout.md) describes its notification use. |
5454
| **Logout publication fence** | Retained target evidence preventing matching delayed credential work from publishing after an accepted native logout notification. It is separate from token replay evidence and supplies no physical retirement credit; [ADR-0098](decisions/0098-session-targeted-back-channel-logout.md) owns its contract. |
5555
| **Back-channel TLS bridge** | A fixed-purpose local transport from the provider container to the native logout handler, with independently configured TLS and no caller-selected forwarding destination. [ADR-0098](decisions/0098-session-targeted-back-channel-logout.md) describes its bounded ownership. |
56-
| **Federation connection** | The one tenant-owned record of a tenant's brokered SAML/OIDC identity provider, with a state (Draft, TestOpen, TestPassed, Active, Disabled), a configuration revision and no stored secret. It confines a realm-level broker to its tenant; [ADR-0099](decisions/0099-confined-tenant-federation.md) defines its contract. |
56+
| **Federation connection** | The one tenant-owned record of a tenant's brokered SAML/OIDC identity provider, with a state (Draft, TestOpen, TestPassed, Active, Disabled, and the terminal Deleted tombstone), a configuration revision and no stored secret. It confines a realm-level broker to its tenant; [ADR-0099](decisions/0099-confined-tenant-federation.md) defines its contract. |
5757
| **Federation alias** | The opaque Keycloak broker alias LearnStack derives from a connection ID. It is a provider hint, not a secret and never tenant input; [ADR-0099](decisions/0099-confined-tenant-federation.md) defines its ownership proof. |
5858
| **Federation test attempt** | A single-use, short-lived, actor- and revision-bound real broker sign-in as the administrator's own account that discards its tokens, publishes no session and ends in a sign-out. Its result gates activation but is an administrator-run check, not a security control; [ADR-0099](decisions/0099-confined-tenant-federation.md) defines its contract. |
5959
| **Brokered session** | A LearnStack browser session whose authentication came through a tenant's brokered identity provider, recognized by the `idp` claim and its recorded provenance. Admitted only on its own tenant's host while that tenant's connection is Active; [ADR-0099](decisions/0099-confined-tenant-federation.md) decides the host binding and [Security § Federation host binding](standards/11-security.md#federation-host-binding) states its rules. |

0 commit comments

Comments
 (0)