Skip to content

fix(release): record kit artifact provenance - #40

Merged
imjlk merged 14 commits into
mainfrom
codex/release-kit-provenance
Jul 12, 2026
Merged

imjlk merged 14 commits into
mainfrom
codex/release-kit-provenance

Conversation

@imjlk

@imjlk imjlk commented Jul 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Record downstream game source revision and mpgd-kit artifact revision separately as gitSha and kitGitSha.
  • Snapshot the clean mpgd-kit revision before effective-config or build outputs are generated, then reuse that one revision throughout the build.
  • Require execution from the root of mpgd-kit's own Git checkout so MPGD_KIT_PATH cannot accidentally inherit a parent game repository revision.
  • Validate kitGitSha as a lowercase full 40-character SHA in both the runtime assertion and JSON schema.
  • Keep the JSON schema synchronized with the emitted targetConfigVersion field.
  • Load the runtime manifest assertion from source so a fresh checkout can reach its package-build preflight without pre-existing release-manifest dist.
  • Keep CI package archives in runner.temp, build release targets while the checkout is clean, and run the prepared full test suite afterward.
  • Expand regression coverage for provenance separation, source overrides, contract mismatches, schema parity, snapshot ordering, root mismatches, dirty worktrees, and Git failure paths.

Validation

  • pnpm graph:target
  • pnpm graph:package
  • pnpm graph:preflight
  • pnpm check
  • pnpm exec ttsc --noEmit -p tsconfig.tools.json
  • pnpm --filter @mpgd/release-manifest check
  • pnpm build:packages
  • pnpm smoke:release-manifest-merge
  • pnpm test on Node 24.11.0
  • pnpm test:prepared after a prepared package build
  • Default pnpm build:web after removing packages/release-manifest/dist
  • MPGD_SKIP_BUILD_TARGET_PREFLIGHT=1 pnpm build:web and pnpm smoke:target web-preview from a clean committed worktree
  • MPGD_SKIP_BUILD_TARGET_PREFLIGHT=1 pnpm build:microsoft-store and pnpm smoke:target microsoft-store from the same clean worktree
  • MPGD_AIT_PACKAGE_MODE=skip pnpm build:ait from a clean committed worktree
  • git range-diff after rebasing onto main at 619d031 (all 14 commits unchanged)
  • git diff --check origin/main...HEAD

Review follow-up

  • Reviewed every logical commit with Open Code Review.
  • Addressed all High/Medium findings in follow-up commits; the latest follow-up review completed with zero comments.
  • Added Git-root ownership checks, pre-output provenance capture, strict runtime SHA validation, single-read target metadata, actionable mismatch diagnostics, and fresh-checkout module loading in response to Codex and OCR feedback.
  • Fixed the CI ordering exposed by strict provenance without weakening the clean-worktree check; a prepared test script avoids rebuilding packages twice.
  • Replied to and resolved all seven inline review threads, then completed clean Codex and CodeRabbit re-reviews on the rebased head.

Release impact

No Sampo changeset is included. @mpgd/release-manifest is currently private: true at 0.0.0, and the repository ignores unpublished packages. Making it publishable requires a separate initial-publish/OIDC workflow and is outside this PR.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Release manifests now carry a validated kit Git SHA, enforce clean repository metadata, reuse resolved identity during generation, and expand smoke coverage. Target builds use the in-process writer, while CI builds and tests prepared packages using runner temporary directories.

Changes

Release manifest identity

Layer / File(s) Summary
Manifest contract and validation
packages/release-manifest/src/index.ts, release.manifest.schema.json
Manifests require kitGitSha and targetConfigVersion; kit SHA values receive runtime and schema validation.
Git identity-aware manifest generation
tools/target/generate-release-manifest.ts
Generation resolves and validates a full kit SHA, requires a clean top-level kit checkout, derives source identity, and includes kit identity in merge matching.
Build pipeline integration
tools/target/build-target.ts
Target builds use an in-process release-manifest writer with selected environment variables.
Merge and Git validation coverage
tools/smoke/release-manifest-merge.ts
Smoke tests simulate Git states, validate schema contracts, and cover successful and failing manifest merges.

