Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
187 changes: 187 additions & 0 deletions .github/workflows/workspace-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: Workspace CI

on:
pull_request:
branches:
- dev
- staging
- main
push:
branches:
- dev
- staging
- main

jobs:
workspace-build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4

- name: Cache Yarn dependencies
uses: ./.github/actions/cache-yarn
with:
path: |
.yarn/cache
node_modules
*/node_modules
packages/*/node_modules
cache-version: v1

- name: Install Dependencies
uses: ./.github/actions/yarn-install

- name: Run workspace build
run: yarn build

- name: Verify build artifacts
run: |
echo "Checking for build artifacts..."
find . -name "dist" -type d | head -10
echo "Build completed successfully!"
workspace-type-check:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4

- name: Cache Yarn dependencies
uses: ./.github/actions/cache-yarn
with:
path: |
.yarn/cache
node_modules
*/node_modules
packages/*/node_modules
cache-version: v1

- name: Install Dependencies
uses: ./.github/actions/yarn-install

- name: Run workspace type checking
run: yarn types

- name: Verify type checking passed
run: echo "Type checking completed successfully!"

workspace-lint:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4

- name: Cache Yarn dependencies
uses: ./.github/actions/cache-yarn
with:
path: |
.yarn/cache
node_modules
*/node_modules
packages/*/node_modules
cache-version: v1

- name: Install Dependencies
uses: ./.github/actions/yarn-install

- name: Run workspace linting
run: yarn lint

- name: Verify linting passed
run: echo "Linting completed successfully!"

workspace-format-check:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4

- name: Cache Yarn dependencies
uses: ./.github/actions/cache-yarn
with:
path: |
.yarn/cache
node_modules
*/node_modules
packages/*/node_modules
cache-version: v1

- name: Install Dependencies
uses: ./.github/actions/yarn-install

- name: Check code formatting (dry run)
run: |
echo "Checking if code is properly formatted..."
# Run format in dry-run mode by checking if any files would change
if ! git diff --quiet --exit-code; then
echo "Working directory not clean before format check"
git status --porcelain
exit 1
fi
yarn format
if ! git diff --quiet --exit-code; then
echo "❌ Code formatting issues found. The following files need formatting:"
git diff --name-only
echo "Run 'yarn format' to fix these issues."
exit 1
fi
Comment on lines +124 to +140
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Formatting step mutates the tree and can fail due to install side‑effects; use a non‑mutating check.

Running yarn format writes files; the pre-check also fails if install touches tracked files (common with Yarn Berry). Use a read‑only check (Prettier --check or yarn format:check) and drop the “clean before” gate.

Apply this diff:

-      - name: Check code formatting (dry run)
+      - name: Check code formatting (non-mutating)
         run: |
-          echo "Checking if code is properly formatted..."
-          # Run format in dry-run mode by checking if any files would change
-          if ! git diff --quiet --exit-code; then
-            echo "Working directory not clean before format check"
-            git status --porcelain
-            exit 1
-          fi
-          yarn format
-          if ! git diff --quiet --exit-code; then
-            echo "❌ Code formatting issues found. The following files need formatting:"
-            git diff --name-only
-            echo "Run 'yarn format' to fix these issues."
-            exit 1
-          fi
+          echo "Checking if code is properly formatted..."
+          if yarn run -s format:check 2>/dev/null; then
+            exit 0
+          fi
+          # Fallback to Prettier check if format:check script is absent
+          npx --yes prettier --check .

Ensure package.json has a “format:check”: “prettier --check .” script.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Check code formatting (dry run)
run: |
echo "Checking if code is properly formatted..."
# Run format in dry-run mode by checking if any files would change
if ! git diff --quiet --exit-code; then
echo "Working directory not clean before format check"
git status --porcelain
exit 1
fi
yarn format
if ! git diff --quiet --exit-code; then
echo "❌ Code formatting issues found. The following files need formatting:"
git diff --name-only
echo "Run 'yarn format' to fix these issues."
exit 1
fi
- name: Check code formatting (non-mutating)
run: |
echo "Checking if code is properly formatted..."
if yarn run -s format:check 2>/dev/null; then
exit 0
fi
# Fallback to Prettier check if format:check script is absent
npx --yes prettier --check .
🤖 Prompt for AI Agents
In .github/workflows/workspace-ci.yml around lines 117 to 133, the current
formatting step runs yarn format (which mutates files) and also gates on the
working tree being clean; replace this with a non‑mutating check by removing the
"clean before" gate and calling a read‑only formatter check (e.g. run yarn
format:check which executes prettier --check . or directly run prettier --check
.) so the CI fails only when files are out of format without altering the repo;
also ensure package.json defines "format:check": "prettier --check ." so the
workflow can invoke yarn format:check.

- name: Verify formatting check passed
run: echo "Code formatting check completed successfully!"

workspace-test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4

- name: Cache Yarn dependencies
uses: ./.github/actions/cache-yarn
with:
path: |
.yarn/cache
node_modules
*/node_modules
packages/*/node_modules
cache-version: v1

- name: Install Dependencies
uses: ./.github/actions/yarn-install

- name: Run workspace tests
run: yarn test

- name: Verify tests passed
run: echo "Workspace tests completed successfully!"

version-consistency:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4

- name: Cache Yarn dependencies
uses: ./.github/actions/cache-yarn
with:
path: |
.yarn/cache
node_modules
*/node_modules
packages/*/node_modules
cache-version: v1

- name: Install Dependencies
uses: ./.github/actions/yarn-install

- name: Check package version consistency
run: yarn check:versions

- name: Verify version consistency
run: echo "Package version consistency check passed!"
2 changes: 1 addition & 1 deletion circuits/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"baseUrl": ".",
"composite": false
},
"include": ["tests/**/*", "tests/**/*.json", "src/**/*"],
"include": ["tests/**/*", "tests/**/*.json", "src/**/*", "../common/src/**/*"],
Copy link

