Skip to content

feat(integration-tests): Record required components in PackageConfig based on the CLP package config.#1658

Merged
quinntaylormitchell merged 61 commits into
y-scope:mainfrom
quinntaylormitchell:testing-start-stop-2
Dec 4, 2025
Merged

feat(integration-tests): Record required components in PackageConfig based on the CLP package config.#1658
quinntaylormitchell merged 61 commits into
y-scope:mainfrom
quinntaylormitchell:testing-start-stop-2

Conversation

@quinntaylormitchell

@quinntaylormitchell quinntaylormitchell commented Nov 25, 2025

Copy link
Copy Markdown
Collaborator

Description

This PR introduces the component_list data member to PackageConfig data class. The data member is used for tracking which containerized components a given CLP package configuration needs to run.

PR dependencies

This PR depends on the following being merged:

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

Ran the following command from clp/integration-tests:

uv run pytest -m 'package'

Both the clp-json and clp-text tests passed.

Summary by CodeRabbit

  • Chores
    • Component selection now adapts dynamically to deployment mode and retention/archive settings for more efficient setups.
  • New Features
    • Package metadata includes an explicit list of required components.
    • Start-up logs now show the package mode and its required component list for easier verification and debugging.

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

@coderabbitai

coderabbitai Bot commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

A utility to compute required CLP components from a CLP config was added; PackageConfig now includes a component_list field. Fixtures compute and pass that list to PackageConfig, and a test logs the package's required component list at start.

Changes

Cohort / File(s) Summary
Component list utility
integration-tests/tests/utils/clp_mode_utils.py
Added helper _to_docker_compose_service_name, component name constants and groupings (CLP_BASE_COMPONENTS, CLP_QUERY_COMPONENTS, CLP_API_SERVER_COMPONENT, CLP_GARBAGE_COLLECTOR_COMPONENT, CLP_MCP_SERVER_COMPONENT) and new public function get_required_component_list(config) that builds the runtime CLP component list based on deployment type and optional settings.
Configuration data model
integration-tests/tests/utils/config.py
Added new public field component_list: list[str] to PackageConfig.
Fixture integration
integration-tests/tests/fixtures/package_config.py
Imported and used get_required_component_list to compute required_components and pass component_list=required_components when creating PackageConfig.
Test logging
integration-tests/tests/test_package_start.py
Added logging to emit fixt_package_instance.package_config.component_list (newline-joined) along with the package mode on successful start.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify conditional logic in get_required_component_list (deployment type, retention checks, optional servers).
  • Confirm component_list is correctly propagated through fixtures and accessible where logged.
  • Check naming conversion in _to_docker_compose_service_name matches actual Docker Compose service names used in tests.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a new data member component_list to PackageConfig to track required CLP components based on configuration.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Ruff (0.14.7)
integration-tests/tests/test_package_start.py

�[1;31mruff failed�[0m
�[1mCause:�[0m Failed to load extended configuration /tools/yscope-dev-utils/exports/lint-configs/python/ruff.toml (/integration-tests/pyproject.toml extends /tools/yscope-dev-utils/exports/lint-configs/python/ruff.toml)
�[1mCause:�[0m Failed to read /tools/yscope-dev-utils/exports/lint-configs/python/ruff.toml
�[1mCause:�[0m No such file or directory (os error 2)

integration-tests/tests/utils/clp_mode_utils.py

�[1;31mruff failed�[0m
�[1mCause:�[0m Failed to load extended configuration /tools/yscope-dev-utils/exports/lint-configs/python/ruff.toml (/integration-tests/pyproject.toml extends /tools/yscope-dev-utils/exports/lint-configs/python/ruff.toml)
�[1mCause:�[0m Failed to read /tools/yscope-dev-utils/exports/lint-configs/python/ruff.toml
�[1mCause:�[0m No such file or directory (os error 2)


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

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

@quinntaylormitchell quinntaylormitchell changed the title feat(integration-tests): Add component_list data member to PackageConfig data class. feat(integration-tests): Record required components for the clp package in component_list data member within PackageConfig. Nov 25, 2025
@quinntaylormitchell quinntaylormitchell marked this pull request as ready for review December 2, 2025 21:28
@quinntaylormitchell quinntaylormitchell requested a review from a team as a code owner December 2, 2025 21:28
Comment on lines +24 to +30
# Get the ClpConfig for this mode.
clp_config_obj = get_clp_config_from_mode(mode_name)

# Compute the list of required components for this mode.

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.

these comments feel a bit redundant since the method names have been pretty self-explanatory

Suggested change
# Get the ClpConfig for this mode.
clp_config_obj = get_clp_config_from_mode(mode_name)
# Compute the list of required components for this mode.
clp_config_obj = get_clp_config_from_mode(mode_name)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

will remove.

package_config = PackageConfig(
path_config=fixt_package_path_config,
mode_name=mode_name,
component_list=required_components,

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.

it's not immediately clear how the component_list would be used yet. just want to make they are logged before they are used for better traceability in the tests

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'll log the list of components in test_package_start.py for now.

_to_docker_compose_service_name(WEBUI_COMPONENT_NAME),
]

CLP_QUERY_COMPONENTS = [

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.

i believe the Presto coordinator is left out intentionally. shall we add a comment / TODO to explain why it's not listed as a component in the integration tests for now, and that we plan to add it, once we integrate the Presto Docker Compose project with the CLP Docker Compose project?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It is left out intentionally. Will add the TODO as you describe.

Comment on lines +70 to +74
CLP_API_SERVER_COMPONENT = _to_docker_compose_service_name(API_SERVER_COMPONENT_NAME)

CLP_GARBAGE_COLLECTOR_COMPONENT = _to_docker_compose_service_name(GARBAGE_COLLECTOR_COMPONENT_NAME)

CLP_MCP_SERVER_COMPONENT = _to_docker_compose_service_name(MCP_SERVER_COMPONENT_NAME)

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.

Suggested change
CLP_API_SERVER_COMPONENT = _to_docker_compose_service_name(API_SERVER_COMPONENT_NAME)
CLP_GARBAGE_COLLECTOR_COMPONENT = _to_docker_compose_service_name(GARBAGE_COLLECTOR_COMPONENT_NAME)
CLP_MCP_SERVER_COMPONENT = _to_docker_compose_service_name(MCP_SERVER_COMPONENT_NAME)
CLP_API_SERVER_COMPONENT = _to_docker_compose_service_name(API_SERVER_COMPONENT_NAME)
CLP_GARBAGE_COLLECTOR_COMPONENT = _to_docker_compose_service_name(GARBAGE_COLLECTOR_COMPONENT_NAME)
CLP_MCP_SERVER_COMPONENT = _to_docker_compose_service_name(MCP_SERVER_COMPONENT_NAME)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

agreed

@junhaoliao junhaoliao 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 title, how about

feat(integration-tests): Record required components in `PackageConfig` based on the CLP package config.

@quinntaylormitchell quinntaylormitchell changed the title feat(integration-tests): Record required components for the clp package in component_list data member within PackageConfig. feat(integration-tests): Record required components in PackageConfig based on the CLP package config. Dec 3, 2025

@Bill-hbrhbr Bill-hbrhbr 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.

nit picks

Comment thread integration-tests/tests/utils/clp_mode_utils.py Outdated
Comment thread integration-tests/tests/utils/clp_mode_utils.py Outdated
Comment thread integration-tests/tests/utils/clp_mode_utils.py Outdated
Comment thread integration-tests/tests/test_package_start.py Outdated

@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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f0f4ce and bc720bc.

📒 Files selected for processing (2)
  • integration-tests/tests/test_package_start.py (1 hunks)
  • integration-tests/tests/utils/clp_mode_utils.py (3 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: Bill-hbrhbr
Repo: y-scope/clp PR: 1100
File: integration-tests/tests/fixtures/integration_test_logs.py:54-56
Timestamp: 2025-08-17T16:10:38.722Z
Learning: For PR #1100 (feat(integration-tests): Add CLP package integration tests boilerplate), do not raise cache weakness problems related to the pytest cache implementation in the integration test logs fixtures.
Learnt from: junhaoliao
Repo: y-scope/clp PR: 1405
File: components/clp-package-utils/pyproject.toml:5-15
Timestamp: 2025-10-13T03:24:35.074Z
Learning: In the y-scope/clp repository, the Python 3.9 to 3.10 version requirement change was intentionally deferred to a separate PR (after PR #1405) to reduce review effort, as decided in an offline discussion between junhaoliao and kirkrodrigues.
📚 Learning: 2025-11-10T05:19:56.600Z
Learnt from: junhaoliao
Repo: y-scope/clp PR: 1575
File: components/clp-py-utils/clp_py_utils/clp_config.py:602-607
Timestamp: 2025-11-10T05:19:56.600Z
Learning: In the y-scope/clp repository, the `ApiServer` class in `components/clp-py-utils/clp_py_utils/clp_config.py` does not need a `transform_for_container()` method because no other containerized service depends on the API server - it's only accessed from the host, so no docker-network communication is expected.

Applied to files:

  • integration-tests/tests/utils/clp_mode_utils.py
📚 Learning: 2025-10-27T07:07:37.901Z
Learnt from: junhaoliao
Repo: y-scope/clp PR: 1501
File: tools/deployment/presto-clp/scripts/init.py:10-13
Timestamp: 2025-10-27T07:07:37.901Z
Learning: In `tools/deployment/presto-clp/scripts/init.py`, the `DATABASE_COMPONENT_NAME` and `DATABASE_DEFAULT_PORT` constants are intentionally duplicated from `clp_py_utils.clp_config` because `clp_py_utils` is not installed in the Presto init script's runtime environment. The two flows are separate and this duplication is documented. There are plans to merge these flows after a future release.

Applied to files:

  • integration-tests/tests/utils/clp_mode_utils.py
🧬 Code graph analysis (2)
integration-tests/tests/test_package_start.py (1)
integration-tests/tests/fixtures/package_instance.py (1)
  • fixt_package_instance (18-34)
integration-tests/tests/utils/clp_mode_utils.py (1)
components/clp-py-utils/clp_py_utils/clp_config.py (5)
  • ClpConfig (713-963)
  • DeploymentType (95-97)
  • Package (150-174)
  • QueryEngine (126-129)
  • get_deployment_type (915-918)
⏰ 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). (4)
  • GitHub Check: package-image
  • GitHub Check: build (ubuntu-24.04)
  • GitHub Check: lint-check (ubuntu-24.04)
  • GitHub Check: lint-check (macos-15)
🔇 Additional comments (2)
integration-tests/tests/test_package_start.py (1)

27-31: Component logging wiring looks correct and helpful for debugging.

Using package_config.component_list and logging it as a newline‑joined list under the mode name is straightforward and keeps the output readable. This should make it much easier to see which services are expected to be running for a given package mode.

integration-tests/tests/utils/clp_mode_utils.py (1)

91-117: Required component computation matches current deployment semantics.

Initialising component_list from CLP_BASE_COMPONENTS, then extending with CLP_QUERY_COMPONENTS only for DeploymentType.FULL, and conditionally adding API server, garbage collector, and MCP server based on the presence/retention settings on the config, matches the described ClpConfig.get_deployment_type() and component behaviour. The logic is straightforward, side‑effect free on the constants, and should give a stable, predictable component list for the tests to log and eventually validate against.

Comment on lines +43 to +75
# TODO: This will eventually be replaced by a formalized mapping between component and service.
def _to_docker_compose_service_name(name: str) -> str:
"""
Convert a component name to a Docker Compose service name.

:param name:
:return: Service name with underscores replaced by hyphens
"""
return name.replace("_", "-")


# TODO: Modify these component lists when the Presto Docker Compose project is integrated with the
# CLP Docker compose project.
CLP_BASE_COMPONENTS = [
_to_docker_compose_service_name(DB_COMPONENT_NAME),
_to_docker_compose_service_name(QUEUE_COMPONENT_NAME),
_to_docker_compose_service_name(REDIS_COMPONENT_NAME),
_to_docker_compose_service_name(REDUCER_COMPONENT_NAME),
_to_docker_compose_service_name(RESULTS_CACHE_COMPONENT_NAME),
_to_docker_compose_service_name(COMPRESSION_SCHEDULER_COMPONENT_NAME),
_to_docker_compose_service_name(COMPRESSION_WORKER_COMPONENT_NAME),
_to_docker_compose_service_name(WEBUI_COMPONENT_NAME),
]

CLP_QUERY_COMPONENTS = [
_to_docker_compose_service_name(QUERY_SCHEDULER_COMPONENT_NAME),
_to_docker_compose_service_name(QUERY_WORKER_COMPONENT_NAME),
]

CLP_API_SERVER_COMPONENT = _to_docker_compose_service_name(API_SERVER_COMPONENT_NAME)
CLP_GARBAGE_COLLECTOR_COMPONENT = _to_docker_compose_service_name(GARBAGE_COLLECTOR_COMPONENT_NAME)
CLP_MCP_SERVER_COMPONENT = _to_docker_compose_service_name(MCP_SERVER_COMPONENT_NAME)

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.

🧹 Nitpick | 🔵 Trivial

Component → service-name mapping and constants are clear; consider immutable sequences.

The _to_docker_compose_service_name() helper plus the centralised CLP_* component constants give a single place to reason about docker‑compose service names, which will make future config/debugging much easier. The TODO around Presto/Compose integration also documents the current omission appropriately (consistent with earlier decisions about separate Presto flows). Based on learnings, this aligns with the current deployment split.

If you want to tighten this further, you could make CLP_BASE_COMPONENTS and CLP_QUERY_COMPONENTS tuples instead of lists to emphasise that they are constants and should not be mutated, relying on list(CLP_BASE_COMPONENTS) in get_required_component_list() as you already do.

🤖 Prompt for AI Agents
In integration-tests/tests/utils/clp_mode_utils.py around lines 43 to 75, the
CLP_BASE_COMPONENTS and CLP_QUERY_COMPONENTS are defined as mutable lists but
intended to be constants; change both to tuples (e.g. replace [...] with (...))
so they are immutable, keep the helper _to_docker_compose_service_name usage the
same, and ensure any call sites that expect a list continue to call
list(CLP_BASE_COMPONENTS) or list(CLP_QUERY_COMPONENTS) as needed (no other
behavior changes required).

@Bill-hbrhbr Bill-hbrhbr 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.

Leaving to @junhaoliao for final pass and PR title suggestion.

@quinntaylormitchell quinntaylormitchell merged commit 762ed50 into y-scope:main Dec 4, 2025
19 checks passed
junhaoliao pushed a commit to junhaoliao/clp that referenced this pull request May 17, 2026
…` based on the CLP package config. (y-scope#1658)

Co-authored-by: Bingran Hu <bingran.hu@yscope.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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