Skip to content

General tidy up - #101

Merged
jayvdb merged 2 commits into
mainfrom
misc-cleanup
Jul 22, 2026
Merged

General tidy up#101
jayvdb merged 2 commits into
mainfrom
misc-cleanup

Conversation

@jayvdb

@jayvdb jayvdb commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Build Improvements

    • macOS builds now automatically select an appropriate deployment target based on the processor architecture.
  • Bug Fixes

    • Improved startup validation when a configured root module is missing.
    • Clarified behavior for file uploads, terminal image previews, and invalid filenames.
  • Tests

    • Expanded coverage for health checks, route wiring, TLS configuration, registry persistence, and OpenAPI endpoints.
    • Added validation for missing or malformed TLS and registry data.
  • Documentation

    • Updated documentation for terminal image rendering and deployment configuration.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds an architecture-specific macOS deployment target, expands documentation-rule coverage, revises storage comments, and introduces regression tests for modules, WebSocket routes, health responses, TLS helpers, and registry persistence.

Changes

macOS build configuration

Layer / File(s) Summary
Architecture-specific deployment target
.mise/config.macos.toml
Derives macOS deployment targets by architecture and exports MACOSX_DEPLOYMENT_TARGET.

Documentation rule scope

Layer / File(s) Summary
Documentation rule and storage comments
config/ast-grep/rules/doc-summary-ends-with-period.yaml, services/storage/src/routes.rs, services/storage/tests/put.rs
Expands the documentation-rule allowlist and updates storage comments for filename handling and best-effort TTY rendering.

Service regression tests