Choose a reason for hiding this comment

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

Bug: TypeScript Config Conflict: Project References vs. Source Inclusion

Adding ../common/src/**/* to the include array while also referencing ../common as a project creates a TypeScript configuration conflict. Project references are designed to manage cross-project dependencies, making direct source file inclusion redundant and potentially causing duplicate compilation, type inconsistencies, or module resolution issues.

Fix in Cursor Fix in Web

"exclude": ["node_modules"],
Comment on lines +16 to 17
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Don’t compile tests or cross‑package sources in build tsconfig; rely on project refs.

Including tests and ../common/src in this build config can (a) bloat/slow the build, (b) risk TS6059/rootDir expansion to “..” and odd emit paths, and (c) duplicate-compilation with the referenced ../common project. Keep build inputs scoped to this package’s src and exclude tests/dist.

Apply this diff:

-  "include": ["tests/**/*", "tests/**/*.json", "src/**/*", "../common/src/**/*"],
-  "exclude": ["node_modules"],
+  "include": ["src/**/*"],
+  "exclude": ["node_modules", "tests", "dist"],

If tests need TS, add a separate tsconfig.test.json that extends this and includes tests.

"references": [
{
Expand Down
12 changes: 4 additions & 8 deletions circuits/tsconfig.types.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"declarationMap": false,
"outDir": "./dist/esm",
"declarationDir": "./dist/esm",
"composite": true,
"noEmit": false,
"rootDir": "."
"outDir": "./dist/types",
"skipLibCheck": true
},
"include": ["src/**/*", "tests/**/*", "tests/**/*.json"],
"exclude": ["node_modules", "dist"]
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "tests"]
Comment on lines +6 to +10
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Harden declaration‑only build to avoid pulling in .js files.

This config inherits allowJs: true from tsconfig.json; with emitDeclarationOnly it can try to emit d.ts from JS (often incomplete/unstable). Explicitly disable JS here.

Apply this diff:

   "compilerOptions": {
     "declaration": true,
     "emitDeclarationOnly": true,
     "outDir": "./dist/types",
-    "skipLibCheck": true
+    "skipLibCheck": true,
+    "allowJs": false
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"outDir": "./dist/types",
"skipLibCheck": true
},
"include": ["src/**/*", "tests/**/*", "tests/**/*.json"],
"exclude": ["node_modules", "dist"]
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "tests"]
"outDir": "./dist/types",
"skipLibCheck": true,
"allowJs": false
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "tests"]
🤖 Prompt for AI Agents
In circuits/tsconfig.types.json around lines 6 to 10, the declaration-only build
inherits allowJs: true from the base tsconfig which can cause d.ts emission from
.js files; add "allowJs": false to the "compilerOptions" in this file (alongside
existing outDir/skipLibCheck) to explicitly disable JavaScript input for the
types-only build so only .ts files are considered.

}
Loading