feat: share grpc mapped authorization and authority leases
This commit is contained in:
@@ -17,8 +17,8 @@ The [implementation plan](../../2026-11-15-grpc-data-connections-implementation-
|
||||
|---|---|---|---|
|
||||
| P00 | Unit discovery isolation and execution controls | Passed | 22 Python runner units after Astra correction; 2 C# guard units, zero failures/skips; clean phase run `20261116T020813.843515Z-2ebe0fbcb7d2` |
|
||||
| P01 | Domain/protobuf contracts | Passed; Astra freeze approved | 15 domain + 36 wire tests, zero failures/skips; run `20261116T024814.318745Z-3a06bbb5af5e` |
|
||||
| P02 | Schema/artifact/consumer projection | In progress | Schema/validator worker next; artifact projection follows entity freeze |
|
||||
| P03 | Shared authorization and leases | Pending | |
|
||||
| P02 | Schema/artifact/consumer projection | Passed; Astra approved | 72 F + 31 P + 106 R, no failures/skips; final run `20261116T034337.311145Z-cd97a339f340` |
|
||||
| P03 | Shared authorization and leases | Passed; Astra approved | 77 K + 89 O + 53 R + 19 H, no failures/skips; final run `20261116T034150.797719Z-8f107e03d8d5` |
|
||||
| P04 | Immutable publication, hub and local ports | Pending | |
|
||||
| P05 | Mutation tickets/outcomes | Pending | |
|
||||
| P06 | Streams/sharing/fair delivery | Pending | |
|
||||
@@ -55,6 +55,18 @@ The [implementation plan](../../2026-11-15-grpc-data-connections-implementation-
|
||||
|
||||
Runtime artifacts belong under ignored `artifacts/grpc-data/`; this tracked ledger indexes redacted outcomes only. It must never contain private keys, bearer values, credential-bearing manifests or a claim that pending phases passed.
|
||||
|
||||
## P02/P03 execution notes
|
||||
|
||||
P02 configuration expected missing-type RED was recorded in run `20261116T025514.238285Z-0bf94bfed2ac`; the configuration class passed after implementation in `20261116T030638.024513Z-33f85cfb6582`. Existing ACL-scope regressions passed 61 tests in `20261116T031441.427791Z-5bb7ca84cb53` (the runner accepts one `--case`; repeated arguments select only the last). The artifact facade expected missing-API RED is `20261116T030553.410191Z-8f8f4b4ccf8c`. The final complete P02 gate passed 200 tests in `20261116T032931.523374Z-3193b02872a9` after cross-cluster root, null topology, null logical-ID and rollback SQL regressions. EF 10.0.7 generated migration `20261116030721_AddGrpcDataConnections` using only a nonconnecting loopback design-time connection; no database update was run. The migration adds three scoped tables and widens ACL scope storage to 32 characters. Down removes the new tables but intentionally retains the additive wider ACL column: retained mapping grants have a 22-character scope name and cannot safely be narrowed to 16. Disable the feature before rolling binaries back; disposable SQL apply/reapply/backward-disable validation remains P10.
|
||||
|
||||
P03 Core and SDK expected missing-API RED runs are `20261116T030857.315836Z-8e4d976e1036` and `20261116T030939.707449Z-d4e6daf64857`. Runtime lease/activation tests also produced missing-class compilation RED in `20261116T031033.611505Z-6b121246eb2e`; this temporarily blocked P02 Runtime tests, so no artifact assertion failure is inferred from that run. Metadata leases use monotonic request-start time and an application-owned lease object, never a caller-provided expiry. Ordinary SDK subscriptions have an internally queued delivery path; P03 rejects mapped subscription admission until P08 supplies and verifies an SDK publish-time gate. This is an explicit incomplete integration requirement, not completed subscription support.
|
||||
|
||||
Final [Astra P02/P03 review](p02-p03-astra-review.md) closes all five findings against the final source hashes and complete gates. P02 finished with 209 passes after JSON alias/shadow regressions (actual RED: seven failures/59 passes in `20261116T033408.997103Z-68c99377553c`) and empty-array local compatibility correction. P03 finished with 238 passes. Parsed revocations now survive topology-planning and mapping/eligibility projection failures; invalid topology suppresses new data readiness. Mapped proofs require an exact active local catalog token and matching local authority generation, independently of the remote lease's exact serving identity. A new catalog Begin invalidates the token even on a same-authority no-op rebuild. Runtime actor and projection tests exercise these boundaries. P03 additionally runs the existing Stage6, off-thread/deferred actor and Host authentication classes because their credential/publication paths changed. Stage6 dedup assertions compare measured warm single-node cost with same-node/distinct-node passes, preserving required credential-expiry checks.
|
||||
|
||||
## P10 harness preparation
|
||||
|
||||
Independent Python helpers for local-context validation, fixture endpoint/manifest isolation, ownership-only cleanup, atomic secret files, bounded/redacted processes, deployment outcome polling and CLI result validation have test-first preparation evidence: initial discovery failed on missing modules; the focused combined run subsequently passed 44 tests. This is not the P10 gate. Concrete Compose, SQL/device/seeder, TLS/provisioning, runtime observation, CLI/probe scenarios and actual Docker integration remain pending. No containers or databases have been modified.
|
||||
|
||||
## P00 verification
|
||||
|
||||
The runner tests first failed as expected while `run-unit-phase.py` was absent. After initial implementation, 18 fake-subprocess Python units passed. Astra found required existing regression classes were not enforced as strictly as new classes; four added regression tests failed before the correction. The final 22 Python tests passed, with red/green logs in `artifacts/grpc-data/p00-runner-regressions/`. The real P00 discovery/execution runner passed both counting-probe/reaper C# tests with no skips; the starting production graph compiled successfully. No solution test run or Docker mutation occurred. Raw TRX/commands/discovery identities remain in ignored artifacts. The runner validates discovery AND executed results for every required new class, retains parameterized class filters, and sanitizes both child environments. Astra approved P00 after the required-existing-class correction; see [checkpoint review](p00-astra-review.md).
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
# P02/P03 Astra checkpoint review
|
||||
|
||||
**Disposition: P02 approved; P03 security/policy checkpoint approved. All five findings are resolved.** This approval covers the configuration/artifact and policy/activation foundations reviewed here; it does not claim that the complete gRPC data feature or later mapped SDK behavior is implemented. Review began against `443e08340321515170223a84abb4a3689fbfe94f` plus the coordinator's frozen candidate. The reviewer inspected the plan, design, evidence ledger, new configuration/artifact/policy/SDK/runtime code and their tests. The reviewer did not execute tests, builds, migrations, or Docker, and changed only this document.
|
||||
|
||||
## Final evidence and candidate reconciliation
|
||||
|
||||
| Phase | Final run | Passing tests | Failures / skips | Disposition |
|
||||
|---|---|---|---|---|
|
||||
| P02 | `20261116T034337.311145Z-cd97a339f340` | Configuration 72; ControlPlane 31; Runtime 106 — **209 total** | 0 / 0 | Approved |
|
||||
| P03 | `20261116T034150.797719Z-8f107e03d8d5` | Core 77; SDK 89; Runtime 53; Host 19 — **238 total** | 0 / 0 | Approved |
|
||||
|
||||
The reviewer inspected both saved `unit/<phase>/run.json` reports. Every required new and existing class executed. P03 also includes the applicable Stage6, deferred/off-thread actor and Host key-authentication regressions added to the manifest for changed paths. For both runs, all 24 recorded new source/test file digests match the final files on disk, and the complete tracked `git diff HEAD --binary` digest matches `6ed4b670e2e308cf82317c382b4138ecd4939c38974b7bd1f7815b1feb7f6fdd`. No production changes intervened between these runs and final source rereview. Subsequent edits to this review document are the review-only evidence update.
|
||||
|
||||
The finding descriptions and intermediate results below preserve the review history. Their final dispositions are resolved; earlier requests for follow-up evidence have been satisfied by the final runs above.
|
||||
|
||||
## Intermediate evidence
|
||||
|
||||
The completed P02 run `20261116T031919.862291Z-1a9316f08b54` reports 71 Configuration, 31 ControlPlane and 87 Runtime tests passing (189 total), zero failures/skips, with all required new and existing classes executed. Its candidate identity is recorded in `artifacts/grpc-data/20261116T031919.862291Z-1a9316f08b54/unit/P02/run.json`. This predates the findings below and did not establish their corrections.
|
||||
|
||||
The subsequent full P02 run `20261116T032931.523374Z-3193b02872a9` passed 72 Configuration, 31 ControlPlane and 97 Runtime tests (200 total), zero failures/skips, with all required classes present. The reviewer compared the recorded new P02 source/test digests with disk; all matched at that rereview. This resolved M3 and the original canonical-property M1 cases. M1's case-insensitive-deserialization residual was then corrected and covered by the final P02 gate.
|
||||
|
||||
Line references below describe the reviewed initial candidate; fixes may move them.
|
||||
|
||||
## H1 — Preserve parsed revocations when topology planning fails
|
||||
|
||||
**Severity: High. Status: resolved.** The initial `Runtime/OpcUa/OpcUaPublishActor.cs:845–862` first obtained a valid authority projection, then called `ParseComposition` and `AddressSpacePlanner.Compute`. If either topology step threw, `PipeTo` produced `PlanFailed`, which did not carry the already parsed authority. `HandlePlanFailed` at lines 888–895 reported degradation without publishing that authority. A valid key/grant revocation bundled with malformed topology therefore left the previous authority installed. Closing the new data catalog did not revoke the ordinary local API-key authority.
|
||||
|
||||
Task 7 explicitly requires authority publication independently of failed topology, without rolling back revocations. Carry successful authority parsing through a topology-planning failure and publish it on the actor thread before returning the degraded outcome. Keep the catalog unavailable. A real actor regression must deploy changed valid authority alongside a composition/planning failure, then verify the new authority generation and revoked key/grant remain installed while the catalog stays closed. Existing sink-apply failures and no-op plans exercise different paths.
|
||||
|
||||
During follow-up wiring, `ParseDataPlaneAuthority` began calling the full `ParseRemoteNamespaceMappings` validator. Keep invalid mapping proof unavailable without accidentally making otherwise parseable key/grant revocations depend on unrelated mount topology; this coupling also needs explicit source review and regression evidence.
|
||||
|
||||
**Follow-up source review:** `PlanFailed` now retains parsed authority and artifact bytes, and the actor installs them before reporting the topology failure. Its real actor regression verifies generation advancement, revoked-key denial and catalog closure. `CatalogValid = false` now separates invalid connections/exports/mappings and failed scope construction from parseable keys/grants. A residual was found because `ResolveDataAuthorityScope` ran before key projection and outside the topology-failure catch; duplicate/case-variant node or cluster `Enabled` properties threw through `DataProperty`. The final correction below addresses that path too.
|
||||
|
||||
**Final source correction:** Eligibility resolution now also catches topology failures, suppresses grants and closes catalog availability while continuing key projection. All three new configuration collections are validated independently, so invalid exports or connections cannot be hidden by an empty mapping list. Empty well-formed new arrays retain legacy local-authority behavior; nonempty or malformed new collections require explicit eligible membership. The reviewer inspected the corresponding projection regressions, all included in the final P03 pass. The failed intermediate full P03 run `20261116T033832.512209Z-8826b865b49a` had 77 Core passes and 87 SDK passes with two existing SDK assertions failing because they used clock-read counts as a proxy for deduplicated decisions (1 became 4; 3 became 12). The corrected Stage6 tests compare the measured warm single-node decision cost with same-node and distinct-node passes, preserving credential rechecks and verifying deduplication without a fixed clock-read count. Both passed in the final gate.
|
||||
|
||||
## H2 — Bind mapped proofs to the current local activation
|
||||
|
||||
**Severity: High. Status: resolved.** The initial `Core/Authorization/DataOperationPolicy.cs:54–64` compared requested view, resolver, live subject and remote serving identity to one another, then evaluated the result against whichever local authority snapshot was current. Neither it nor `OpcUaServer/Security/DataPlaneAuthorizer.cs:155–185` consulted `CatalogActivation` or a local desired/served catalog generation. `CatalogActivation.Begin` could close availability and local authority could advance while a node manager still held its old resolver/live proof. An unchanged broad ancestor grant could then authorize the deleted or moved mapping under the new local authority.
|
||||
|
||||
Bind the immutable mapped proof to the current local desired/served activation and authority generation through a transport-independent gate. Closing activation, advancing authority, or failing topology must invalidate the old proof even when its remote lease and internally matching resolver/live fields remain unchanged. Recheck this gate around cached authorization. Add a regression that retains the old resolver/live subject/remote lease while changing the real local authority and activation; it must deny until a matching new catalog is ready. A test that merely passes a different remote `ServingIdentity` does not exercise this gap.
|
||||
|
||||
**Correction:** `MappedSubjectResolver` now requires `IDataMappedCatalogAuthority`. Runtime captures it only from a ready activation and checks exact captured-state reference equality, so even a no-op rebuild with the same authority generation invalidates the old token at `Begin`. Policy checks token activity, positive catalog epoch and equality with the captured local authority generation before and after authorization. Source tests cover closing activation, advancing to an unchanged broad grant with an old token, and a real Runtime token remaining invalid after a same-authority rebuild becomes ready. Future P08 catalog construction must obtain this token from Runtime rather than accepting request-supplied evidence.
|
||||
|
||||
## M1 — Reject enabled rows with null logical IDs before contextual filtering
|
||||
|
||||
**Severity: Medium. Status: resolved.** The initial `Runtime/Drivers/DeploymentArtifact.DataConnections.cs:267–274` filtered validator errors with `x.Context is not null`. Explicit JSON null logical IDs deserialize into all three entity types, and `DataConnectionValidator` emits the identity error using that null ID as its context. The error was discarded, along with other errors on the same row, and the parser could return malformed enabled configuration. Missing IDs default to an empty string, but explicit null took the bypass.
|
||||
|
||||
Reject missing/null/blank enabled logical IDs before validation filtering and retain safe row diagnostics. Cover connections, exports, mappings and a null-ID row with another invalid field. Do not let contextual filtering determine whether a row has an identity at all. The prior cross-cluster projected-root and null-topology corrections are visible in source and covered by the coordinator's earlier RED/green runs; they do not cover this case.
|
||||
|
||||
**Follow-up:** The canonical-property cases were reproduced as four assertion failures with 53 passing tests in `20261116T032410.276334Z-f617f1d58480`; the full 200-test P02 gate above passed after adding an enabled-ID preguard. Source rereview found that the preguard reads exact-case JSON properties while `Deserialize` uses `PropertyNameCaseInsensitive = true`. A row containing `enabled: true` and a null canonical ID bypasses the guard but deserializes enabled; a canonical valid ID followed by a case-variant null ID can likewise be overwritten after the guard. Validate the actual deserialized enabled/ID/owner values or reject ambiguous property aliases consistently. Cover lower-case enabled with null ID and shadowed ID/owner cases before resolving M1.
|
||||
|
||||
**Final source correction:** Data rows now reject duplicate property names under the same case-insensitive comparer used by deserialization; guard reads and foreign mapping identity reads use that comparer too. The materialized row's enabled flag, logical ID and owner are checked before it is returned. The reviewer inspected all three shared cases and the added alias regressions. Saved RED `20261116T033408.997103Z-68c99377553c` contains seven actual assertion failures and 59 passes for lower-case enabled/null IDs, shadow IDs and a shadow owner; its TRX was inspected directly. All corrected cases are included in the final 209-test P02 pass.
|
||||
|
||||
## M2 — Bind remote authority leases to their serving identity
|
||||
|
||||
**Severity: Medium. Status: resolved.** The initial `Core/Authorization/MappedNamespaceSubject.cs:25–29` exposed only `IDataAuthorizationLease.IsValid`. `MetadataAuthorityLease` retained catalog and authority epochs, but `DataOperationPolicy.AuthorizeMapped` never compared them with `subject.Serving`; node/incarnation binding was absent from the lease contract. An unexpired lease belonging to a different remote generation or serving incarnation could therefore satisfy authorization for an old, otherwise internally matching subject.
|
||||
|
||||
Make the trusted lease prove the exact serving node/incarnation and catalog/authority epochs, or provide an equivalent bound validity check; compare that identity before and after cached authorization. Preserve request-start monotonic timing and explicit invalidation. Add wrong-lease-generation, wrong-node and wrong-incarnation cases where requested/live/resolver evidence otherwise matches. This is separate from H2's local activation binding.
|
||||
|
||||
**Correction:** The lease contract now carries immutable `ServingIdentity`; Runtime requires positive validated epochs and matching lease/serving generations when constructing it. Policy compares the complete serving record before and after authorization as well as validity. Wrong node, incarnation, role, catalog epoch and authority epoch tests retain a valid lease duration and matching view proof while verifying denial. The timing/cap/invalidation implementation remains intact.
|
||||
|
||||
## M3 — Make migration rollback preconditions accurate and enforceable
|
||||
|
||||
**Severity: Medium. Status: resolved in follow-up.** The initial `Configuration/Migrations/20261116030721_AddGrpcDataConnections.cs:190–198` shrank `NodeAcl.ScopeKind` to `nvarchar(16)`, but mapping ACL rows retain the 22-character value `RemoteNamespaceMapping`. Disabling connections/mappings, as the initial evidence ledger instructed, did not remove those ACL rows. Down migration would fail or truncate at the column alteration.
|
||||
|
||||
Define a safe explicit rollback precondition/cleanup or retain the widened column; do not describe feature disable alone as sufficient. A precondition should run before destructive table removal and explain the required operator action without silently deleting grants. Disposable SQL verification may remain in P10, but the generated migration and rollback documentation must agree now.
|
||||
|
||||
**Correction/evidence:** Down now intentionally preserves the additive 32-character ACL storage, with an explicit explanation beside the dropped tables. The rollback SQL regression first failed in `20261116T032430.618039Z-70b9da4bde3a` (one failed, one passed) because generated SQL contained `ALTER COLUMN [ScopeKind]`; it passed in the subsequent complete P02 gate. The reviewer inspected both saved TRX failures and the corrected migration/test source. Actual SQL apply/rollback remains P10; no database execution is inferred.
|
||||
|
||||
## Reviewed strengths and remaining integration obligations
|
||||
|
||||
- Configuration separates owner cluster, consumer nodes, expected target identity and secret reference. New rows default disabled; mapping write-through defaults false. Artifacts sort unordered sets while preserving endpoint preference, and node-effective projection excludes the source B from an A-only same-cluster mount. Old artifacts expose no new data surface. Runtime parsing rejects malformed enabled enums, operations, bounds, orphan mounts and unsupported export roots.
|
||||
- Immutable authority publication now copies keys, grants, nested ACL paths and ancestry sets. Returned mutable entities are copies. Credential version, principal, current key enablement/expiry and original activation expiry are rechecked around cached grants. SDK role augmentation preserves credential evidence. Caller-supplied `DataView.Subject` does not become authoritative; spoofed subject tests deny.
|
||||
- Mapped classification precedes both Raw path/cache resolution and UNS custom resolution, including the legacy ACL-disabled paths. Unknown classification fails closed. Ordinary local behavior remains on the shared evaluator and requires its existing regression gate.
|
||||
- Metadata duration uses request-start monotonic elapsed time, caps policy duration and subtracts margin; late replies, wall-clock jumps and explicit invalidation are covered. Exact remote identity coupling is verified by the M2 correction and final tests.
|
||||
- The coordinator added node-effective mappings to the Runtime `AclScopePathResolver` call during review. The final artifact-authority regression verifies the real mapping-scoped path. The H1 corrections prevent bad mapping/topology proof from retaining otherwise parseable key revocations.
|
||||
- Mapped subscriptions currently deny admission because the SDK publish-time lease gate is not yet implemented. Mapped writes are authorized but return `BadNotWritable` before the legacy local gateway. These are safe temporary boundaries, not completion of the planned P08 remote write/subscription behavior or cancellation of that scope. Final-send revocation, quiet-mount probing, cached payload invalidation, actual catalog/hub/SDK integration and P08/P10–P12 evidence remain later obligations.
|
||||
|
||||
No complete-feature, migration-application, integration, scaling, or final-suite claim is made by this checkpoint review.
|
||||
Reference in New Issue
Block a user