Skip to content

Add ai and dev flag for codecove coverage report#107

Open
CoveMB wants to merge 17 commits intomainfrom
codecov-ai-tests-flag
Open

Add ai and dev flag for codecove coverage report#107
CoveMB wants to merge 17 commits intomainfrom
codecov-ai-tests-flag

Conversation

@CoveMB
Copy link
Contributor

@CoveMB CoveMB commented Dec 1, 2025

Add ai and dev flag for codecove coverage report
Temporary duplicate tests for testing

Summary by CodeRabbit

  • Tests

    • Added new test for transfer scheduling and execution validation.
    • Added new test for coin decimal downcast validation.
    • Expanded test coverage to include parallel test flows for comprehensive reporting.
  • Chores

    • Updated CI pipeline with extended test timeout and enhanced coverage reporting.
    • Updated ignore patterns for build and test artifacts.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 1, 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

This PR expands CI/CD test coverage by introducing three parallel coverage pipelines per package (all tests, AI-only, dev-only) with distinct Codecov flags. Two new test functions are added to validate scheduled transfer execution and safe coin downcast with same decimals. The .gitignore is updated to exclude lcov coverage and trace files.

Changes

Cohort / File(s) Summary
CI/CD Configuration
\\.github/workflows/test.yml
Adds "codecove-ai-tests-flag" to push branch filter; increases timeout from 15 to 25 minutes. Replaces single test job with three parallel coverage pipelines (all, AI-only, dev-only), each with distinct working directories, Codecov flags, names, and per-package lcov report uploads.
Git Configuration
\\.gitignore
Adds ignore patterns for lcov coverage files (**/*lcov*) and trace directories (**/traces).
Access Module Tests
contracts/access/tests/delayed_tests.move
Adds new test function ai_TMP_schedule_and_execute_transfer validating scheduled transfer execution with event assertions. Includes indentation and whitespace reformatting across existing tests.
Math Module Tests
math/core/tests/coin_utils_tests.move
Adds new test function ai_TMP_test_downcast_same_decimals validating safe coin downcast when source and target decimals match (9 decimals). Includes formatting and indentation adjustments in helper functions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • .github/workflows/test.yml: Requires careful review of the multi-pipeline coverage structure, Codecov flag naming conventions, and per-package lcov file paths to ensure correct routing of reports.
  • Test additions: Both new test functions follow established patterns and require basic verification against existing assertions.
  • .gitignore changes: Straightforward additions with minimal risk.

Possibly related PRs

Suggested reviewers

  • ericnordelo
  • immrsd
  • ericglau

Poem

