Skip to content

Version palette generation receipts - #7679

Merged
josephfarina merged 1 commit into
ruby/palette-ref-generatorfrom
ruby/palette-receipt-versions
Oct 19, 2026
Merged

josephfarina merged 1 commit into
ruby/palette-ref-generatorfrom
ruby/palette-receipt-versions

Conversation

@rubyycheung

Copy link
Copy Markdown
Contributor

Operational problem

spec:AST-008/FR6 requires detached palette-generation receipts to name the recipe and implementation versions and every output-format version. Existing receipts name the versioned recipe and preview format but omit the generator implementation and candidate serialization formats.

Without those identities, two generators or serializers could produce different candidate bytes while leaving the receipt unable to say which implementation and format were hashed.

Change

  • Add stable palette-generator-v1, palette-typescript-v1, and palette-json-v1 identities.
  • Record generatorVersion and candidateFormatVersion immediately before the existing candidateSha256.
  • Derive the format from the actual serialized output: TypeScript for .ts; JSON for .json and in-memory output.
  • Preserve every existing receipt field and digest.
  • Keep the public theme.mjs API unchanged; the constants remain local to the generator modules.

Theme-specific receipt regeneration remains in each owning theme PR so this infrastructure change contains no palette values.

Failure proof

The previous TonalPaletteGenerationReceipt shape contained schemaVersion, recipe, digests, request, and diagnostics, but no implementation or candidate-format version. That was incomplete against spec:AST-008/FR6 even when candidate bytes reproduced.

Success proof

  • Focused generator tests verify constants, field order, TypeScript/JSON selection, and format-specific receipt differences.
  • Existing receipt hashes, requests, and diagnostics remain unchanged.
  • Stone, Gothic, Matcha, Butter, and Y2K reproduction tests pass after adding only the two version fields to their receipts.

Unchanged product behavior

  • No palette candidate bytes or values change.
  • No token mappings, theme output, components, public APIs, or runtime code change.
  • Preview version and digest behavior remain unchanged.

Testing

  • Palette generator tests
  • Shared tolerant receipt tests
  • Stone, Gothic, Matcha, Butter, and Y2K receipt reproduction and selected-reference tests
  • Theme-template and CLI theme-bundle tests
  • Strict TypeScript check
  • ESLint and Prettier
  • pnpm check:changesets
  • pnpm check:knowledge

@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 19, 2026 6:57pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 18, 2026
@astracat-bot

astracat-bot Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 19, 2026, 7:23 PM UTC

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested for one small documentation gap; the receipt change itself looks right: generatorVersion and candidateFormatVersion satisfy AST-008 FR6, the format comes from the same serializer that produced the hashed bytes, and candidate bytes, digests, and every existing receipt field are unchanged. Because generationReceipt is part of the stable theme.palette.generate response, AST-017 DEC-4 also asks for consumer documentation of new fields in the same change, and today they are described only in the TonalPaletteGenerationReceipt typedef and the changeset. Please name both fields and their values in the theme.palette.generate entry of packages/cli/foundation/response/response-types.doc.mjs (then run pnpm -F @astryxdesign/cli readme), and ideally in the themePaletteGenerate() returns text; adding that response to response-types.doc.test.mjs would keep future receipt fields from landing undocumented.

[Automated review]

* @property {1} schemaVersion
* @property {'astryx-oklch-v1'} recipe Recipe that produced the candidate.
* @property {string} candidateSha256 SHA-256 over the candidate bytes as written.
* @property {'palette-generator-v1'} generatorVersion Generator

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

generatorVersion and candidateFormatVersion are new members of the stable theme.palette.generate response, so AST-017 DEC-4 needs them in the consumer reference too, not only in this typedef. Please name both, with their values, in the theme.palette.generate entry of packages/cli/foundation/response/response-types.doc.mjs and regenerate the CLI README table (pnpm -F @astryxdesign/cli readme).

