Skip to content

Conversation

@0xisk
Copy link
Member

@0xisk 0xisk commented Nov 3, 2025

Types of changes

What types of changes does your code introduce to OpenZeppelin Midnight Contracts?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Fixes #212 #268

PR Checklist

  • I have read the Contributing Guide
  • I have added tests that prove my fix is effective or that my feature works
  • I have added documentation of new methods and any new behavior or changes to existing behavior
  • CI Workflows Are Passing

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

Summary by CodeRabbit

  • New Features

    • Package now published to npm registry with automated versioning and dist-tag management.
    • Integrated Compact compiler setup in GitHub Actions workflows.
  • Documentation

    • Added comprehensive release workflow guide.
  • Chores

    • Streamlined build process in CI/CD pipeline.
    • Updated package metadata (description, license, repository information).

@0xisk 0xisk requested a review from a team as a code owner November 3, 2025 09:10
@coderabbitai
Copy link

coderabbitai bot commented Nov 3, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Establishes release infrastructure by introducing new CI workflows for version bumping and npm publishing, centralizing Compact compiler setup in a composite action, refactoring the build pipeline to a four-step process, and adding public package metadata to enable distribution while documenting the complete release workflow.

Changes

Cohort / File(s) Summary
GitHub Actions Setup Infrastructure
.github/actions/setup/action.yml
Adds integrated Compact compiler support with new input skip-compact (default false), new outputs compact-home and compact-version, caching for compiler artifacts, installation step from COMPACT_INSTALLER_URL, environment setup, and version validation step comparing installed compiler and language versions against expected values.
Release Workflows
.github/workflows/prepare-release.yml, .github/workflows/release.yml
Introduces two new workflows: prepare-release triggers on release branch creation to auto-bump version in contracts/package.json and perform global version string replacements; release triggers on publication to build contracts, validate version consistency, compute npm dist-tag based on semver prerelease status, verify tarball contents, and publish to npm.
Workflow Updates
.github/workflows/checks.yml, .github/workflows/codeql.yml, .github/workflows/test.yml
Adds COMPACT_INSTALLER_URL environment variable at job level across all workflows; test.yml removes manual compiler setup steps and replaces with turbo compact invocation.
Build System Refactor
compact/src/Builder.ts
Replaces prior BUILD steps with new four-step pipeline: clean dist directory, TypeScript compilation (tsc --project tsconfig.build.json), copy .compact files preserving structure, and copy package metadata; updates progress messaging and adds build completion log.
Package Configuration
contracts/package.json
Removes private flag and module resolution fields (main, module, types, exports); adds public metadata (version, description, keywords, repository, license, author, bugs, homepage); declares type as "module"; updates build script from "compact-builder && tsc" to "compact-builder".
TypeScript Configuration
contracts/tsconfig.json
Narrows TypeScript compilation scope from src/\\/\.ts to src/\\/witnesses/\\/\.ts and adds src/archive/ to excludes; removes sourceMap option from compilerOptions.
Release Documentation
RELEASING.md
New documentation file detailing six-step release workflow: checkout release branch, create and push release branch, open PR for automated version bumping, merge and tag from release branch, publish release in GitHub, and create documentation branch from released tag.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub as GitHub Actions
    participant Installer as Compact Installer
    participant npm as npm Registry

    rect rgb(200, 220, 240)
    Note over User,GitHub: Prepare Release Phase
    User->>GitHub: Push release branch (release-v*)
    GitHub->>GitHub: prepare-release workflow triggers
    GitHub->>GitHub: Extract version from branch name
    GitHub->>GitHub: Update contracts/package.json
    GitHub->>GitHub: Replace version strings in codebase
    GitHub->>GitHub: Auto-commit changes
    end

    rect rgb(240, 220, 200)
    Note over User,GitHub: Version Validation & Setup
    User->>GitHub: Create release tag & publish
    GitHub->>GitHub: release workflow triggers
    GitHub->>GitHub: Build contracts
    GitHub->>GitHub: Validate tag vs package.json version
    end

    rect rgb(220, 240, 200)
    Note over GitHub,npm: Publishing Phase
    GitHub->>GitHub: Pack tarball from contracts/dist
    GitHub->>GitHub: Compute npm dist-tag (latest/beta/next)
    GitHub->>GitHub: Verify tarball (no private field)
    GitHub->>npm: Publish tarball with tag & provenance
    npm-->>GitHub: Package published
    GitHub->>User: Log success with install instructions
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Workflows scope: Two entirely new workflows (prepare-release.yml, release.yml) with distinct logic for version bumping and npm publishing; version mismatch detection and error handling paths require separate reasoning
  • Setup action complexity: New composite action steps with conditional logic (cache-hit checks, skip-compact guards), environment variable exports, version validation, and error emission
  • Build pipeline changes: Four-step refactored pipeline in Builder.ts with distinct file traversal logic and artifact handling differs substantially from prior single-command approach
  • Package.json metadata: Removal of several fields and addition of public metadata requires validation against release requirements and npm publishing expectations
  • tsconfig.json narrowing: Scope reduction to witnesses-only compilation requires understanding impact on type checking and build outputs
  • Heterogeneous nature: Changes span CI/CD orchestration, build system, package configuration, and TypeScript compilation—each domain has distinct implications

Areas requiring extra attention:

  • Version extraction and bumping logic in prepare-release.yml (glob patterns, version derivation from branch name)
  • npm dist-tag computation logic in release.yml based on semver prerelease detection
  • Tarball content validation and private field checks before publishing
  • Build pipeline step ordering and file traversal logic in Builder.ts, particularly .compact file filtering and exclusions
  • Compiler version validation logic in setup action step
  • TypeScript scope narrowing and impact on non-witness source files

Poem

🐰 A builder's burrow grows ever more grand,
With pipelines and packages, all carefully planned!
From witnesses whispering to releases refined,
We hop toward npm with version aligned—
Four steps build, one publish, the whole world to find!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The PR title "fix(gh-actions): release PR requisted changes" does not accurately represent the nature and scope of the changes. According to the linked issue #212, this PR is implementing a new feature (as marked in the issue checklist), not fixing an existing issue. The changes include adding new release and prepare-release workflows, creating a setup composite action, adding release documentation, improving the build for packaging, and modifying package metadata. The title uses the wrong type marker ("fix" instead of "feat"), and the description "release PR requested changes" is vague and doesn't clearly convey what was actually implemented.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues Check ✅ Passed The PR implements all primary objectives from linked issue #212. It adds the release.yml and prepare-release.yml workflows for automating npm publishing and version bumping [#212], consolidates compact compiler installation into the setup composite action [#212], includes the new RELEASING.md documentation [#212], improves the build logic in Builder.ts to create a dist directory with repo structure minus src/ [#212], narrows the TypeScript configuration to focus on witnesses [#212], and removes the private field from contracts/package.json to enable publishing [#212, #149]. The changes to test.yml and workflow environment variables align with the setup action consolidation objective.
Out of Scope Changes Check ✅ Passed All code changes are directly related to and support the objectives defined in linked issue #212. The modifications span the expected files: GitHub Actions workflows (setup, prepare-release, release, checks, codeql, test), release documentation (RELEASING.md), build improvements (compact/src/Builder.ts), packaging configuration (contracts/package.json, contracts/tsconfig.json), and environment variable setup across workflows. No changes appear to be unrelated to the release automation, packaging, or compiler setup objectives outlined in the linked issue.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

Copy link
Contributor

@emnul emnul left a comment

Choose a reason for hiding this comment

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

Let me know what you think about the changes:

  • Updated references to Compact 0.26.0
  • Updated actions to latest versions
  • Updated runner to use pinned version

As well as the proposed change to prerelease.yml

@0xisk
Copy link
Member Author

0xisk commented Nov 7, 2025

@emnul Thank you! Could you please give it a look? But maybe lets merge this PR first #212 and then I will rebase to merge this one.

@emnul
Copy link
Contributor

emnul commented Nov 11, 2025

Thank you for your contributions @0xisk !

@emnul emnul merged commit 3acb3a1 into main Nov 11, 2025
8 checks passed
@emnul emnul deleted the fix/release-issues branch November 11, 2025 00:32
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.

4 participants