Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
106 changes: 103 additions & 3 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

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 @@ -48,6 +48,8 @@ The committed descriptor retains those source fields and the exact resolved temp

The complete immutable resolved launch binding consists of this unchanged closed descriptor and a separately authenticated full release attestation produced through Game Design's normal owner workflow. The attestation binds the exact descriptor and authored-source identity, plus the canonical UUID version identity, to the resolved release and its required participant, ability-schema, artifact and manifest evidence under the [version-resolution predicate](../../system-architecture-versioning-runtime.md#launch-descriptor-version-resolution-rules). The descriptor alone is not full release evidence, and a caller-supplied or operator-maintained sidecar is not an attestation. Consumers authenticate and verify the exact attestation against the descriptor before retaining or using the pair. The attestation's wire representation and durable association with the descriptor are not specified by the closed v1 contract and remain to be settled; this requirement does not extend or reinterpret its schema or digest.

Normal release creation preserves the actual persisted canonical tenant and Version UUIDs with the release bundle. Game Design derives this pair only from the exact Version's immutable, verified Game source association and reads it back in the publication transaction; private row keys, selector similarity and caller-supplied replacements cannot establish it. Release readback carries that stored pair separately from the legacy private Version selector. A retained bundle with no proved association remains unmapped, never backfilled by inference, and cannot satisfy canonical launch evidence. The identity pair does not supply missing participant, ability, artifact, manifest or descriptor-association proof.

The closed binding schema has `schemaVersion=1`. Its request preimage begins with the segment `game-design-authored-world-launch-descriptor-request/v1`, followed by field-name/value segment pairs in this order: `schemaVersion`, `targetNamespace`, `controlPlaneRequestId`, `canonicalTenantId`, `worldSlug`, `authoredWorldSourceOperationId`, `authoredWorldSourceEvidenceDigest`, `gameTemplateId`, then presence/value pairs for `requestedScriptPatchVersion`, `sourceVersionId`, `targetVersionId` and `requestedRuntimeFlagsJson`. Each optional pair uses the exact field names `<name>.present` and `<name>.value`; presence is lowercase `true` or `false`, absent values are empty, and present-empty text is distinct from absence. The result preimage begins with `game-design-authored-world-launch-descriptor-result/v1`, carries the same ordered request pairs, then `requestDigest`, `launchDescriptorId`, `versionId`, presence/value for `scriptPatchVersion`, `runtimeFlagsJson`, `generationConfigRevision`, `versionStateEpoch`, `releaseBundleId`, `publishedReleaseBundleRef`, and presence/value for `remapSetId`. Only `resultDigest` is excluded from that result preimage. Every segment is decimal UTF-8 byte length, `:`, and its exact strict UTF-8 bytes; no trimming, case folding or Unicode normalization occurs. UUIDs are canonical non-nil text, counters use positive canonical decimal text, and each digest is `sha256:` plus 64 lowercase hexadecimal digits. Numeric template/version/release representation in this candidate remains the explicitly tracked owner-graph limitation, not a new canonical identity rule.

Only the exact same-namespace Game Session workload may resolve a new canonical descriptor. Its request claim and immutable result commit atomically in the existing descriptor family. An identical retry returns the stored descriptor without resolving changed defaults, another version or another release. Conflicting source, scope or request input denies without replacing the original. Retained unbound or unmapped rows cannot be interpreted as canonical evidence. Exact committed readback is non-mutating and checks the complete stored binding; it cannot create a descriptor or repair an association. Only the exact same-namespace Game Session and World workloads may consume that owner readback, and consumers authenticate Game Design rather than trusting a forwarded digest or JWT service claim. Both resolution and read clients prove the exact same-namespace Game Design workload from the negotiated TLS transport before releasing request metadata or body and independently verify the response; a trusted certificate for another workload or namespace cannot receive the request.
Expand All @@ -58,6 +60,16 @@ Before reporting `PREPARING`, World verifies that exact descriptor against its r

**Implementation and proof status:** This extension is being prepared behind the canonical JOIN/audit checkpoint. Current numeric template/version and owner graph representations remain the separate drift recorded by [Versioning Runtime](../../system-architecture-versioning-runtime.md#implementation-status); this binding is not proof of their completed canonical migration. The separate attestation producer, its wire and durable pair representation, receiver verification, substitution, concurrent exact-retry, immutable readback, fresh/retained isolation and actual PostgreSQL proof remain required. No runtime, catalog or credential activation is authorized. Capability evidence belongs to the [Player Access tracker](../../../project-management/implementation-tracking/player-access-and-session.md) and [authoring tracker](../../../project-management/implementation-tracking/game-authoring-publishing-and-activation.md), not this target contract.

### Source-qualified version-state read

World's canonical Draft writer reads Game Design's current version authority for the exact already-intaken authored source; it must not send World's private tenant key to Game Design or reinterpret a legacy numeric read as that proof. The closed `GetAuthoredWorldVersionState` read carries `schemaVersion=1`, target namespace, a separate canonical non-nil read request UUID, canonical tenant UUID, world slug, exact source operation UUID, expected source evidence digest and positive version ID. Only the exact same-namespace World workload may use this read, before decoding or owner access; it is not an additional allowance for the legacy generic `GetVersionState` internal-service branch. World proves the exact Game Design server before releasing metadata/body and validates the complete closed response.

Game Design reads the complete persisted source, its actual game-row provenance, and the exact version belonging to that source game from one owner snapshot. The version's private owner tenant key comes only from the proved Game Design source row, never from a World key or numeric equality. The response echoes the complete read context and contains the original closed source receipt, exact version ID, current lifecycle state, positive version-state epoch and derived evidence digest. Missing or contradictory source/version ownership, changed scope/echo/digest, unsupported schema, unknown fields and unavailable owner storage fail closed without mutation. This is a current snapshot read, not a stable mutation outcome: a later read may observe a later version epoch, while the immutable source receipt remains unchanged.

The version-state evidence digest uses strict UTF-8 decimal byte-length `:` framing and SHA-256, rendered as `sha256:` plus 64 lower-case hexadecimal digits. Its fixed-order segments are `game-design-authored-world-version-state/v1`, canonical decimal schema version, target namespace, read request UUID, canonical tenant UUID, world slug, source operation UUID, verified source evidence digest, canonical positive decimal version ID, exact persisted lifecycle token (for example `DRAFT`, without the protobuf `VERSION_LIFECYCLE_STATE_` prefix) and canonical positive decimal version-state epoch. The complete source receipt is independently validated against its own exhaustive digest before this outer binding is accepted. The digest supplies integrity, not authentication or a publication fence.

This read does not lock another owner, freeze publication, attest released content or authorize launch/admission. World must take the same local version fence for canonical mutation and publication; the [publication freeze and handoff](./version-control.md#publication-freeze-and-owner-handoff) remains necessary before any Published-content or `PREPARING` claim. Its producer/consumer, migration and negative proof are implementation gates, not implied by this contract.

### Audited retained Game Session tenant association

This is a distinct, one-time retained-data association, not the Account migration manifest or the normal fresh-creation path. Game Design's approved tenant owner must explicitly attest that one retained Game Session tenant key denotes its persisted canonical tenant. Existing source rows on either side, similar selectors or numeric values do not establish that relation. With no such attestation, the association remains absent and denied. Normal new creation and source intake remain automated owner work; this retained-data approval does not introduce a routine creation-time operator step.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Current script-patch publication also fails closed before finalization. Game Des

### History and Provenance Across Services

Under [ADR 0020](../../decisions/adr-0020-scoped-domain-and-operational-identifiers.md), Game Design persists the opaque, non-nil UUID `versionId` separately from its private numeric `version.id`, bound immutably to the exact Version row and its canonical tenant/source-game tuple. Retained versions without an owner-persisted mapping remain unmapped and fail closed; their logical IDs are never derived from numeric keys.

The Game Design Service is the canonical history store for world and entity
content even though domain services own the runtime templates:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This document defines the Game Logic Service runtime model, dependency ownership

The sections below define the target-state runtime contract. Current implementation and proof status is:

- The current implementation attests an empty owned-rule manifest and returns synthetic `appliedCommitId = "version:<versionId>"` because Game Logic does not yet own version-scoped draft rule tables. The empty-manifest digest is intentional and does not represent hidden service state.
- The current full-version digest producer fails closed because Game Logic lacks the owner-local rule-input manifest and provenance needed to attest the selected version. It does not turn missing rule inputs into an empty manifest or synthetic commit identity. The publication binding and participant consequence are recorded in [API Contracts](api-contracts.md); the normal owner manifest and dedicated ability-schema producer remain required implementation work.
- Same-type Game Logic takeover behind an existing edge connection is target behavior, but suppression of a client-visible reconnect after an ordinary qualifying Game Logic restart remains implementation or proof debt under ADR 0013.
- Target: `SendCommunication` and every other player-delegated gameplay RPC propagate one complete, validated typed `PlayerExecutionContext` from Game Session through Game Logic and onward. Game Logic validates the context against request and owner evidence, never treats caller-supplied identifiers as authority, remains stateless, and owns semantic gameplay outcomes; Game Session owns session, reconnect, and presentation state. This is the ADR 0024 target contract.
- Current implementation gap: the live `SendCommunicationRequest` is still a flat schema with tenant/session/character/account, communication/text and target metadata, room, game-instance, speaker, and effect fields plus legacy `session_attestation`; its current proto does not carry typed `playableStateNamespaceId`, `playableStateScope`, region/epoch, pointer, or admitted-bundle fields. Complete typed-context propagation is therefore not current behavior or proof.
Expand Down
Loading
Loading