Skip to content

Conversation

@arad-starkware
Copy link
Collaborator

@arad-starkware arad-starkware commented Nov 23, 2025

This change is Reviewable


Note

Run pre-commit in CI, add hooks for flow tests and Cairo formatting, and remove redundant Python/setup and formatting steps from the workflow.

  • CI (GitHub Actions):
    • Add pre-commit job running with setup-snfoundry, setup-scarb, and pre-commit/action (with SKIP=scarb-toml-url-lock).
    • Remove Python setup and direct flow-test check; drop scarb fmt --check from test job.
  • Pre-commit Hooks:
    • Add ensure-flow-struct-tests (runs scripts/check_all_flows_have_test.py --allow-duplicate-tests).
    • Add cairo-scarb-fmt (scarb fmt -w --check).
    • Keep scarb-toml-url-lock; configure stages (pre-commit, pre-push, manual).
  • Scripts:
    • Make scripts/check_all_flows_have_test.py executable via shebang.

Written by Cursor Bugbot for commit 4a2bac2. This will update automatically on new commits. Configure here.

Copy link
Collaborator Author

arad-starkware commented Nov 23, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codecov
Copy link

codecov bot commented Nov 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.60%. Comparing base (a28d60e) to head (8bbad41).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #52      +/-   ##
==========================================
+ Coverage   95.43%   95.60%   +0.16%     
==========================================
  Files          45       45              
  Lines        9446     9783     +337     
==========================================
+ Hits         9015     9353     +338     
+ Misses        431      430       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arad-starkware arad-starkware force-pushed the arad/chore_add_pre-commit branch from bc32940 to 04e5d6b Compare November 23, 2025 12:57
Copy link
Collaborator

@noa-starkware noa-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @NirLevi-starkware)


.pre-commit-config.yaml line 6 at r2 (raw file):

      - id: cairo-scarb-fmt
        name: check cairo code is formatted
        entry: scarb fmt -w --check

Is this going to slow the push?

Copy link
Collaborator Author

@arad-starkware arad-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @NirLevi-starkware and @noa-starkware)


.pre-commit-config.yaml line 6 at r2 (raw file):

Previously, noa-starkware wrote…

Is this going to slow the push?

Not the push, but the commit: yea, a bit.

Copy link
Collaborator

@noa-starkware noa-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @arad-starkware and @NirLevi-starkware)


.pre-commit-config.yaml line 6 at r2 (raw file):

Previously, arad-starkware wrote…

Not the push, but the commit: yea, a bit.

Lets try it for now and maybe remove it later

Copy link
Collaborator

@noa-starkware noa-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @arad-starkware and @NirLevi-starkware)


.pre-commit-config.yaml line 12 at r2 (raw file):

      - id: ensure-flow-struct-tests
        name: ensure flow structs have tests
        entry: scripts/check_all_flows_have_test.py --allow-duplicate-tests

Is this necessary here?

Copy link
Collaborator Author

@arad-starkware arad-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @NirLevi-starkware and @noa-starkware)


.pre-commit-config.yaml line 12 at r2 (raw file):

Previously, noa-starkware wrote…

Is this necessary here?

I wouldn't say any of these checks (in this PR) are necessary, since they're checked in the CI. But I think it's better to find this out here instead of only after pushing.

@arad-starkware arad-starkware force-pushed the arad/chore_add_pre-commit branch 3 times, most recently from 9c47c2d to 5a66e7e Compare November 23, 2025 15:29
@arad-starkware arad-starkware changed the base branch from main to graphite-base/52 November 23, 2025 16:29
@arad-starkware arad-starkware force-pushed the arad/chore_add_pre-commit branch from 5a66e7e to 4baaed7 Compare November 23, 2025 16:29
@arad-starkware arad-starkware changed the base branch from graphite-base/52 to arad/chore_add_check_for_rpc_url November 23, 2025 16:29
@arad-starkware arad-starkware force-pushed the arad/chore_add_pre-commit branch from 4baaed7 to aaee246 Compare November 23, 2025 16:37
@arad-starkware arad-starkware force-pushed the arad/chore_add_check_for_rpc_url branch 2 times, most recently from 894eed0 to c44bef8 Compare November 23, 2025 16:38
@arad-starkware arad-starkware force-pushed the arad/chore_add_pre-commit branch from aaee246 to ad14015 Compare November 23, 2025 16:38
@arad-starkware arad-starkware changed the title chore: add pre-commit chore: add existing checks to pre-commit, use pre-commit in CI Nov 23, 2025
@arad-starkware arad-starkware changed the base branch from arad/chore_add_check_for_rpc_url to graphite-base/52 November 23, 2025 16:48
@arad-starkware arad-starkware force-pushed the arad/chore_add_pre-commit branch from ad14015 to 2fcf1b8 Compare November 23, 2025 16:49
@graphite-app graphite-app bot changed the base branch from graphite-base/52 to main November 23, 2025 16:50
@arad-starkware arad-starkware force-pushed the arad/chore_add_pre-commit branch from 2fcf1b8 to 8bbad41 Compare November 23, 2025 16:50
@arad-starkware arad-starkware changed the base branch from main to graphite-base/52 November 23, 2025 16:57
@arad-starkware arad-starkware force-pushed the arad/chore_add_pre-commit branch from 8bbad41 to e989adb Compare November 23, 2025 16:57
@arad-starkware arad-starkware changed the base branch from graphite-base/52 to arad/chore_update_pre-commit_stage_name November 23, 2025 16:57
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.12.2"
- uses: pre-commit/[email protected]
Copy link

Choose a reason for hiding this comment

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

Bug: Python setup removed but hooks need Python

The pre-commit job removed the explicit Python setup that was in the old verify_flows job, but the pre-commit hooks still run Python scripts (check_all_flows_have_test.py and check_scarb_url_lock.py configured with language: system). While ubuntu-latest has Python pre-installed, relying on it without explicit setup is fragile and could break if GitHub modifies their runner images.

Fix in Cursor Fix in Web

@arad-starkware arad-starkware force-pushed the arad/chore_add_pre-commit branch 4 times, most recently from 4348046 to b5cde98 Compare November 23, 2025 17:03
entry: scarb fmt -w --check
language: system
pass_filenames: false
stages: [pre-push]
Copy link

Choose a reason for hiding this comment

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

Bug: Pre-push hooks won't run in CI

The cairo-scarb-fmt and ensure-flow-struct-tests hooks are configured with stages: [pre-push], but the CI job uses pre-commit/action which runs pre-commit run --all-files by default. This command only executes hooks in the commit stage, so these two important checks that previously ran in CI will no longer execute. The workflow needs to specify --hook-stage push or --hook-stage manual, or the hooks should use stages: [commit] or stages: [manual] to run in CI.

Additional Locations (1)

Fix in Cursor Fix in Web

@arad-starkware arad-starkware force-pushed the arad/chore_add_pre-commit branch from b5cde98 to f467ee6 Compare November 23, 2025 17:10
@arad-starkware arad-starkware force-pushed the arad/chore_add_pre-commit branch from f467ee6 to 4a2bac2 Compare November 23, 2025 17:24
@arad-starkware arad-starkware changed the base branch from arad/chore_update_pre-commit_stage_name to graphite-base/52 November 24, 2025 12:12
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.

3 participants