CI artifact storage

Layer / File(s) Summary
Runner temporary distribution artifact
.github/workflows/ci.yml, package.json
CI builds packages before creating the distribution tarball, transfers it through runner temporary storage, extracts it in platform jobs, and runs prepared verification tests.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant BuildTarget
  participant ReleaseManifestWriter
  participant GitRepository
  participant ReleaseManifest
  BuildTarget->>ReleaseManifestWriter: write captured manifest
  ReleaseManifestWriter->>GitRepository: resolve full kit SHA
  GitRepository-->>ReleaseManifestWriter: kitGitSha and clean repository state
  ReleaseManifestWriter->>ReleaseManifest: generate manifest identity
  ReleaseManifest-->>BuildTarget: return release manifest
Loading

Possibly related PRs

  • imjlk/mpgd-kit#19: Both modify the release-manifest generation pipeline and target metadata handling.
  • imjlk/mpgd-kit#36: Both modify release-manifest generation, contract matching, and Git SHA handling.

Poem

A rabbit hops through SHA-filled hay,
Clean Git roots mark the way.
Manifests bloom with fields precise,
Tarballs rest where runners slice.
thump thump—the builds now flow.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately summarizes the main change: recording kit artifact provenance.
Description check ✅ Passed The description covers the required Summary and Validation sections and adds useful notes and follow-up context.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/release-kit-provenance

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

imjlk commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

@imjlk, sure — I'll review the changes now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c57c89e922

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/release-manifest/src/index.ts Resolved

imjlk commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Addressed the two P2 findings in 6d19047/8b2db36 (schema contract) and 43cc304/6599625 (dirty-worktree provenance). The fixes are pushed, their threads have detailed replies and are resolved, each follow-up commit passed Open Code Review, and pnpm check plus full pnpm test pass.

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

@imjlk, thanks for the update — I'll review the changes now, including the fixes in 6d19047/8b2db36 and 43cc304/6599625.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65996254ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/release-manifest/src/index.ts Resolved
@imjlk

imjlk commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Follow-up fixes are pushed at 4bf7934. All actionable review threads are answered and resolved, per-commit Open Code Review is clean after the follow-up, and local check/test/web/AIT validation passes.

@codex review
@coderabbitai review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

@imjlk, thanks for the update — I'll review the changes now, including the follow-up fixes pushed at 4bf7934.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@imjlk

imjlk commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

The CI-only follow-up is pushed at 69554d6. It keeps strict provenance intact by building release targets before test-generated source outputs, adds test:prepared to avoid duplicate package builds, passes the reproduced package/web/Microsoft/test sequence locally, and the follow-up Open Code Review is clean.

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

@imjlk, thanks for the update — I'll review the changes now, including the CI-only follow-up pushed at 69554d6 (release-target build ordering ahead of test-generated source outputs and the new test:prepared script).

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 69554d617e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/target/build-target.ts Resolved
@imjlk
imjlk force-pushed the codex/release-kit-provenance branch from 69554d6 to 3f6e630 Compare July 12, 2026 05:10
@imjlk

imjlk commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

PR #40 is rebased onto the new main at 619d031 after #41 merged. The rebase range-diff is identical for all 14 commits. The fresh-checkout dist dependency is fixed in 3f6e630 and verified by removing release-manifest dist before a default web build; the i18n thread is answered with git-ignore evidence. Both threads are resolved, and rebased pnpm check, release-manifest smoke, and default web build pass.

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

@imjlk, thanks for the update — I'll review the changes now, including the rebase onto 619d031, the fresh-checkout dist fix in 3f6e630, and the resolved i18n thread.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 3f6e63043d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@imjlk
imjlk merged commit b534bcf into main Jul 12, 2026
6 checks passed
@imjlk
imjlk deleted the codex/release-kit-provenance branch July 15, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant