Skip to content

Commit e4bdc3c

Browse files
committed
docs(B-7,spec): record pending CredentialTier follow-up and update tech spec
Added a TRACKER.md note that a parallel Ouroboros effort is adding a canonical CredentialTier (tracked as OQ-009 in docs/sirus-tech-spec.md) and that this repo's local provisional src/Infrastructure/DTOs/CredentialTier.php stub is intentionally left untouched until the promoted version ships in a released Composer version — it cannot be removed in this session. Updated docs/sirus-tech-spec.md to reflect the spec-conformance audit pass: corrected stale TrustLevelPrimitive documentation (NORMAL/ELEVATED/CRITICAL -> NORMAL/STEP_UP_REQUIRED/LOCKED, matching the real Ouroboros enum and the B-5 fix), documented the boot-time schema/cron strategy (B-2), the legacy entry-point guard (B-3), the credential-tier base-score table (B-4), the pulse TTL strategy (B-6), the stub-drift CI check (D-4), corrected the Ouroboros dependency version cited (^2.0 -> ^3.0, matching composer.json), and added a changelog entry. TRACKER.md also records the B-3 table-name reconciliation decision/reasoning and notes the pre-existing, out-of-scope test failures observed while running the full suite. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017XymX47EukYLRJmPQodqpg
1 parent 104dbd1 commit e4bdc3c

2 files changed

Lines changed: 116 additions & 15 deletions

File tree

