Skip to content

build: Rename C++ build tasks to add cpp- prefix. - #178

Merged
sitaowang1998 merged 63 commits into
y-scope:mainfrom
sitaowang1998:build-task
Aug 7, 2025
Merged

build: Rename C++ build tasks to add cpp- prefix.#178
sitaowang1998 merged 63 commits into
y-scope:mainfrom
sitaowang1998:build-task

Conversation

@sitaowang1998

@sitaowang1998 sitaowang1998 commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator

Description

Note

This PR depends on #176.

This PR renames C++ build tasks with cpp- prefix to avoid name collision with future build tasks for other languages.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  • GitHub workflows pass.

Summary by CodeRabbit

  • New Features
    • Added TOML file linting and formatting tasks, including new configuration and schema validation for TOML files.
    • Introduced strict type checking with a new type checking configuration.
  • Bug Fixes
    • Improved type annotations and type safety in integration tests, enhancing clarity and static analysis.
  • Chores
    • Updated dependency management by consolidating test and lint requirements.
    • Refined task naming for build and test automation.
    • Improved code style and formatting consistency in configuration files.

sitaowang1998 and others added 30 commits July 15, 2025 13:40
Co-authored-by: Lin Zhihao <59785146+LinZhihao-723@users.noreply.github.com>
…ider into dep-concurrency"

This reverts commit 1769c95, reversing
changes made to 90aa5a2.
@sitaowang1998
sitaowang1998 requested a review from a team as a code owner August 5, 2025 22:07
@coderabbitai

coderabbitai Bot commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@sitaowang1998 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 38 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between bad9675 and f447614.

📒 Files selected for processing (1)
  • test-tasks.yaml (1 hunks)

Walkthrough

This update introduces TOML linting and formatting support, adds and refines type annotations in integration tests, consolidates Python and test dependencies, and updates build/test task configurations accordingly. It also introduces new configuration files for mypy and tombi, and removes the now-redundant test-requirements.txt.

Changes

Cohort / File(s) Change Summary
Build Task Renaming
build-tasks.yaml, test-tasks.yaml
Renamed build tasks from target/clean to cpp-target/cpp-clean and updated dependencies in test tasks to reference new names.
TOML Linting and Formatting
lint-tasks.yaml, tombi.toml
Added TOML lint/format tasks, integrated tombi tool, updated check/fix pipelines, and introduced TOML linting configuration.
Python/Test Dependency Consolidation
lint-test-requirements.txt, test-requirements.txt, test-tasks.yaml
Added lint/test dependencies to lint-test-requirements.txt, removed test-requirements.txt, and updated venv setup to use the consolidated file.
Type Checking and Lint Configurations
mypy.ini, ruff.toml
Added strict mypy config, refined ruff.toml indentation (no functional change).
Integration Test Type Annotations
tests/integration/client.py, tests/integration/test_client.py, tests/integration/test_scheduler_worker.py, tests/integration/test_signal.py, tests/integration/utils.py
Introduced SQLConnection type alias, updated all relevant type annotations, improved subprocess typing, and clarified socket address types.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Lint as TOML Lint Task
    participant Tombi as tombi Tool

    Dev->>Lint: Run toml-check/toml-fix
    Lint->>Tombi: Run tombi lint/format on .toml files
    Tombi-->>Lint: Lint/format results
    Lint-->>Dev: Report outcome
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • kirkrodrigues
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai 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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
mypy.ini (1)

10-11: Narrow the blanket import ignore?

ignore_missing_imports = true for the whole msgpack.* tree can mask real typing errors inside wrapper utilities built around that library. If only a subset of sub-modules causes issues, consider narrowing the pattern or supplying stubs instead.

lint-test-requirements.txt (1)

6-10: Version floor added; consider an upper pin

All new lint deps (mypy, tombi) are pinned only with a minimum version. Both tools occasionally ship breaking changes under a minor bump. Adding ,<next-major guards (e.g., mypy>=1.12,<2) helps keep CI green.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bcec1a7 and 8ddbda7.

