Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
1e3f4d8
Include equipment slot groups in Entity draft digest v2
benhook1013 Sep 26, 2026
09cc623
Add guarded Entity digest baseline migration job
benhook1013 Sep 26, 2026
9b14a49
Fence the baseline migrator certificate and admission
benhook1013 Sep 26, 2026
5a68415
Preserve publish provenance during Entity baseline migration
benhook1013 Sep 26, 2026
60660c5
Return and verify generated participant baseline IDs
benhook1013 Sep 26, 2026
c2888a1
Map recorded baseline timestamps from PostgreSQL rows
benhook1013 Sep 26, 2026
af5e197
Read back generated audit identity and SQL timestamps
benhook1013 Sep 26, 2026
5a6d391
Reconcile Entity digest catch-up with consolidated Gate 2 parent
benhook1013 Sep 26, 2026
bc50b31
Fold Entity baseline migration into digest v2 review boundary
benhook1013 Sep 26, 2026
995de96
Wire baseline migration Job to runtime Jackson mapper
benhook1013 Sep 27, 2026
28b2c7c
Reconcile Entity baseline migration with Gate 2 parent
benhook1013 Sep 27, 2026
57a4227
Reconcile Entity migration with validated Gate 2 parent
benhook1013 Sep 27, 2026
7f5fdd8
Reconcile Entity baseline migration with Gate 2 parent
benhook1013 Sep 27, 2026
a0ed657
Tighten Entity v2 digest and baseline migration proof
benhook1013 Sep 28, 2026
e89143b
Apply scoped Entity digest formatter correction
benhook1013 Sep 29, 2026
62c2c42
Clarify Entity digest guard and migrator actor provenance
benhook1013 Sep 29, 2026
9e250a9
Block mutable Draft Entity baseline migration
benhook1013 Sep 29, 2026
eb381e4
Preserve exact baseline migration retry after Draft transition
benhook1013 Sep 29, 2026
765e5fd
Prepare restricted database identities for baseline migration Job
benhook1013 Sep 29, 2026
74297ca
Restrict baseline migration version lock to scoped function
benhook1013 Sep 29, 2026
8dda4dc
Include authored equipment vocabulary in Entity v2 digest
benhook1013 Sep 29, 2026
8ce4ac8
Run baseline migration Helm contract in CI
benhook1013 Sep 29, 2026
43dc6b3
Fence baseline migration across version lifecycle changes
benhook1013 Sep 29, 2026
eb9f582
Serialize version lifecycle writers for baseline epoch fencing
benhook1013 Sep 29, 2026
0e0172d
Lock version during publication digest reconciliation
benhook1013 Sep 29, 2026
d54ef96
Merge remote-tracking branch 'origin/codex/gate2-playable-delivery' i…
benhook1013 Sep 30, 2026
6ac448e
Reconcile Entity baseline migration with published playable parent
benhook1013 Oct 1, 2026
9d2ded9
Format reconciled publication order proof
benhook1013 Oct 1, 2026
26506be
Allow exact operator retirement of ephemeral migrator Secret
benhook1013 Oct 1, 2026
9c75c62
Prove complete baseline migrator network isolation
benhook1013 Oct 1, 2026
a4a0097
Reconcile Entity baseline migration with published playable-proof parent
benhook1013 Oct 2, 2026
9cb3a92
Preserve baseline migration while forwarding player projection correc…
benhook1013 Oct 2, 2026
d3d6b49
Clarify canonical Entity v2 definition ordering
benhook1013 Oct 2, 2026
b5cb72e
Propagate trusted WSS smoke destination binding
benhook1013 Oct 2, 2026
fed6208
Carry proven hosted player parent into Entity baseline migration
benhook1013 Oct 2, 2026
24317b2
Report script-only Entity baseline scopes as blocked
benhook1013 Oct 2, 2026
45b9384
Merge bounded hosted diagnostics into Entity baseline candidate
benhook1013 Oct 2, 2026
82cd45a
Reject noncanonical definition keys before Entity digest attestation
benhook1013 Oct 2, 2026
e76db3b
Preserve canonical digest attestation with proved hosted parent
benhook1013 Oct 2, 2026
a0571a1
Preserve Entity migration proof on corrected Account parent
benhook1013 Oct 2, 2026
06de1ee
Carry final entitlement authority corrections into baseline migration…
benhook1013 Oct 2, 2026
513ead1
Forward final playable-proof parent into Entity baseline migration
benhook1013 Oct 3, 2026
b68e064
Allow Validation for stacked pull requests
benhook1013 Oct 4, 2026
b38e7dc
Carry forward reviewed CI safety corrections
benhook1013 Oct 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
types: [opened, synchronize, reopened, edited]
workflow_dispatch:

Expand Down Expand Up @@ -383,6 +382,7 @@ jobs:
bash ./dev-tools/tests/backup-verifier-image-contract.sh
bash ./dev-tools/tests/kubectl-version-skew-contract.sh
bash ./dev-tools/tests/helm-transaction-proof-contract.sh
bash ./dev-tools/tests/helm-entity-digest-baseline-migration-contract.sh
bash ./dev-tools/tests/preview-image-tag-contract.sh
bash ./dev-tools/tests/preview-merge-image-tag-contract.sh
bash ./dev-tools/tests/overlay-preflight-contract.sh
Expand Down Expand Up @@ -1012,7 +1012,7 @@ jobs:
contents: read
pull-requests: write
needs: [buf-check, docker-lint, shellcheck, python-script-validation, dev-tool-contract-checks, dev-tools-readme-contract, yaml-lint, metrics-cardinality-check, flyway-migration-sanity-checks, grpc-transport-config-sanity-checks, workflow-lint, helm-lint, helm-render-validation, helm-transaction-proof, docs-check, frontend-checks, build-and-test, validation-gate]
if: ${{ always() && github.event_name == 'pull_request' && (github.event.action != 'edited' || github.event.changes.base.ref != null) }}
if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' && (github.event.action != 'edited' || github.event.changes.base.ref != null) }}
steps:
- name: Harden runner
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-pr-runtime-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ jobs:
fail("source workflow run API id does not match the event")
if source_run.get("workflow_id") != int(workflow_id_text):
fail("source workflow identity changed between event and API")
if source_run.get("name") != source_title:
fail("source workflow API name differs from its exact run title")
if source_run.get("name") not in {"Build Runtime Images", source_title}:
fail("source workflow API name is neither its owning name nor exact run title")
if source_run.get("path") != SOURCE_WORKFLOW_PATH:
fail("source workflow API path is not the trusted runtime-images workflow")
if source_run.get("event") != source_event:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ jobs:
uses: ./.github/actions/setup-trivy