TRACKER.md

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@ This document tracks every component defined in **Sirius Context Engine Spec v3.
3030
| `ContextCache` | `src/core/ContextCache.php` || S-01 | Cache + TTL eviction |
3131
| `ContextBootException` | `packages/sparxstar-ouroboros-integrity/src/Exceptions/ContextBootException.php` || S-04 | Migrated to Ouroboros CO-001 — `Starisian\Sparxstar\Infrastructure\Exceptions` |
3232
| `ContextPulse` DTO | `packages/sparxstar-ouroboros-integrity/src/DTOs/ContextPulse.php` || S-04 | Migrated to Ouroboros CO-001 — `Starisian\Sparxstar\Infrastructure\DTOs` |
33+
| `SirusDatabase` schema boot | `src/core/SirusDatabase.php`, `src/SirusPlugin.php` | ✅ | **S-08** (fixed 2026-08-01) | **Platform-breaking bug fixed:** as a must-use plugin, Sirus never fires `register_activation_hook()`, so `ensure_schema()` was never called in a real deployment (only wired to `SirusPlugin::onActivation()`). Replaced with `SirusDatabase::maybe_upgrade_schema()` (public `SCHEMA_VERSION` int constant, one cheap `get_option()` read, `ensure_schema()` only on mismatch) called from `SirusPlugin::bootSchemaAndCron()` on an early `init` hook. Cron scheduling moved the same way, reusing the existing `wp_next_scheduled()`-guarded `schedule_cron()` pattern. `onActivation()`/`onDeactivation()` and the lifecycle hook registrations in `sparxstar-sirus-context.php` are removed. No table/column/index definitions changed — only *when* schema creation runs. Multisite: no explicit per-site loop needed (mirrors `SparxstarUECInstaller::activate_site()`'s "never loop over sites" rule) — each request already executes in its own site's `$wpdb`/option context. |
3334

3435
### Trust and Security
3536

3637
| Component | File | Status | Sprint | Notes |
3738
|---|---|---|---|---|
3839
| `TrustEngine` | `src/core/TrustEngine.php` || S-01/S-02 | Frozen algorithm; 18 unit tests in `TrustEngineTest` |
39-
| `TrustResolver` | `src/core/TrustResolver.php` || S-01/S-02 | Credential-level base + drift/session deductions; 15 unit tests in `TrustResolverTest` |
40-
| `StepUpPolicy` | `src/core/StepUpPolicy.php` || S-01/S-02 | Frozen policy; `requiresStepUp()` + `TRUST_LEVEL_STEP_UP_REQUIRED` pre-flag check; 17 unit tests |
41-
| `PulseGenerator` | `src/core/PulseGenerator.php` || S-01/S-02 | HMAC-SHA256 only; consumes enum-backed `SirusContext::trust_level`; PAM-002-P2 fields wired (`behavior_flags`, `geo_zone`, `network_effective_type`, `session_duration`); 20 unit tests in `PulseGeneratorTest`; `$now`/`$ttlSeconds` explicit params |
40+
| `TrustResolver` | `src/core/TrustResolver.php` || S-01/S-02 | Credential-level base + drift/session deductions; 19 unit tests in `TrustResolverTest`; `CREDENTIAL_BASE` fixed 2026-08-01 — removed dead `elder` entry (not a `CredentialTier` case), added missing `authority` entry (0.95, above `user` 0.85); added exhaustive-coverage and monotonic-ordering tests |
41+
| `StepUpPolicy` | `src/core/StepUpPolicy.php` || S-01/S-02 | Frozen policy; `requiresStepUp()` + `TRUST_LEVEL_STEP_UP_REQUIRED` pre-flag check; fails closed on `LOCKED` (checked before `STEP_UP_REQUIRED`, added 2026-08-01); 21 unit tests |
42+
| `PulseGenerator` | `src/core/PulseGenerator.php` || S-01/S-02 | HMAC-SHA256 only; consumes enum-backed `SirusContext::trust_level`; PAM-002-P2 fields wired (`behavior_flags`, `geo_zone`, `network_effective_type`, `session_duration`); 36 unit tests in `PulseGeneratorTest`; `$now`/`$ttlSeconds` explicit params; signing key constant renamed `SIRUS_PULSE_SIGNING_KEY``SPARXSTAR_PULSE_SIGNING_KEY` (2026-08-01, matches Helios); `resolveTtl(ResourceSensitivity)` implements the sensitivity/connectivity TTL strategy (2026-08-01) |
4243

4344
### Device and Identity
4445

@@ -152,6 +153,58 @@ This document tracks every component defined in **Sirius Context Engine Spec v3.
152153
---
153154

154155

156+
## Current Review Notes — 2026-08-01 (spec-conformance audit fixes)
157+
158+
Static spec-conformance audit against Sirus Context Engine Spec v3.0 found and fixed six defects
159+
(B-1 through B-6) plus a stub-drift CI gap (D-4). Full detail per-component is recorded in the
160+
Scoreboard rows above; this note records the cross-cutting decisions.
161+
162+
- **B-1 (🔴 platform-breaking):** `SIRUS_PULSE_SIGNING_KEY` renamed to `SPARXSTAR_PULSE_SIGNING_KEY`
163+
everywhere (code, tests, `PUBLIC_API.md`, `README.md`) to match Helios's already-renamed side.
164+
Every pulse was failing Helios's signature verification until this landed.
165+
- **B-2 (🔴 platform-breaking):** see the `SirusDatabase` schema boot row above. Sirus tables were
166+
never created in a real deployment because must-use plugins never fire activation hooks.
167+
- **B-3 (🟠) — table-name reconciliation:** `sparxstar-user-environment-check.php` and
168+
`sparxstar-sirus-context.php` defined `SPX_ENV_CHECK_DB_TABLE_NAME` to two different values
169+
(`sparxstar_uec_snapshots` vs `sparxstar_env_snapshots`) with behavior depending on mu-plugin
170+
load order. **Decision:** keep `sparxstar_env_snapshots` — the value already defined (guarded,
171+
"define if not already defined") by `sparxstar-sirus-context.php`, which is the live/active
172+
orchestrator entry point. Reasoning: WordPress loads mu-plugins in filename-alphabetical order;
173+
`sparxstar-sirus-context.php` sorts before `sparxstar-user-environment-check.php` ('s' < 'u'), so
174+
it always defines the constant first in practice even without the new guard. The new guard added
175+
in `sparxstar-user-environment-check.php` (`if (defined('SIRUS_VERSION')) { return; }`) makes this
176+
outcome unconditional rather than order-dependent: the legacy file's own conflicting definition of
177+
`SPX_ENV_CHECK_DB_TABLE_NAME` (`sparxstar_uec_snapshots`) is now unreachable whenever Sirus is
178+
loaded. In practice this also means the legacy `SparxstarUECDatabase`/`SparxstarUECSnapshotRepository`
179+
code path (the only consumer of that constant) no longer runs at all when Sirus is active — it was
180+
already superseded by `SirusDatabase`/`SirusEventRepository` per the UEC Legacy Scoreboard below.
181+
`sparxstar-user-environment-check.php` was also added to `.distignore`. Neither legacy file was
182+
deleted — full removal remains S-03, blocked on the stabilization window.
183+
- **B-4 (🟠):** see the `TrustResolver` row above.
184+
- **B-5 (🟠):** see the `StepUpPolicy` row above.
185+
- **B-6 (🟠):** see the `PulseGenerator` row above (pulse TTL strategy).
186+
- **B-7 — known pending follow-up:** a parallel Ouroboros-side effort is adding a canonical
187+
`CredentialTier` to `sparxstar-ouroboros-integrity` (tracked here as OQ-009 in
188+
`docs/sirus-tech-spec.md`). This repo's local provisional `src/Infrastructure/DTOs/CredentialTier.php`
189+
and the `"Starisian\\Sparxstar\\Infrastructure\\": "src/Infrastructure/"` autoload entry in
190+
`composer.json` were deliberately **not** touched in this pass — they cannot be removed until the
191+
promoted Ouroboros version actually ships in a released Composer version. Follow-up: once that
192+
ships, delete the local stub, drop the autoload entry, and add `CredentialTier` to
193+
`bin/check-ouroboros-stub-drift.php`'s coverage.
194+
- **D-4 (🟠):** added `bin/check-ouroboros-stub-drift.php` (composer script `check:ouroboros-drift`)
195+
and a new `ouroboros-stub-drift` CI job in `.github/workflows/test.yml` (runs after `php-tests`).
196+
Reflects the real installed Ouroboros package and checks `TrustLevelPrimitive`, `ContextPulse`,
197+
`Platform`, `ContextPulseSigningMaterial`, and `ContextBootException` against the shapes this
198+
repo's code assumes — the automated version of the check that would have caught the historical
199+
drift in `docs/DRAFT-OQ-016-trustlevelprimitive-drift.md` before it reached CI as 94 failures.
200+
- **Pre-existing failures observed while running the full suite (not caused by this pass, not
201+
fixed — out of scope):** `AuthorityResolverTest`/`CapabilityEngineTest` (6 + 8 tests) call a test
202+
helper (`makeContext(string $credentialTier)`) that passes `TrustLevelPrimitive` string values
203+
(`'NORMAL'`, `'STEP_UP_REQUIRED'`, `'LOCKED'`) into `CredentialTier::from()`, which throws
204+
`ValueError` since those are not valid `CredentialTier` backing values — a test-authoring bug
205+
confusing the two enums. `RestApiTest` (2 tests) calls `WP_REST_Request::set_body_params()`,
206+
which the test bootstrap's `WP_REST_Request` stub does not implement. Both predate this branch.
207+
155208
## Current Review Notes — 2026-06-09
156209

157210
- Runtime/security review found `/context` accepted an optional `device_id` parameter but did not enforce it. The handler now rejects mismatches for both current-context and `ctx_token`-derived responses.
@@ -467,4 +520,4 @@ With the gate trustworthy, run the suite and flip 🟡 → ✅ in this tracker f
467520

468521
---
469522

470-
*Last updated: 2026-06-12 | Spec version: Sirus Context Engine Spec v3.0 + PAM-002*
523+
*Last updated: 2026-08-01 | Spec version: Sirus Context Engine Spec v3.0 + PAM-002*

0 commit comments

Comments
 (0)