Skip to content

feat(integration-tests): Add compression action and verification infra.#2232

Open
quinntaylormitchell wants to merge 4 commits intoy-scope:mainfrom
quinntaylormitchell:testing-redesign-6
Open

feat(integration-tests): Add compression action and verification infra.#2232
quinntaylormitchell wants to merge 4 commits intoy-scope:mainfrom
quinntaylormitchell:testing-redesign-6

Conversation

@quinntaylormitchell
Copy link
Copy Markdown
Collaborator

@quinntaylormitchell quinntaylormitchell commented Apr 29, 2026

Description

This PR adds the action and verification infrastructure for testing package compression and decompression.

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

Tested on development branch; all tests pass.

Summary by CodeRabbit

  • Tests

    • Added compression and decompression test utilities that run compress/decompress actions and verify decompressed content, with distinct flows for structured and unstructured data.
    • Verification now reports clear pass/fail outcomes and fails tests on content mismatches.
  • Chores

    • Introduced a typed verification result and extended test action metadata to carry command-argument info for verification.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f15fab77-edd9-4464-82c3-db25c91f8ac8

📥 Commits

Reviewing files that changed from the base of the PR and between 4979cb7 and 5d1cae7.

📒 Files selected for processing (1)
  • integration-tests/tests/package_tests/utils/compress.py

Walkthrough

Adds typed command-arg models and verification primitives, plus new CLP compression and decompression test utilities that build command lines, run external scripts via ExternalAction, and verify outputs (including directory-tree comparison for unstructured datasets).

Changes

Cohort / File(s) Summary
Compression utilities
integration-tests/tests/package_tests/utils/compress.py
New CompressArgs(CmdArgs) with to_cmd(), compress_clp_package() producing an ExternalAction, and verify_compress_action() that checks exit code then routes verification: structured (no-op) or unstructured (decompress, compare directory trees).
Decompression utilities
integration-tests/tests/package_tests/utils/decompress.py
New DecompressArgs(CmdArgs) with to_cmd(), helper _construct_decompress_args(), and decompress_clp_package() returning an ExternalAction to extract archives into a target dir (optional path filtering).
Core test classes / abstractions
integration-tests/tests/utils/classes.py
Introduces abstract CmdArgs base class, frozen VerificationResult dataclass with ok()/fail(), and extends ExternalAction to include optional `args: CmdArgs

Sequence Diagram(s)

sequenceDiagram
    participant TestRunner as Test Runner
    participant ExternalAction as ExternalAction
    participant Script as Compress/Decompress Script
    participant FileSystem as Filesystem

    TestRunner->>ExternalAction: construct CmdArgs (CompressArgs/DecompressArgs)
    TestRunner->>ExternalAction: start action (cmd from args)
    ExternalAction->>Script: execute command
    Script->>FileSystem: read/write package and logs
    Script-->>ExternalAction: exit code, stdout/stderr
    ExternalAction-->>TestRunner: result (+ args)
    TestRunner->>TestRunner: verify_compress_action: if unstructured -> run decompress action
    TestRunner->>ExternalAction: start decompress action
    ExternalAction->>Script: execute decompress
    Script->>FileSystem: extract files to decompression dir
    TestRunner->>FileSystem: compare original logs dir vs decompressed dir
    TestRunner-->>TestRunner: return VerificationResult.ok()/fail()
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 changes: adding compression action functionality and verification infrastructure for integration tests, which aligns with the three modified/created files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.15.12)
integration-tests/tests/package_tests/utils/compress.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
Review rate limit: 6/8 reviews remaining, refill in 12 minutes and 3 seconds.

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

@quinntaylormitchell quinntaylormitchell changed the title feat(integration-tests): Add compression infra. feat(integration-tests): Add compression action and verification infra. Apr 29, 2026
@quinntaylormitchell quinntaylormitchell marked this pull request as ready for review April 29, 2026 23:41
@quinntaylormitchell quinntaylormitchell requested a review from a team as a code owner April 29, 2026 23:41
Copy link
Copy Markdown
Contributor

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@integration-tests/tests/package_tests/utils/compress.py`:
- Around line 129-135: Remove the redundant check for
compress_action.completed_proc.returncode != 0 from the helper functions
_verify_compress_action_structured_logs and
_verify_compress_action_unstructured_logs (they currently return
VerificationResult.fail with format_action_failure_msg); verify_compress_action
already validates the return code before calling these helpers, so delete those
conditional blocks and their early-return failure logic, leaving the remaining
validation logic in those helper functions intact.
- Around line 161-165: Replace the pytest.fail() call used when
decompress_action.completed_proc.returncode != 0 with a return of
VerificationResult.fail(...) so the function consistently returns a
VerificationResult; use the same failure message (including
decompress_action.log_file_path) when constructing VerificationResult.fail(),
and update the function's docstring only if you intend to keep pytest.fail()
semantics to document the distinction. Ensure you reference the existing
decompress_action, its completed_proc.returncode check, and
decompress_action.log_file_path when forming the VerificationResult.fail()
return.

In `@integration-tests/tests/package_tests/utils/decompress.py`:
- Around line 40-44: The extraction_dir parameter on decompress_clp_package is
typed as Any but is always a Path; change its annotation to extraction_dir: Path
to match DecompressArgs and enable proper type checking, and update the same for
the other similar function that takes extraction_dir (the block referenced at
lines 60-63); after changing both, remove Any from the imports if it is no
longer used.
- Around line 67-76: The code creates a DecompressArgs instance and then mutates
its paths attribute; instead, pass paths into the DecompressArgs constructor
directly. Modify the block that builds the args variable (creating
DecompressArgs) to include the paths parameter when paths is truthy (so
DecompressArgs(..., paths=paths, ...)) and remove the subsequent if paths:
args.paths = paths mutation; this keeps creation atomic and idiomatic for the
DecompressArgs model.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fe78face-e0ac-4d6c-a55d-68e7c2074457

📥 Commits

Reviewing files that changed from the base of the PR and between 298e2e2 and d82b793.

📒 Files selected for processing (3)
  • integration-tests/tests/package_tests/utils/compress.py
  • integration-tests/tests/package_tests/utils/decompress.py
  • integration-tests/tests/utils/classes.py

Comment thread integration-tests/tests/package_tests/utils/compress.py Outdated
Comment thread integration-tests/tests/package_tests/utils/compress.py
Comment thread integration-tests/tests/package_tests/utils/decompress.py
Comment thread integration-tests/tests/package_tests/utils/decompress.py Outdated
Copy link
Copy Markdown
Contributor

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@integration-tests/tests/package_tests/utils/compress.py`:
- Around line 125-128: The current _verify_compress_action_structured_logs
function always returns VerificationResult.ok(), causing false positives; change
it to return an explicit failure until structured decompression verification
exists by replacing the ok() return with VerificationResult.fail("Structured
decompression verification not implemented") (or an equivalent
failure/gated-skip using VerificationResult) so the test fails/gates instead of
passing; update the return in _verify_compress_action_structured_logs to use
VerificationResult.fail(...) and include a short explanatory message.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5161e114-6164-4175-91dc-da2154ad90f4

📥 Commits

Reviewing files that changed from the base of the PR and between d82b793 and 4979cb7.

📒 Files selected for processing (2)
  • integration-tests/tests/package_tests/utils/compress.py
  • integration-tests/tests/package_tests/utils/decompress.py

Comment thread integration-tests/tests/package_tests/utils/compress.py
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.

1 participant