- name: 🔍 Run Trivy and Save Report
shell: bash
run: |
echo "::group::Run Trivy"
trivy fs --config config/security/trivy.yaml . | tee trivy-report.txt
Expand Down Expand Up @@ -207,7 +208,7 @@ jobs:
contents: read
pull-requests: write # Publishes the consolidated security result on the PR.
needs: [changes, trivy-scan, secret-compliance, security-gate]
if: ${{ always() && github.event_name == 'pull_request' && (github.event.action != 'edited' || github.event.changes.base.ref != null) }}
if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' && (github.event.action != 'edited' || github.event.changes.base.ref != null) }}
steps:
- name: Harden runner
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5
Expand Down
51 changes: 48 additions & 3 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ jobs:
".github/actions/load-workflow-tool-versions/",
".github/actions/setup-python/",
"dev-tools/smoke/",
"dev-tools/minio/",
];
const fullRelevantFiles = new Set([
"build.gradle.kts",
Expand Down Expand Up @@ -145,7 +146,7 @@ jobs:
contents: read
pull-requests: write
needs: [changes]
if: ${{ always() && github.event_name == 'pull_request' && (github.event.action != 'edited' || github.event.changes.base.ref != null) }}
if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' && (github.event.action != 'edited' || github.event.changes.base.ref != null) }}
steps:
- name: Harden runner
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5
Expand Down Expand Up @@ -198,6 +199,26 @@ jobs:
`- ${statusIcon(fullResult)} PR Full-Stack Smoke: \`${fullResult}\``,
].join("\n");

const expectedHeadSha = context.payload.pull_request.head.sha;
const expectedBaseRef = context.payload.pull_request.base.ref;
const expectedBaseSha = context.payload.pull_request.base.sha;
const { data: currentPullRequest } = await github.rest.pulls.get({
...context.repo,
pull_number: context.issue.number,
});
if (
currentPullRequest.state !== "open" ||
currentPullRequest.head.sha !== expectedHeadSha ||
currentPullRequest.base.ref !== expectedBaseRef ||
currentPullRequest.base.sha !== expectedBaseSha
) {
core.info(
`Skipping stale smoke summary for ${expectedBaseRef}@${expectedBaseSha}...${expectedHeadSha}; ` +
`current PR state/base/head is ${currentPullRequest.state}/${currentPullRequest.base.ref}@${currentPullRequest.base.sha}/${currentPullRequest.head.sha}`
);
return;
}

const comments = await github.paginate(
github.rest.issues.listComments,
{
Expand Down Expand Up @@ -277,7 +298,7 @@ jobs:
contents: read
pull-requests: write
needs: [changes, smoke-gate, smoke-summary-pending]
if: ${{ always() && github.event_name == 'pull_request' && (github.event.action != 'edited' || github.event.changes.base.ref != null) }}
if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' && (github.event.action != 'edited' || github.event.changes.base.ref != null) }}
steps:
- name: Harden runner
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5
Expand Down Expand Up @@ -334,6 +355,26 @@ jobs:
`- ${statusIcon(fullResult)} PR Full-Stack Smoke: \`${fullResult}\``,
].join("\n");

const expectedHeadSha = context.payload.pull_request.head.sha;
const expectedBaseRef = context.payload.pull_request.base.ref;
const expectedBaseSha = context.payload.pull_request.base.sha;
const { data: currentPullRequest } = await github.rest.pulls.get({
...context.repo,
pull_number: context.issue.number,
});
if (
currentPullRequest.state !== "open" ||
currentPullRequest.head.sha !== expectedHeadSha ||
currentPullRequest.base.ref !== expectedBaseRef ||
currentPullRequest.base.sha !== expectedBaseSha
) {
core.info(
`Skipping stale smoke summary for ${expectedBaseRef}@${expectedBaseSha}...${expectedHeadSha}; ` +
`current PR state/base/head is ${currentPullRequest.state}/${currentPullRequest.base.ref}@${currentPullRequest.base.sha}/${currentPullRequest.head.sha}`
);
return;
}

const comments = await github.paginate(
github.rest.issues.listComments,
{
Expand Down Expand Up @@ -476,7 +517,11 @@ jobs:
const eventMergeSha = context.sha;
const prNumber = String(context.payload.pull_request.number);
const started = Date.now();
const timeoutMs = 25 * 60 * 1000;
// Contract-checked against pr-local-smoke; bounded overhead covers metadata,
// runner scheduling and API convergence, not unbounded queue delays.
const producerTimeoutMinutes = 45;
const prerequisiteAndQueueAllowanceMinutes = 45;
const timeoutMs = (producerTimeoutMinutes + prerequisiteAndQueueAllowanceMinutes) * 60 * 1000;
const cancelledReplacementTimeoutMs = 5 * 60 * 1000;
const sleepMs = 15000;
const pullRequestCheckInterval = 4;
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/static-analysis-summary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ jobs:
if (
currentPullRequest.state !== "open" ||
!sourceWorkflowName ||
context.payload.workflow_run.name !== expectedSourceTitle ||
(context.payload.workflow_run.name !== sourceWorkflowName &&
context.payload.workflow_run.name !== expectedSourceTitle) ||
context.payload.workflow_run.display_title !== expectedSourceTitle
) {
core.info("The source run is not bound to the current open pull-request base and head.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Entity Management must also expose a read-only design-time synchronization surfa

- `GetDraftDesignDigest(GetDraftDesignDigestRequest)` uses request shape `{tenantId, scope: oneof {versionId, scriptPatchVersion}}`. Entity Management supports `versionId` scope only and returns `UNSUPPORTED_SCOPE` otherwise.
- Response returns `{tenantId, scope, appliedCommitId, contentDigest, digestSchemaVersion}` as described in [`world-editing-tools.md`](../game-design-service/world-editing-tools.md).
- Current drift: the digest handler has no owner/method authorization or exact Game Design publication binding beyond shared bearer parsing. The target workload, tenant/scope/request/workflow/digest context and denial proof are canonical in [Game Design Version Control](../game-design-service/version-control.md#owner-to-owner-digest-authorization-and-tenant-identity).
- Current implementation: the exact `GetDraftDesignDigest` method is JWT-exempt only for its mTLS-authenticated owner-to-owner call; the handler applies `PublicationReadGuard` to the caller, tenant, scope, and publication binding before returning digest evidence. The target workload, tenant/scope/request/workflow/digest context and denial contract remain canonical in [Game Design Version Control](../game-design-service/version-control.md#owner-to-owner-digest-authorization-and-tenant-identity). Live served-certificate and consumer-convergence proof is still required.

## Digest Input Manifest

Expand All @@ -80,8 +80,9 @@ Entity Management is a required publish-gate participant and must maintain a sta
Implementation Notes:

- The current implementation hashes the version-scoped entity-definition rows for the requested `(tenantId, versionId)` and returns synthetic `appliedCommitId = "version:<versionId>"` until the later applied-revision ledger lands.
- Current version-scoped digest inputs include `items`, `npcs`, and `crafting_recipes`; later entity-template families must join this same `(tenantId, versionId)` digest contract when introduced.
- The current item projection omits `equipmentSlotGroupKey`, although runtime equipment admission consumes that authored value when checking an item against an equipment slot definition. A change to the slot-group constraint can therefore leave the Entity participant digest unchanged. The target manifest includes the normalized optional field and bumps `digestSchemaVersion` (from `1` to `2`); proof must show cross-version slot-group changes alter the digest and are caught by the publish gate.
- The producer fails closed when persisted required equipment slot or body-layout keys are null, blank, or not already in trim-plus-uppercase canonical form; runtime definition lookups use exact stored keys, so normalizing malformed stored definition keys for the digest could attest different semantics. This producer check does not clean up retained rows, and no retained-row cleanup is implemented or proven.
- Current version-scoped digest inputs include `items`, `npcs`, `crafting_recipes`, `equipment_slot_definitions`, and `body_layout_slot_definitions`; later entity-template families must join this same `(tenantId, versionId)` digest contract when introduced.
- The current item projection includes optional `equipmentSlot` and `equipmentSlotGroupKey`, normalized like runtime equipment admission (null/blank to empty; otherwise trim and uppercase), and optional `effectPayloadJson`, canonicalized as parsed JSON with recursively stable object-key ordering (null/blank to empty; malformed nonblank JSON fails closed). Equipment-slot definitions contribute normalized slot and group keys plus display name; body-layout membership contributes normalized layout and slot keys. These definition projections follow the relation-specific canonical ordering below and exclude database row IDs and optimistic version counters. It reports `digestSchemaVersion=2`. Focused producer proof covers normalized slot and slot-group equivalents, definition-side slot/group/layout changes, row-order and optimistic-version equivalence, distinct effect payloads, malformed payload rejection, and tenant/version-scoped reads; Game Design's publish gate accepts Entity v2 and rejects v1 or unsupported evidence. Previously recorded v1 evidence still requires affected-scope replay or recomputation, re-recording, and readback before publish; this code change does not perform a live-data migration.

- Included objects:
- version-scoped entity-template tables such as item, NPC, equipment, loot-table, and balance-curve definitions keyed by `(tenantId, versionId)`;
Expand All @@ -91,9 +92,10 @@ Implementation Notes:
- audit/history/provenance tables and non-semantic timestamps;
- applied-revision ledgers when those rows do not affect entity semantics.
- Canonicalization rules:
- serialize included relations in stable table order, then primary-key order;
- serialize included relations in lexicographic table-name order;
- order ordinary relation rows by stable cross-service identifiers where applicable, otherwise by primary key; for schema-v2 `equipment_slot_definitions`, order by normalized `slot_key`, then `display_name` (null to empty), then normalized `slot_group_key`; for `body_layout_slot_definitions`, order by normalized `body_layout_key`, then normalized `slot_key`;
- include only semantic fields plus stable identifiers referenced cross-service;
- normalize encoded structured fields before hashing.
- normalize encoded structured fields before hashing; for `effectPayloadJson`, parse nonblank JSON and serialize nested objects with stable lexicographic key ordering, failing closed on malformed nonblank JSON.
- `digestSchemaVersion` must increment whenever included objects, semantic field selection, or serialization semantics change. For this manifest, once `v2` is deployed, `v1` is unsupported. The schema bump invalidates previously recorded participant evidence for the affected scope: publish/reconciliation must not compare a new-schema digest with a recorded `v1` digest, and Entity must reject a requested or reported unsupported version until the compatible canonicalization is deployed. The migration must explicitly replay or recompute each affected `(tenantId, versionId)` digest, re-record its `appliedCommitId`, digest, and schema version, and provide readback proof before the publish gate accepts the new version; it must not silently reinterpret or migrate old hashes in place.

Publish gating must fail closed if Entity Management cannot attest a digest consistent with this manifest.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This document defines Entity Management’s runtime model, persistence ownership
- The live Entity schema does not yet represent the target namespace-stable identity for durable S1/S2 state: `characters` and `actor_resource_states` retain legacy `playable_state_key`, while `inventory`, `character_friend`, `character_equipment`, and durable holder/containment rows omit `playableStateNamespaceId` (and some omit `tenant_id` entirely). The current repositories consequently cannot enforce the target `{tenantId, playableStateNamespaceId, domainObjectId}` identity at the SQL boundary. A convergent migration, legacy-row disposition/backfill evidence, namespace-aware repository predicates, and focused isolation proof remain required; until those are complete, legacy `playable_state_key` rows (including `character_friend` associations reached through them) are not namespace-isolated proof and cutover readers must not treat them as namespace-backed survivor state. This does not change the target contract above.
- The live `item_stacks` uniqueness constraint includes nullable holder columns, so PostgreSQL can accept duplicate rows for the same tenant/holder/item/fingerprint when another holder column is `NULL`. Inventory and container mutation paths still use find-then-create/save rather than an atomic conflict-safe operation. With no explicit `stackFamilyKey`, source resolution rejects more than one candidate row; with an explicit family key, the current implementation selects the first matching row and does not reject duplicate matches. Target resolution must enforce exactly one matching stack (or fail closed), alongside holder-kind-specific uniqueness or normalized non-null identity, atomic upsert/locking, and concurrent proof.
- The current `characterGraph` helper caches `getWithInventory(characterId)` by character ID alone with a TTL and performs no namespace or authoritative version validation. It is not the target namespace-qualified Class A `character-cache:*` contract; until that contract is implemented and proved, this cache is not correctness authority.
- `EntityDraftDesignDigestServiceImpl` currently emits `digestSchemaVersion=1` without hashing item `equipmentSlotGroupKey`, while `EquipmentServiceImpl` uses that field for slot compatibility admission. The digest is therefore incomplete for equipment semantics: different slot-group constraints may attest the same content digest. Target convergence adds the normalized field, bumps the schema version, and proves cross-version digest isolation plus publish-gate rejection of a changed constraint.
- `EntityDraftDesignDigestServiceImpl` now emits `digestSchemaVersion=2`, hashes normalized item `equipmentSlot` and `equipmentSlotGroupKey` plus the version-scoped equipment-slot and body-layout membership definitions that affect runtime wear admission, and canonicalizes nonblank item `effectPayloadJson` as parsed JSON with recursively stable object-key ordering; malformed nonblank JSON fails closed. Definition projections sort by semantic keys, include authored slot/group/display and layout-membership values, and omit row IDs and optimistic version counters. Focused tests cover equivalent optional-key spellings, normalized slot and slot-group equivalents, distinct item and definition-side equipment constraints, equivalent and distinct effect payloads, malformed payload rejection, stable row ordering, and tenant/version-scoped reads; Game Design's publish gate requires Entity v2 and rejects v1. Existing v1 participant baselines remain invalid: affected `(tenantId, versionId)` evidence must be replayed or recomputed, re-recorded with its applied commit/digest/schema, and read back before publish. No live baseline migration or cross-service publish proof is claimed by this slice.

## Architecture and Design Notes

Expand Down
Loading
Loading