📒 Files selected for processing (13)
  • build-tasks.yaml (2 hunks)
  • lint-tasks.yaml (5 hunks)
  • lint-test-requirements.txt (1 hunks)
  • mypy.ini (1 hunks)
  • ruff.toml (1 hunks)
  • test-requirements.txt (0 hunks)
  • test-tasks.yaml (3 hunks)
  • tests/integration/client.py (11 hunks)
  • tests/integration/test_client.py (2 hunks)
  • tests/integration/test_scheduler_worker.py (11 hunks)
  • tests/integration/test_signal.py (6 hunks)
  • tests/integration/utils.py (1 hunks)
  • tombi.toml (1 hunks)
💤 Files with no reviewable changes (1)
  • test-requirements.txt
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: sitaowang1998
PR: y-scope/spider#172
File: tombi.toml:7-10
Timestamp: 2025-08-03T02:01:57.863Z
Learning: There may be discrepancies in publicly available documentation about tombi TOML linter rule identifiers. When in doubt, defer to the project maintainer's knowledge of the official documentation and test the configuration to ensure it works correctly.
📚 Learning: there may be discrepancies in publicly available documentation about tombi toml linter rule identifi...
Learnt from: sitaowang1998
PR: y-scope/spider#172
File: tombi.toml:7-10
Timestamp: 2025-08-03T02:01:57.863Z
Learning: There may be discrepancies in publicly available documentation about tombi TOML linter rule identifiers. When in doubt, defer to the project maintainer's knowledge of the official documentation and test the configuration to ensure it works correctly.

Applied to files:

  • ruff.toml
  • tombi.toml
  • lint-tasks.yaml
📚 Learning: in the spider project, external tools like `uv`, python, and task are documented as requirements in ...
Learnt from: sitaowang1998
PR: y-scope/spider#172
File: build-tasks.yaml:21-45
Timestamp: 2025-08-03T01:49:27.764Z
Learning: In the spider project, external tools like `uv`, Python, and Task are documented as requirements in README.md and are expected to be pre-installed by users rather than bootstrapped by the build system.

Applied to files:

  • test-tasks.yaml
📚 Learning: in task build systems, glob patterns like "python/**/*" properly match files at any nested level, in...
Learnt from: sitaowang1998
PR: y-scope/spider#172
File: build-tasks.yaml:26-29
Timestamp: 2025-08-03T01:54:03.099Z
Learning: In Task build systems, glob patterns like "python/**/*" properly match files at any nested level, including package-level pyproject.toml files in subdirectories like "python/spider/client/pyproject.toml". The "**" wildcard recursively matches any number of directory levels.

Applied to files:

  • test-tasks.yaml
📚 Learning: in tombi toml linter configuration, the correct rule identifier for checking empty keys is `key-empt...
Learnt from: sitaowang1998
PR: y-scope/spider#172
File: tombi.toml:7-10
Timestamp: 2025-08-03T02:01:57.863Z
Learning: In tombi TOML linter configuration, the correct rule identifier for checking empty keys is `key-empty`. The command `tombi --help rules` does not exist. The official documentation is available at https://tombi-toml.github.io/tombi/docs/configuration/.

Applied to files:

  • tombi.toml
  • lint-tasks.yaml
📚 Learning: in tombi toml linter configuration, the correct rule identifier for checking empty keys is `key-empt...
Learnt from: sitaowang1998
PR: y-scope/spider#172
File: tombi.toml:7-10
Timestamp: 2025-08-03T02:01:57.863Z
Learning: In tombi TOML linter configuration, the correct rule identifier for checking empty keys is `key-empty`, not `keys-empty`. This is documented at https://tombi-toml.github.io/tombi/docs/configuration/.

Applied to files:

  • tombi.toml
  • lint-tasks.yaml
📚 Learning: the tombi toml linter uses `key-empty` as the correct rule identifier for checking empty keys. this ...
Learnt from: sitaowang1998
PR: y-scope/spider#172
File: tombi.toml:7-10
Timestamp: 2025-08-03T02:01:57.863Z
Learning: The tombi TOML linter uses `key-empty` as the correct rule identifier for checking empty keys. This can be verified by testing with `tombi lint` command, which will successfully process configurations using this rule identifier. The rule `keys-empty` does not exist in tombi.

Applied to files:

  • tombi.toml
  • lint-tasks.yaml
🧬 Code Graph Analysis (3)
tests/integration/test_client.py (1)
tests/integration/client.py (1)
  • storage (118-127)
tests/integration/test_scheduler_worker.py (1)
tests/integration/client.py (3)
  • storage (118-127)
  • TaskGraph (51-56)
  • Task (39-47)
tests/integration/test_signal.py (2)
tests/integration/client.py (4)
  • get_task_outputs (189-214)
  • get_task_state (217-231)
  • remove_job (234-244)
  • storage (118-127)
tests/integration/test_scheduler_worker.py (1)
  • start_scheduler_worker (32-66)
⏰ 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). (3)
  • GitHub Check: non-storage-unit-tests (ubuntu-24.04)
  • GitHub Check: non-storage-unit-tests (ubuntu-22.04)
  • GitHub Check: lint
🔇 Additional comments (36)
ruff.toml (2)

7-23: Whitespace-only change looks good

The re-indentation matches the style that tombi format will enforce, so no functional impact.


29-31: Consistent indentation preserved

Same remark here—indentation normalised, no further action.

mypy.ini (1)

1-9: Strict mode enabled – great step

Turning on strict = true will surface many latent typing issues. Output options also improve readability.

lint-test-requirements.txt (1)

12-14: Confirm runtime packages are really test-only

mysql-connector-python pulls native libs and can bloat the test venv. Double-check it is not needed at runtime so that production images stay slim.

build-tasks.yaml (1)

4-5: No remaining :build:target references detected
Ran rg --fixed-strings ':build:target' --glob '!test-tasks.yaml' --glob '!build-tasks.yaml' across the repo and found no matches.

test-tasks.yaml (2)

30-40: Dep rename propagated correctly

Dependencies now point at :build:cpp-target; matches the new task names.


59-74: No lingering references to the removed file
A global grep for test-requirements.txt only matched the expected occurrences of lint-test-requirements.txt in:

  • test-tasks.yaml
  • lint-tasks.yaml

No stray mentions of the old test-requirements.txt remain.

lint-tasks.yaml (4)

14-14: LGTM! TOML tasks properly integrated into main workflows.

The addition of toml-check and toml-fix to the main check and fix tasks ensures TOML files will be consistently linted and formatted as part of the standard development workflow.

Also applies to: 21-21


135-135: LGTM! MyPy integration enhances type checking.

Adding mypy to the Python linting workflow for integration tests will help catch type-related issues early and improve code quality.


159-180: LGTM! TOML task structure follows established patterns.

The TOML task definitions properly follow the established pattern with:

  • Separate lint and format subtasks
  • Proper dependency on the virtual environment
  • Consistent aliasing structure matching other tool configurations

205-205: Dependency consolidation verified
lint-test-requirements.txt contains all expected lint (clang-format, clang-tidy, ruff, mypy, gersemi, yamllint, tombi) and test dependencies; the old lint-requirements.txt has been removed; test-tasks.yaml references have been updated.

• lint-test-requirements.txt (root) includes all key dependencies
• Old lint-requirements.txt is no longer present
• test-tasks.yaml lines 59 and 73 now point to lint-test-requirements.txt

No further action required.

tombi.toml (4)

1-6: LGTM! File configuration is well-structured.

The file inclusion pattern covers all TOML files while properly excluding build artifacts and external tools, which is appropriate for the project structure.


9-13: LGTM! Lint rules are correctly configured.

The lint rule configuration uses the correct identifiers:

  • key-empty (not keys-empty) as confirmed by the retrieved learnings
  • dotted-keys-out-of-order and tables-out-of-order for consistent formatting
  • Warning level is appropriate for these style-related rules

15-22: LGTM! Schema validation properly configured with fallback.

The schema configuration includes both a local tombi schema catalog and an HTTPS fallback, ensuring robust schema validation even if one source is unavailable.


24-34: LGTM! Schema mappings cover common TOML files.

The schema mappings appropriately cover:

  • tombi.toml with the tombi-specific schema
  • pyproject.toml with the Python project schema
  • ruff.toml with the ruff configuration schema

This ensures proper validation for the most common TOML configuration files in Python projects.

tests/integration/utils.py (2)

5-5: LGTM! Type alias improves code clarity.

The AddrType alias clearly documents the expected structure of socket address tuples and enhances type safety throughout the module.


12-13: LGTM! Explicit typing enhances type safety.

The explicit typing of addr as AddrType before indexing improves type checking and makes the code more readable, while maintaining the same functionality.

tests/integration/test_client.py (3)

10-10: LGTM! Import consolidation improves consistency.

The switch to importing SQLConnection from .client standardizes the connection type across integration tests and reduces direct dependency on the specific MySQL connector implementation.


16-16: LGTM! More specific subprocess typing improves type safety.

The refined return type subprocess.Popen[bytes] is more specific than the generic subprocess.Popen and accurately reflects that the subprocess streams are in bytes mode.


55-55: LGTM! Consistent type annotations and documentation.

The parameter type change to SQLConnection aligns with the standardised connection typing, and the added parameter documentation improves code clarity.

Also applies to: 61-61

tests/integration/test_signal.py (5)

10-10: LGTM! TypedDict improves subprocess configuration typing.

The introduction of PopenOpts as a TypedDict provides explicit typing for subprocess configuration options, making the code more maintainable and self-documenting.

Also applies to: 30-37


20-20: LGTM! Consistent connection type standardisation.

The switch to SQLConnection from .client maintains consistency with other integration test modules and reduces coupling to the specific MySQL connector implementation.


41-41: LGTM! Precise subprocess typing enhances type safety.

The refined return type subprocess.Popen[bytes] accurately reflects the subprocess stream mode and provides better type checking than the generic subprocess.Popen.


53-57: LGTM! Well-structured subprocess configuration.

The use of the PopenOpts TypedDict for subprocess configuration is clean and maintainable, explicitly defining the options passed to subprocess.Popen.


84-85: LGTM! Consistent type annotations across test methods.

The updated type annotations for storage and scheduler_worker_signal parameters are consistent with the standardised SQLConnection type and specific subprocess.Popen[bytes] typing used throughout the file.

Also applies to: 109-110, 186-187

tests/integration/test_scheduler_worker.py (6)

22-22: LGTM: Import change aligns with type system improvements.

The import of SQLConnection from the client module provides better type safety by using a unified type alias for MySQL connections.


34-34: LGTM: Subprocess type annotation improvement.

The refined return type tuple[subprocess.Popen[bytes], subprocess.Popen[bytes]] provides better type clarity by specifying the generic parameter for Popen, which helps with static type analysis.


71-71: LGTM: Consistent type annotation update.

The parameter type change from the MySQL connection generator to SQLConnection aligns with the unified type alias introduced in the client module, improving consistency across the integration tests.

Also applies to: 77-77


93-93: LGTM: Fixture parameter type consistency.

The SQLConnection type annotation maintains consistency with other fixture parameters and the unified type system.


160-160: LGTM: Consistent fixture parameter typing.

All fixture functions now use the SQLConnection type alias consistently, which improves type safety and maintainability across the test suite.

Also applies to: 191-191, 231-231


276-277: LGTM: Test method parameter type improvements.

The test method parameters now use:

  1. SQLConnection instead of the MySQL connection generator type
  2. Direct fixture return types (e.g., Task, tuple[TaskGraph, Task, Task, Task]) instead of generator wrappers

These changes improve type clarity and align with the fixture implementations that yield the actual objects rather than generators.

Also applies to: 306-307, 323-324, 343-344

tests/integration/client.py (5)

7-7: LGTM: Import addition for type casting.

The cast import from typing is appropriately added to support explicit type casting for database query results.


74-77: LGTM: Well-designed type alias for MySQL connections.

The SQLConnection type alias effectively unifies the two MySQL connection types (MySQLConnectionAbstract and PooledMySQLConnection) that can be returned by mysql.connector.connect(). This provides better type safety while accommodating the different connection implementations.


80-80: LGTM: Consistent function signature updates.

All database functions now use the SQLConnection type alias instead of the specific mysql.connector.MySQLConnection type. This change provides better type safety and consistency across the client module.

Also applies to: 118-118, 130-130, 189-189, 217-217, 234-234, 247-247, 261-261, 280-280


203-204: LGTM: Explicit type casting improves type safety.

The explicit cast to list[tuple[str, str | None, bytes | None]] clarifies the expected structure of the fetched rows from the database query. This helps with static type analysis and makes the code more robust.


227-227: LGTM: Type casting for single row result.

The cast to tuple[str] for the fetchone() result appropriately handles the expected single-row, single-column result from the state query. This prevents potential None type issues and clarifies the expected data structure.

@LinZhihao-723 LinZhihao-723 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For the PR title, how about:

build: Rename C++ build tasks to add `cpp-` prefix.

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.

2 participants