🐰 Three pipelines dance, each with their own trace,
Coverage blooms in every testing place!
New tests for transfers, decimals aligned,
Quality checked—no bug left behind!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is minimal and missing key sections from the template including issue reference, detailed change context, and the PR checklist items. Add issue reference (#???), provide detailed context for the ai/dev flags, document the temporary test strategy, and include the PR checklist with appropriate task selections.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding ai and dev flags for Codecov coverage reports, which aligns with the workflow modifications in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.14%. Comparing base (8b4af8c) to head (db62f02).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #107   +/-   ##
=======================================
  Coverage   96.14%   96.14%           
=======================================
  Files          13       13           
  Lines        1193     1193           
  Branches      339      339           
=======================================
  Hits         1147     1147           
  Misses         29       29           
  Partials       17       17           
Flag Coverage Δ
contracts/access 53.50% <ø> (ø)
contracts/access-ai 53.50% <ø> (?)
contracts/access-dev 53.50% <ø> (?)
math/core 95.70% <ø> (ø)
math/core-ai 95.70% <ø> (?)
math/core-dev 95.70% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
math/core/tests/coin_utils_tests.move (1)

20-25: AI duplicate downcast test mirrors baseline behavior

ai_TMP_test_downcast_same_decimals is equivalent to test_downcast_same_decimals and correctly exercises safe_downcast_balance for same‑decimals (9→9) with the expected u64 result. This is appropriate as a temporary AI‑tagged duplicate for coverage.

Once the AI/dev‑flagged coverage setup stabilizes, consider removing this temporary duplicate or refactoring to avoid drift between the two tests, e.g., via a shared helper.

Based on learnings, the ai_ prefix usage here is consistent with the repo’s convention for AI-generated tests.

contracts/access/tests/delayed_tests.move (1)

24-45: AI variant of schedule/execute transfer test is consistent

ai_TMP_schedule_and_execute_transfer mirrors schedule_and_execute_transfer: same ownership/recipient setup, scheduling, clock advancement, execution, and event assertions, plus proper clock::destroy_for_testing cleanup. It cleanly seeds the AI-only test flow without changing behavior.

Later, once the coverage experiment is done, you might want to drop this temporary duplicate or factor the common logic into a helper to avoid keeping two copies in sync.

Based on learnings, the ai_ prefix is aligned with how this repo tracks AI-generated tests.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b4af8c and 0bc14bb.

📒 Files selected for processing (4)
  • .github/workflows/test.yml (3 hunks)
  • .gitignore (1 hunks)
  • contracts/access/tests/delayed_tests.move (1 hunks)
  • math/core/tests/coin_utils_tests.move (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: ericglau
Repo: OpenZeppelin/contracts-sui PR: 49
File: math/core/tests/u32_tests.move:455-486
Timestamp: 2025-11-18T18:31:53.671Z
Learning: In the OpenZeppelin contracts-sui repository, test function names prefixed with "ai_" are intentionally used to track tests generated by AI tools. This naming convention is acceptable and should not be flagged as inconsistent with project standards.
📚 Learning: 2025-11-04T14:38:12.309Z
Learnt from: ericnordelo
Repo: OpenZeppelin/contracts-sui PR: 40
File: math/core/sources/u8.move:50-57
Timestamp: 2025-11-04T14:38:12.309Z
Learning: In math/core/sources/{u8,u16,u32,u64,u128}.move files, the mul_shr implementations correctly ignore the overflow flag from macros::mul_shr! and rely on try_as_*() to detect when the result doesn't fit in the target type. Only u256.move needs to explicitly check the overflow flag because u256 operations can exceed u256 capacity.
<!-- [/add_learning]

Applied to files:

  • math/core/tests/coin_utils_tests.move
📚 Learning: 2025-11-18T18:31:53.671Z
Learnt from: ericglau
Repo: OpenZeppelin/contracts-sui PR: 49
File: math/core/tests/u32_tests.move:455-486
Timestamp: 2025-11-18T18:31:53.671Z
Learning: In the OpenZeppelin contracts-sui repository, test function names prefixed with "ai_" are intentionally used to track tests generated by AI tools. This naming convention is acceptable and should not be flagged as inconsistent with project standards.

Applied to files:

  • contracts/access/tests/delayed_tests.move
🪛 actionlint (1.7.9)
.github/workflows/test.yml

130-130: input "file" is not defined in action "codecov/codecov-action@v5". available inputs are "base_sha", "binary", "codecov_yml_path", "commit_parent", "directory", "disable_file_fixes", "disable_safe_directory", "disable_search", "disable_telem", "dry_run", "env_vars", "exclude", "fail_ci_if_error", "files", "flags", "force", "gcov_args", "gcov_executable", "gcov_ignore", "gcov_include", "git_service", "handle_no_reports_found", "job_code", "name", "network_filter", "network_prefix", "os", "override_branch", "override_build", "override_build_url", "override_commit", "override_pr", "plugins", "recurse_submodules", "report_code", "report_type", "root_dir", "run_command", "skip_validation", "slug", "swift_project", "token", "url", "use_legacy_upload_endpoint", "use_oidc", "use_pypi", "verbose", "version", "working-directory"

(action)


147-147: input "file" is not defined in action "codecov/codecov-action@v5". available inputs are "base_sha", "binary", "codecov_yml_path", "commit_parent", "directory", "disable_file_fixes", "disable_safe_directory", "disable_search", "disable_telem", "dry_run", "env_vars", "exclude", "fail_ci_if_error", "files", "flags", "force", "gcov_args", "gcov_executable", "gcov_ignore", "gcov_include", "git_service", "handle_no_reports_found", "job_code", "name", "network_filter", "network_prefix", "os", "override_branch", "override_build", "override_build_url", "override_commit", "override_pr", "plugins", "recurse_submodules", "report_code", "report_type", "root_dir", "run_command", "skip_validation", "slug", "swift_project", "token", "url", "use_legacy_upload_endpoint", "use_oidc", "use_pypi", "verbose", "version", "working-directory"

(action)


164-164: input "file" is not defined in action "codecov/codecov-action@v5". available inputs are "base_sha", "binary", "codecov_yml_path", "commit_parent", "directory", "disable_file_fixes", "disable_safe_directory", "disable_search", "disable_telem", "dry_run", "env_vars", "exclude", "fail_ci_if_error", "files", "flags", "force", "gcov_args", "gcov_executable", "gcov_ignore", "gcov_include", "git_service", "handle_no_reports_found", "job_code", "name", "network_filter", "network_prefix", "os", "override_branch", "override_build", "override_build_url", "override_commit", "override_pr", "plugins", "recurse_submodules", "report_code", "report_type", "root_dir", "run_command", "skip_validation", "slug", "swift_project", "token", "url", "use_legacy_upload_endpoint", "use_oidc", "use_pypi", "verbose", "version", "working-directory"

(action)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test math/core
  • GitHub Check: Test contracts/access
🔇 Additional comments (2)
.gitignore (1)

19-22: Coverage artifacts and traces correctly ignored

The **/*lcov* and **/traces patterns line up with the new per‑package lcov reports and trace directories and will keep generated coverage data out of version control. No issues from a tooling perspective.

.github/workflows/test.yml (1)

153-155: Confirm dev-only test filter behaves as intended with Sui CLI

The dev-only test run uses:

run: sui move test --trace --coverage '::([^a][^:]*|a[^i][^:]*|ai[^_][^:]*)$'

This regex is crafted to exclude functions whose names start with ai_ after the :: separator (so AI-tagged tests only run in the AI flow). That logic looks correct on paper, but it relies on how sui move test interprets the filter string (regex vs plain substring, what it matches against, etc.).

I recommend quickly validating this locally by:

  • Running sui move test '::ai_' to confirm only ai_ tests run.
  • Running sui move test '::([^a][^:]*|a[^i][^:]*|ai[^_][^:]*)$' and checking that no ai_... tests are reported.

Comment on lines 3 to 7
on:
push:
branches: [main, v*]
branches: [main, v*, "codecove-ai-tests-flag"]
pull_request:
branches: [main, v*]
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Branch filter typo will skip pushes on the intended branch

The push trigger is configured with "codecove-ai-tests-flag", but the PR source branch is codecov-ai-tests-flag (missing the extra “e”). That means pushes to the current PR branch will not trigger this workflow via push.

Recommend updating the branch name here to exactly match the actual branch you intend to use (likely codecov-ai-tests-flag).

🤖 Prompt for AI Agents
.github/workflows/test.yml around lines 3 to 7: the push trigger lists
"codecove-ai-tests-flag" which is misspelled and will not match your actual
branch name; update that entry to the correct branch name
"codecov-ai-tests-flag" (or whatever exact branch you intend) so pushes to the
PR source branch will trigger the workflow.

Comment on lines +127 to +135
- name: Upload coverage to Codecov (all)
uses: codecov/codecov-action@v5
with:
file: ./${{ matrix.package }}/lcov-all.info
flags: all,${{ matrix.package }}
name: ${{ matrix.package }}-all
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

codecov/codecov-action@v5 official documentation inputs

💡 Result:

The official inputs for codecov/codecov-action@v5 are defined in the repository's action.yml (see the "Arguments"/inputs section of the README). Do you want me to fetch and list every input and its description from action.yml now? (github.com)

Citations:


🏁 Script executed:

#!/bin/bash
# Fetch action.yml from codecov/codecov-action v5 tag
curl -s https://raw.githubusercontent.com/codecov/codecov-action/v5/action.yml | head -100

Repository: OpenZeppelin/contracts-sui

Length of output: 4328


🏁 Script executed:

#!/bin/bash
# Check if `file` parameter exists in earlier versions (v4)
curl -s https://raw.githubusercontent.com/codecov/codecov-action/v4/action.yml 2>/dev/null | grep -A 2 "^  file:" || echo "file parameter not found in v4"

Repository: OpenZeppelin/contracts-sui

Length of output: 148


Change file to files for codecov/codecov-action@v5

The action is configured with file, but codecov/codecov-action@v5 requires the input files (plural). This is a breaking change from v4. Using the incorrect parameter name will cause runtime failures.

Apply the fix to all three Codecov upload steps:

      - name: Upload coverage to Codecov (all)
        uses: codecov/codecov-action@v5
        with:
-          file: ./${{ matrix.package }}/lcov-all.info
+          files: ./${{ matrix.package }}/lcov-all.info
          flags: all,${{ matrix.package }}
          name: ${{ matrix.package }}-all
          fail_ci_if_error: true
          token: ${{ secrets.CODECOV_TOKEN }}

      - name: Upload coverage to Codecov (ai)
        uses: codecov/codecov-action@v5
        with:
-          file: ./${{ matrix.package }}/lcov-ai.info
+          files: ./${{ matrix.package }}/lcov-ai.info
          flags: ai,${{ matrix.package }}
          name: ${{ matrix.package }}-ai
          fail_ci_if_error: true
          token: ${{ secrets.CODECOV_TOKEN }}

      - name: Upload coverage to Codecov (dev)
        uses: codecov/codecov-action@v5
        with:
-          file: ./${{ matrix.package }}/lcov-dev.info
+          files: ./${{ matrix.package }}/lcov-dev.info
          flags: dev,${{ matrix.package }}
          name: ${{ matrix.package }}-dev
          fail_ci_if_error: true
          token: ${{ secrets.CODECOV_TOKEN }}

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 actionlint (1.7.9)

130-130: input "file" is not defined in action "codecov/codecov-action@v5". available inputs are "base_sha", "binary", "codecov_yml_path", "commit_parent", "directory", "disable_file_fixes", "disable_safe_directory", "disable_search", "disable_telem", "dry_run", "env_vars", "exclude", "fail_ci_if_error", "files", "flags", "force", "gcov_args", "gcov_executable", "gcov_ignore", "gcov_include", "git_service", "handle_no_reports_found", "job_code", "name", "network_filter", "network_prefix", "os", "override_branch", "override_build", "override_build_url", "override_commit", "override_pr", "plugins", "recurse_submodules", "report_code", "report_type", "root_dir", "run_command", "skip_validation", "slug", "swift_project", "token", "url", "use_legacy_upload_endpoint", "use_oidc", "use_pypi", "verbose", "version", "working-directory"

(action)

🤖 Prompt for AI Agents
In .github/workflows/test.yml around lines 127 to 135, the Codecov upload step
uses the deprecated/incorrect input name "file" instead of the required "files"
for codecov/codecov-action@v5; update the step(s) to replace the "file:" key
with "files:" (preserving the same value like ./${{ matrix.package
}}/lcov-all.info) and apply the same change to the other two Codecov upload
steps in the workflow so all three use "files" instead of "file".

needs: [setup, lint]
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 25
Copy link
Collaborator

Choose a reason for hiding this comment

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

@CoveMB why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tests can take longer to run

uses: codecov/codecov-action@v5
with:
file: ./${{ matrix.package }}/lcov.info
files: ./${{ matrix.package }}/lcov-all.info
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why changed to file -> files?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The API seem to mention files https://github.com/codecov/codecov-action
Screenshot 2025-12-09 at 12 04 07 PM

Copy link
Member

@ericnordelo ericnordelo left a comment

Choose a reason for hiding this comment

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

Is there any strong benefit for adding this? Maybe this is helpful enough, I'm not sure at this point, but running the test suite with coverage generation three times seems costful. In Sui this is doable yet, but, for example, in our current cairo repo this is unfeasible since the tests suite is not the fastest and this workflow would not pass.

.gitignore Outdated

**/*lcov*

**/traces No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

Extra line missing.

@CoveMB
Copy link
Contributor Author

CoveMB commented Dec 9, 2025

@ericnordelo That is a good point, similarly to Defender OSS where we had to increase the container ressources for them to pass. I will surface this consideration. I believe all the repos will align to the goal of having coverage generation splitting ai generated tests and dev tests, we can probably find some optimization on the way.

@ericnordelo
Copy link
Member

Sure, but I'm still curious about the benefit of it, since it adds so much overhead.

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