Layer / File(s) Summary
Module configuration and route tests
services/modules/tests/*
Tests missing root-module failures and the OpenAPI-gated get_module_file response.
WebSocket server route and health tests
services/ws-server/tests/configure_app.rs, services/ws-server/tests/health.rs
Verifies route wiring, no-content responses, and health response fields.
TLS helper validation
services/ws-server/tests/tls.rs
Covers PEM round trips, ALPN defaults, missing files, and mismatched keys.
Registry persistence validation
services/ws/Cargo.toml, services/ws/tests/load_registry.rs
Tests missing, valid, and malformed registry files, including persisted state and omitted sessions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: pierre-tenedero

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is generic and does not describe the actual code/test changes in this PR. Use a specific title that names the main change, such as adding coverage and cleanup across macOS, ws-server, and modules tests.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.
✨ 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 misc-cleanup

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.

🔧 Checkov (3.3.8)
config/ast-grep/rules/doc-summary-ends-with-period.yaml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


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

@deepsource-io

deepsource-io Bot commented Jul 22, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in cce209c...2a0f5d2 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Coverage  

Code Review Summary

Analyzer Status Updated (UTC) Details
C# Jul 22, 2026 11:23a.m. Review ↗
C & C++ Jul 22, 2026 11:23a.m. Review ↗
Docker Jul 22, 2026 11:23a.m. Review ↗
Java Jul 22, 2026 11:23a.m. Review ↗
JavaScript Jul 22, 2026 11:23a.m. Review ↗
Python Jul 22, 2026 11:23a.m. Review ↗
Rust Jul 22, 2026 11:23a.m. Review ↗
Secrets Jul 22, 2026 11:23a.m. Review ↗
Code coverage Jul 22, 2026 11:49a.m. Review ↗

Code Coverage Summary

Language Line Coverage (Overall)
Aggregate
58.8%
[▲ up 0.4% from main]
Python
84.3%
Rust
57%
[▲ up 0.4% from main]

➟ Additional coverage metrics may have been reported. See full coverage report ↗


Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@codacy-production

codacy-production Bot commented Jul 22, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 medium

Alerts:
⚠ 1 issue (≤ 0 issues of at least minor severity)

Results:
1 new issue

Category Results
Complexity 1 medium

View in Codacy

🟢 Metrics 4 complexity · 0 duplication

Metric Results
Complexity 4
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@jayvdb
jayvdb marked this pull request as ready for review July 22, 2026 17:04

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@services/modules/tests/configure_missing_root.rs`:
- Around line 1-2: The Rust doc summaries wrap before their terminating
punctuation. Rewrap the first-line summaries in
services/modules/tests/configure_missing_root.rs (lines 1-2),
services/modules/tests/get_module_file.rs (lines 1-4),
services/ws-server/tests/configure_app.rs (lines 1-2), and
services/ws/tests/load_registry.rs (lines 1-3) so each summary’s first line ends
with punctuation.

In `@services/modules/tests/get_module_file.rs`:
- Around line 5-6: Remove the crate-level cfg(feature = "openapi-spec") gate
from the integration test target in get_module_file.rs so it is never silently
disabled. Configure the test target or CI invocation explicitly to enable the
openapi-spec feature and ensure this regression test runs during normal
validation.

In `@services/ws-server/tests/health.rs`:
- Line 16: Update the health response assertions in
services/ws-server/tests/health.rs lines 16-16 and
services/ws-server/tests/configure_app.rs lines 31-33 to compare the response
status with StatusCode::OK instead of using is_success(), ensuring both tests
require exactly HTTP 200.

In `@services/ws-server/tests/tls.rs`:
- Around line 45-48: Update the test around load_tls_certs to create a valid
certificate/key pair in the temporary directory, remove only the certificate
file, and then invoke load_tls_certs with both paths. Keep the key present so
the assertion specifically exercises the missing-certificate read path.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f2e91242-a81b-4677-868e-ef4656176c2e

📥 Commits

Reviewing files that changed from the base of the PR and between cce209c and 2a0f5d2.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • .mise/config.macos.toml
  • config/ast-grep/rules/doc-summary-ends-with-period.yaml
  • services/modules/tests/configure_missing_root.rs
  • services/modules/tests/get_module_file.rs
  • services/storage/src/routes.rs
  • services/storage/tests/put.rs
  • services/ws-server/tests/configure_app.rs
  • services/ws-server/tests/health.rs
  • services/ws-server/tests/tls.rs
  • services/ws/Cargo.toml
  • services/ws/tests/load_registry.rs

Comment on lines +1 to +2
//! Covers `configure`'s fail-fast panic when `config.root` names a module that isn't among the
//! scanned `config.paths` -- a misconfiguration that must surface at startup, not as a silent 404.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the first-line Rust doc summaries across the new test files.

Each file wraps its summary before punctuation, violating the same documentation rule.

  • services/modules/tests/configure_missing_root.rs#L1-L2: rewrap the summary so Line 1 ends with punctuation.
  • services/modules/tests/get_module_file.rs#L1-L4: rewrap the summary so Line 1 ends with punctuation.
  • services/ws-server/tests/configure_app.rs#L1-L2: rewrap the summary so Line 1 ends with punctuation.
  • services/ws/tests/load_registry.rs#L1-L3: rewrap the summary so Line 1 ends with punctuation.
📍 Affects 4 files
  • services/modules/tests/configure_missing_root.rs#L1-L2 (this comment)
  • services/modules/tests/get_module_file.rs#L1-L4
  • services/ws-server/tests/configure_app.rs#L1-L2
  • services/ws/tests/load_registry.rs#L1-L3
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@services/modules/tests/configure_missing_root.rs` around lines 1 - 2, The
Rust doc summaries wrap before their terminating punctuation. Rewrap the
first-line summaries in services/modules/tests/configure_missing_root.rs (lines
1-2), services/modules/tests/get_module_file.rs (lines 1-4),
services/ws-server/tests/configure_app.rs (lines 1-2), and
services/ws/tests/load_registry.rs (lines 1-3) so each summary’s first line ends
with punctuation.

Source: Coding guidelines

Comment on lines +5 to +6
#![cfg(test)]
#![cfg(feature = "openapi-spec")]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Do not silently disable this integration test with a feature gate.

#![cfg(feature = "openapi-spec")] removes the entire test target when the feature is absent, allowing normal test runs to pass without exercising this regression. Move feature selection to explicit test-target/CI configuration and run the target with openapi-spec enabled.

As per coding guidelines, tests under tests/ must never be conditionally disabled without explicit approval.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@services/modules/tests/get_module_file.rs` around lines 5 - 6, Remove the
crate-level cfg(feature = "openapi-spec") gate from the integration test target
in get_module_file.rs so it is never silently disabled. Configure the test
target or CI invocation explicitly to enable the openapi-spec feature and ensure
this regression test runs during normal validation.

Source: Coding guidelines

let req = test::TestRequest::get().uri("/health").to_request();
let resp = test::call_service(&app, req).await;

assert!(resp.status().is_success());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Pin both health tests to HTTP 200.

Both assertions accept any 2xx response, so they would miss a regression from 200 to another successful status.

  • services/ws-server/tests/health.rs#L16-L16: assert StatusCode::OK instead of is_success().
  • services/ws-server/tests/configure_app.rs#L31-L33: assert StatusCode::OK instead of is_success().
📍 Affects 2 files
  • services/ws-server/tests/health.rs#L16-L16 (this comment)
  • services/ws-server/tests/configure_app.rs#L31-L33
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@services/ws-server/tests/health.rs` at line 16, Update the health response
assertions in services/ws-server/tests/health.rs lines 16-16 and
services/ws-server/tests/configure_app.rs lines 31-33 to compare the response
status with StatusCode::OK instead of using is_success(), ensuring both tests
require exactly HTTP 200.

Comment on lines +45 to +48
let dir = tempdir().unwrap();
let cert = dir.path().join("missing-cert.pem");
let key = dir.path().join("missing-key.pem");
drop(load_tls_certs(&cert, &key));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Isolate the missing-certificate case.

Both cert and key are absent, so this test only proves that some missing file causes failure. Generate a valid pair, delete only cert, and then call load_tls_certs so the certificate-read path is specifically covered.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@services/ws-server/tests/tls.rs` around lines 45 - 48, Update the test around
load_tls_certs to create a valid certificate/key pair in the temporary
directory, remove only the certificate file, and then invoke load_tls_certs with
both paths. Keep the key present so the assertion specifically exercises the
missing-certificate read path.

@jayvdb
jayvdb requested a review from pierre-tenedero July 22, 2026 17:21
@jayvdb
jayvdb merged commit 3052768 into main Jul 22, 2026
33 of 34 checks passed
@jayvdb
jayvdb deleted the misc-cleanup branch July 22, 2026 22:09
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