Skip to content

Add offline unit specs for eight untested lib/ files (#379)#414

Merged
justin808 merged 1 commit into
mainfrom
justin808/issue-379
Jul 17, 2026
Merged

Add offline unit specs for eight untested lib/ files (#379)#414
justin808 merged 1 commit into
mainfrom
justin808/issue-379

Conversation

@justin808

Copy link
Copy Markdown
Member

Closes #379.

Adds offline unit specs for eight previously-untested lib/ files (114 new examples, spec-only — no production code changes):

Spec Examples
spec/core/shell_spec.rb 25
spec/core/controlplane_api_spec.rb 27
spec/command/update_github_actions_spec.rb 11
spec/core/doctor_service_spec.rb 12
spec/core/helpers_spec.rb 9
spec/command/test_spec.rb 4
spec/command/staging_branch_validation_spec.rb 8
spec/core/github_flow_readiness/checks_spec.rb 18

All specs run offline (no CPLN_ORG, no live org, no cpln binary): the only mocked seam is the network/CLI boundary (ControlplaneApiDirect#call, Shell, TemplateParser), following the spec/command/delete_unit_spec.rb pattern. spec/README.md's documented offline suite list updated to include the new files.

Codex Decision Log

  • Non-blocking: Issue lists nine files; lib/command/terraform/import.rb was the ninth.
    • Decision: Skipped — spec/command/terraform/import_spec.rb already exists and existed at the audit commit (7c96df9, added in Terraform feature support #251). Audit error in the issue.
    • Why: Verified with git cat-file -e 7c96df9:spec/command/terraform/import_spec.rb.
    • Review later: None.
  • Non-blocking: Issue suggests one PR per file/small cluster.
    • Decision: Single spec-only PR for the batch lane.
    • Why: Purely additive new files, reviewable per-file; batch lane structure is one PR per lane.
    • Review later: None.
  • Non-blocking: Acceptance criterion "coverage floor raised".
  • Non-blocking: spec/command/test_spec.rb asserts the intentionally-empty debug stub Command::Test#call returns nil.
    • Decision: Kept as a guard against accidentally committing local debug code.
    • Review later: Delete that example if it annoys the local-debugging workflow.

Confidence

  • Validation: each new file green individually; documented offline suite + new files: 195 examples, 0 failures; rubocop spec/: no offenses (121 files).
  • Independent skeptical review (assertions-vs-lib-source, offline safety, suite hygiene, CI flakiness): no blockers/majors; verified non-tautological against lib sources; green across random-order seeds 1, 42, 7777, 3, 999 with retries disabled (RSPEC_RETRY_COUNT=1).
  • Risk: low — additive spec files only.

Batch: CPFLOW B 07-16 15:43 (cpf-b-20260716-1543), lane issue379, epic #387.

🤖 Generated with Claude Code

New offline-capable specs (no CPLN_ORG, no cpln binary, no HTTP):
- spec/core/shell_spec.rb for lib/core/shell.rb
- spec/core/controlplane_api_spec.rb for lib/core/controlplane_api.rb
- spec/command/update_github_actions_spec.rb for lib/command/update_github_actions.rb
- spec/core/doctor_service_spec.rb for lib/core/doctor_service.rb
- spec/core/helpers_spec.rb for lib/core/helpers.rb
- spec/command/test_spec.rb for lib/command/test.rb
- spec/command/staging_branch_validation_spec.rb for lib/command/staging_branch_validation.rb
- spec/core/github_flow_readiness/checks_spec.rb for lib/core/github_flow_readiness/checks.rb

Also adds the new specs to the documented offline smoke suite in
spec/README.md.

The ninth file listed in issue #379, lib/command/terraform/import.rb,
already has an offline spec (spec/command/terraform/import_spec.rb); the
issue's audit missed it, so no new spec is added for it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@justin808, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f2b89acd-4d18-464d-ba11-e0b92c829550

📥 Commits

Reviewing files that changed from the base of the PR and between 26bdb56 and e4d7815.

📒 Files selected for processing (9)
  • spec/README.md
  • spec/command/staging_branch_validation_spec.rb
  • spec/command/test_spec.rb
  • spec/command/update_github_actions_spec.rb
  • spec/core/controlplane_api_spec.rb
  • spec/core/doctor_service_spec.rb
  • spec/core/github_flow_readiness/checks_spec.rb
  • spec/core/helpers_spec.rb
  • spec/core/shell_spec.rb
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch justin808/issue-379

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.

@greptile-apps

greptile-apps Bot commented Jul 17, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds offline unit coverage for eight previously untested library files. The main changes are:

  • 114 examples for commands, API helpers, validation, diagnostics, readiness checks, and shell behavior.
  • Isolated doubles for network, CLI, generator, and parser boundaries.
  • Temporary workspaces for filesystem-dependent examples.
  • An expanded offline suite command in spec/README.md.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
spec/core/shell_spec.rb Adds coverage for output, command execution, temporary stderr capture, verbose state, filtering, and interrupt handling.
spec/core/controlplane_api_spec.rb Covers API delegation, request construction, log query encoding, and pagination behind a mocked transport.
spec/command/update_github_actions_spec.rb Tests workflow parsing and staging-branch preservation in an isolated temporary workspace.
spec/core/doctor_service_spec.rb Tests validation reporting and template selection with isolated parser and filesystem state.
spec/core/github_flow_readiness/checks_spec.rb Adds focused coverage for readiness check results and diagnostics.
spec/command/staging_branch_validation_spec.rb Covers staging-branch normalization and invalid Git branch forms.
spec/command/test_spec.rb Documents the hidden test command's metadata, options, and empty default behavior.
spec/core/helpers_spec.rb Covers string validation, random-number delegation, and name normalization.
spec/README.md Adds the new specs to the documented credential-free test suite.

Reviews (1): Last reviewed commit: "Add offline unit specs for eight unteste..." | Re-trigger Greptile

@claude

claude Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review

Reviewed the diff (gh pr diff 414) against the actual lib/ sources for each new spec file. This is a spec-only PR (114 new examples across 8 files, 0 production changes) closing #379.

Overview

Adds offline unit coverage for previously-untested lib/ files: Shell, ControlplaneApi, Command::UpdateGithubActions, DoctorService, Helpers, Command::Test, Command::StagingBranchValidation, and GithubFlowReadiness::Checks. All specs mock only the network/CLI boundary (ControlplaneApiDirect#call, Shell, TemplateParser), consistent with the existing spec/command/delete_unit_spec.rb pattern, and spec/README.md's offline suite list is updated to match.

Code quality / correctness

  • Cross-checked assertions against the real implementations (lib/core/shell.rb, lib/core/controlplane_api.rb, lib/command/update_github_actions.rb, lib/command/staging_branch_validation.rb, lib/core/doctor_service.rb, lib/core/github_flow_readiness/checks.rb, lib/core/helpers.rb, lib/command/test.rb) — assertions are non-tautological and match real behavior, including edge cases (branch-name shape/component validation, YAML on:-as-string-key parsing, pagination merging in query_images, log_get param ordering/escaping, deprecated-template-variable warnings).
  • Good use of instance_double/verifying doubles for Config, TemplateParser, GithubFlowReadinessService, etc. — these will fail loudly if the underlying method signatures ever drift, rather than silently passing.
  • spec/command/update_github_actions_spec.rb and spec/core/doctor_service_spec.rb correctly exercise real tmp-directory I/O via Dir.mktmpdir/inside_dir rather than over-mocking the filesystem, and clean up in after blocks.
  • spec/core/shell_spec.rb's .cmd tests use real Open3/sh -c subprocess calls (echo, exit 3) — consistent with "offline" (no network/org dependency), though worth keeping in mind as the one spec here that shells out to the OS rather than pure Ruby.
  • No leftover fit/fdescribe/:focus markers.

Minor observations (non-blocking)

  • spec/command/test_spec.rb asserts the intentionally-empty debug stub Command::Test#call returns nil — the PR description already flags this as a deliberate choice (guard against accidentally committing local debug code) with a note to reconsider if it gets in the way of the local-debugging workflow. Agreed this is fine as-is.
  • The SimpleCov minimum_coverage ratchet is (correctly) left out of scope here per the PR description, deferred to the sibling issue in epic Epic: codebase health improvements — 2026-07 review (15 issues, ordered) #387.

Security / performance

No concerns — this PR touches only spec files, no production code, no new external calls, and no secrets/credentials are involved.

Overall: well-scoped, correctly verified against source, and follows the established offline-spec conventions. No blocking issues found.

@justin808

Copy link
Copy Markdown
Member Author

CI triage — RSpec (Fast) failure is pre-existing, not from this diff

The 13 failed examples (info_spec ×4, maintenance_set_page_spec ×1, open_spec ×2, setup_app_spec ×6) are all live-API specs that run before any file added here in the suite's fixed load order, and this PR adds offline spec files only (no lib/** changes).

Evidence it's environmental:

  • The identical 13-example failure set occurred on PR Fix scheduled slow-suite regressions #413's RSpec (Fast) run (run 29492232103) — an unrelated diff.
  • Fast suite was green on main at the last push run (07-15, Fix agent workflow seam pointer #411); no code merged since. The scheduled slow suite (shared-domain-mutating) has been failing since 07-13, and the first red fast runs appear right after the 07-16 05:13Z scheduled failure — consistent with shared-org state degradation.
  • The offline subset (documented suite + these new specs) is green locally: 195 examples, 0 failures, across random-order seeds 1/42/7777/3/999.

This is the live-env regression tracked by the slow-suite lane (#409 / #413). Marking this PR external-gate-failing; will re-run checks once the shared-org fix lands.

@justin808
justin808 merged commit 393151b into main Jul 17, 2026
11 of 12 checks passed
@justin808
justin808 deleted the justin808/issue-379 branch July 17, 2026 04:04
@justin808

Copy link
Copy Markdown
Member Author

Follow-up to the triage above: root cause was the shared CI org's gvcs quota maxed at 20/20 by 13 orphaned dummy-test-* GVCs left behind by crashed slow-suite runs (07-13 → 07-16). With maintainer approval, all 13 were deleted (two required removing a leftover postgres workload + postgres-volume volumeset first). Org now at 0/20. The failed RSpec (Fast) jobs on this PR and #415 were re-run and both passed. Note for the slow-suite lane (#409/#413): the degraded-org repro state no longer exists.

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.

Add specs for nine untested lib/ files (shell.rb, controlplane_api.rb, update_github_actions.rb, ...)

1 participant