Summary: Palette generation receipts now name the generator implementation (`generatorVersion: palette-generator-v1`) and the format of the candidate bytes they hash (`candidateFormatVersion`: `palette-typescript-v1` for a TypeScript output, `palette-json-v1` for a JSON output or a printed candidate), as AST-008 FR6 requires. The serializer returns the format together with the exact bytes it produced, so the recorded format always matches the hashed output. `candidateSha256` and every existing receipt field keep their values and order. The version constants are module exports beside `PALETTE_PREVIEW_VERSION`; the public API barrel is unchanged.

Test Plan: pnpm exec vitest run packages/cli/api/theme/palette/generate scripts/palette-receipt-test-utils.test.mjs scripts/generate-neutral-palette-refs.test.mjs scripts/check-theme-template.test.mjs; tsc --project packages/cli/tsconfig.strict.json; eslint and prettier --check on changed files; pnpm check:changesets.

Reviewers:

Subscribers:

Tasks:

Tags:

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Recommending approval: generatorVersion and candidateFormatVersion give each palette receipt the implementation and output-format identity that AST-008 FR6 asks for, the format comes from the same serializer that produced the hashed bytes, and candidate bytes, digests and every existing receipt field are unchanged. Both fields are now documented in the theme.palette.generate response reference, the generated CLI README table and the themePaletteGenerate() returns text, with a contract test guarding them, which resolves the earlier documentation request. Nothing further is needed here; the theme receipts can be regenerated in their own pull requests as planned.

[Automated review]

@josephfarina
josephfarina merged commit 19d98bf into ruby/palette-ref-generator Oct 19, 2026
11 checks passed
@github-actions
github-actions Bot deleted the ruby/palette-receipt-versions branch October 20, 2026 06:22
@rubyycheung rubyycheung mentioned this pull request Oct 20, 2026
9 tasks done
@rubyycheung
rubyycheung restored the ruby/palette-receipt-versions branch October 20, 2026 19:21
@github-actions
github-actions Bot deleted the ruby/palette-receipt-versions branch October 21, 2026 06:22
rubyycheung added a commit that referenced this pull request Oct 22, 2026
Summary: Palette generation receipts now name the generator implementation (`generatorVersion: palette-generator-v1`) and the format of the candidate bytes they hash (`candidateFormatVersion`: `palette-typescript-v1` for a TypeScript output, `palette-json-v1` for a JSON output or a printed candidate), as AST-008 FR6 requires. The serializer returns the format together with the exact bytes it produced, so the recorded format always matches the hashed output. `candidateSha256` and every existing receipt field keep their values and order. The version constants are module exports beside `PALETTE_PREVIEW_VERSION`; the public API barrel is unchanged.

Test Plan: pnpm exec vitest run packages/cli/api/theme/palette/generate scripts/palette-receipt-test-utils.test.mjs scripts/generate-neutral-palette-refs.test.mjs scripts/check-theme-template.test.mjs; tsc --project packages/cli/tsconfig.strict.json; eslint and prettier --check on changed files; pnpm check:changesets.

Reviewers:

Subscribers:

Tasks:

Tags:
rubyycheung added a commit that referenced this pull request Oct 22, 2026
* Share palette generation test infrastructure

* Record generator and format versions in palette receipts (#7679)

Summary: Palette generation receipts now name the generator implementation (`generatorVersion: palette-generator-v1`) and the format of the candidate bytes they hash (`candidateFormatVersion`: `palette-typescript-v1` for a TypeScript output, `palette-json-v1` for a JSON output or a printed candidate), as AST-008 FR6 requires. The serializer returns the format together with the exact bytes it produced, so the recorded format always matches the hashed output. `candidateSha256` and every existing receipt field keep their values and order. The version constants are module exports beside `PALETTE_PREVIEW_VERSION`; the public API barrel is unchanged.

Test Plan: pnpm exec vitest run packages/cli/api/theme/palette/generate scripts/palette-receipt-test-utils.test.mjs scripts/generate-neutral-palette-refs.test.mjs scripts/check-theme-template.test.mjs; tsc --project packages/cli/tsconfig.strict.json; eslint and prettier --check on changed files; pnpm check:changesets.

Reviewers:

Subscribers:

Tasks:

Tags:

This branch was successfully deployed

1 active deployment
Preview — 57e216ea Deployed Oct 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants