Skip to content

[cli] fix: require status params snapshot fields - #298

Merged
Wangmerlyn merged 1 commit into
mainfrom
codex/status-params-validation
Jul 2, 2026
Merged

[cli] fix: require status params snapshot fields#298
Wangmerlyn merged 1 commit into
mainfrom
codex/status-params-validation

Conversation

@Wangmerlyn

@Wangmerlyn Wangmerlyn commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • reject malformed successful status records that omit required params snapshot fields
  • align status-related CLI fixtures with the full service response contract
  • document that returned status params include gpu_ids, vram, interval, and busy_threshold

Test Plan

  • PYTHONPATH=src pytest tests/test_cli_service_commands.py::test_status_rejects_missing_session_params -q
  • PYTHONPATH=src pytest tests/test_cli_service_commands.py -q
  • PYTHONPATH=src pytest tests/test_package_metadata.py tests/utilities/test_session_config.py -q
  • pre-commit run --all-files --show-diff-on-failure
  • mkdocs build --strict

Summary by CodeRabbit

  • Bug Fixes

    • Status responses now consistently include the full set of session parameters, even when some values are null.
    • Validation is stricter for service status data, so incomplete session details are rejected instead of being accepted silently.
    • Updated CLI behavior to better surface malformed status records with missing required fields.
  • Documentation

    • Clarified the expected structure of status/session data in the CLI and MCP guides.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the documentation and CLI validation logic to ensure that known session parameter fields (such as gpu_ids, vram, interval, and busy_threshold) are always present in status records, raising an error if any are missing. It also refactors the test suite to use a helper for status session records and adds tests for validating missing fields. There are no review comments, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 586dc053-6ec0-473d-a8e2-f1ecf4002066

📥 Commits

Reviewing files that changed from the base of the PR and between 1641e43 and 6657a8d.

📒 Files selected for processing (5)
  • AGENTS.md
  • docs/guides/mcp.md
  • docs/reference/cli.md
  • src/keep_gpu/cli.py
  • tests/test_cli_service_commands.py

📝 Walkthrough

Walkthrough

CLI validation for the status JSON-RPC result now requires gpu_ids, vram, interval, and busy_threshold in session params, raising a malformed-method error if any are missing. Documentation is updated accordingly, and tests are refactored to use a shared session record helper plus a new missing-field validation test.

Changes

Status params validation and docs

Layer / File(s) Summary
Enforce required session params in status validation
src/keep_gpu/cli.py
_validate_status_params now raises a malformed-method error when gpu_ids, interval, busy_threshold, or vram are absent from status params, instead of skipping missing fields.
Update docs for required params
AGENTS.md, docs/guides/mcp.md, docs/reference/cli.md
Documentation is updated to state that status.params fields must be present, describes the full params snapshot in status records, and clarifies gpu_ids: null encoding when omitted.
Refactor tests with shared helper and add missing-field test
tests/test_cli_service_commands.py
Multiple tests are refactored to build active_jobs entries via _status_session_record(), and a new parametrized test verifies that missing required session param fields are rejected.

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • Wangmerlyn/KeepGPU#66: Prior work on _validate_status_params requiring specific status session params fields.
  • Wangmerlyn/KeepGPU#131: Tightens CLI-side validation of the status JSON-RPC result payload and related tests.
  • Wangmerlyn/KeepGPU#152: Hardens the status payload contract with validation for nested status.*.params fields and matching test updates.
🚥 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 clearly summarizes the main CLI change to require status params snapshot fields.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/status-params-validation

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.

@Wangmerlyn
Wangmerlyn merged commit bd760a4 into main Jul 2, 2026
6 checks passed
@Wangmerlyn
Wangmerlyn deleted the codex/status-params-validation branch July 2, 2026 10:39
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