Skip to content

Move self-named module files to mod.rs form - #798

Open
leynos wants to merge 1 commit into
harden-lint-examples-20261022from
harden-lint-self-named-modules-20261022
Open

leynos wants to merge 1 commit into
harden-lint-examples-20261022from
harden-lint-self-named-modules-20261022

Conversation

@leynos

@leynos leynos commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Scope

Structural layer only: three foo.rs files with an existing foo/
directory become foo/mod.rs, satisfying Clippy's self_named_module_files
ahead of the final lint configuration. Content is preserved; every file below
the move is byte-identical apart from the recomputed #[path] attributes.

  • src/metrics.rs -> src/metrics/mod.rs
  • src/server/runtime/server.rs -> src/server/runtime/server/mod.rs
  • src/client/pool/scheduler.rs -> src/client/pool/scheduler/mod.rs

scheduler_tests.rs stays in the parent directory, so its attribute becomes
../scheduler_tests.rs. observation_tests.rs already lived inside server/,
so its attribute drops the now-redundant server/ prefix. Both were recomputed
against the new location rather than retained blindly.

Position and dependencies

Layer 4 of 5. Stacked on the examples layer, and the parent of the census
layer that closes the stack.

Reviewer entrypoints

  • src/client/pool/scheduler/mod.rs:395 and
    src/server/runtime/server/mod.rs:398 — the two recomputed #[path]
    attributes
  • The rest of the diff is git mv renames with no content change

Validation evidence (head d493667)

This branch was restacked onto origin/main = b194531 on 2026-10-23, after
main moved three commits including #794's toolchain bump from
nightly-2026-03-26 to nightly-2026-10-22. The previous head cc48b70 and its
local gate results belong to the retired toolchain and are not current
evidence.

The weave merge driver was disabled for the replay
(-c core.attributesFile=/dev/null), and the replay was checked against a
driver-free merge-tree result rather than trusted.

Hosted, at this head. The build-test lane ran at this exact commit and
passed every step. It executes the repository's own targets, so its result is
per-layer evidence for the format and lint gates rather than a result inherited
from a neighbour:

Step Target or tool
Format make check-fmt
Lint make lint — rustdoc with -D warnings, Clippy with -D warnings, Whitaker --all
Lint Markdown markdownlint-cli2 over **/*.md
Spelling make spelling
Validate Mermaid diagrams make nixie
Workflow contract tests make test-workflow-contracts
Feature-gate compile checks make test-feature-gate
Test and Measure Coverage cargo llvm-cov nextest --workspace, default features and targets

https://github.com/leynos/wireframe/actions/runs/39959689502/job/120434257945

The instrumented run executed 1207 tests, 1207 passed, 0 skipped and
reported 87.79%, a 0.01 pp fall from the committed 87.8% baseline that is
inside the ratchet's tolerance band.
Read from the job log, not inferred from the job conclusion.

That run is narrower than the Make targets — no --all-targets, no
--all-features, no doctests — which is why the local runs below are still
required.

Local. Run sequentially at this exact head with make:

Known baseline failures

None observed at this head.

Deferred work

Remaining source census findings, final lint-configuration adoption, the
testkit argument-count decision and Whitaker --workspace coverage.

Summary by Sourcery

Enhancements:

  • Move self-named Rust module files into conventional mod.rs locations while preserving their contents and updating affected test paths.

References

🤖 Generated with Claude Code

@sourcery-ai

sourcery-ai Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This structural refactor moves three self-named Rust module files to mod.rs within their existing module directories to satisfy Clippy, while recomputing the two affected test paths; reviewers should primarily verify the git mv operations and the path changes, with the full validation suite passing.

File-Level Changes

Change Details Files
Reorganize self-named module files into Rust’s mod.rs layout without changing module contents.
  • Move metrics.rs, server.rs, and scheduler.rs into matching subdirectories as mod.rs.
  • Preserve moved file contents byte-for-byte apart from path recalculations.
src/metrics.rs
src/metrics/mod.rs
src/server/runtime/server.rs
src/server/runtime/server/mod.rs
src/client/pool/scheduler.rs
src/client/pool/scheduler/mod.rs
Update test module paths to remain correct from the new module locations.
  • Point scheduler tests to the parent directory with ../scheduler_tests.rs.
  • Remove the redundant server/ prefix from the observation tests path.
src/client/pool/scheduler/mod.rs
src/server/runtime/server/mod.rs
Validate the structural migration and confirm no regressions.
  • Check formatting, Clippy/Whitaker linting, unit and UI tests, and documentation tests; all reported passing.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: 3100cf28-88c8-4bda-ac1d-36dc63d9b0f6
📥 Commits

Reviewing files that changed from the base of the PR and between 0cf5a8c and d493667.

📒 Files selected for processing: 3
  • src/client/pool/scheduler/mod.rs
  • src/metrics/mod.rs
  • src/server/runtime/server/mod.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Summary

Move three directory-backed Rust modules to mod.rs paths to address Clippy’s self_named_module_files lint:

  • src/metrics.rs → src/metrics/mod.rs
  • src/server/runtime/server.rs → src/server/runtime/server/mod.rs
  • src/client/pool/scheduler.rs → src/client/pool/scheduler/mod.rs

Update the #[path] attributes for observation_tests.rs and scheduler_tests.rs to match the new module locations. Preserve module contents and behaviour.

Checks

GitHub’s build-test, CodeQL and CodeScene checks pass on head d493667. The current-head local gate sequence remains in progress.

Walkthrough

Two test module path attributes now point to different file locations. No scheduler behaviour or public declarations changed.

Changes

Test module path updates

Layer / File(s) Summary
Update test module paths
src/client/pool/scheduler/mod.rs, src/server/runtime/server/mod.rs
The scheduler test module path now uses ../scheduler_tests.rs. The server observation test module path now uses observation_tests.rs.

Priority: ⬇️ Low

Change: Refactor

Merge Risk: ⚪ Minimal · up to d4936

This structural change is mergeable with no identified runtime or compatibility risk.

Pre-merge checks: Passed 14 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Testing (Compile-Time / Ui) Warning The pull request changes Rust compile-time module resolution: three module files move to mod.rs, and two #[path] attributes change. The authoritative diff contains only three renames and two path … Add a focused trybuild pass fixture under tests/ui and register it in tests/compile_error.rs. Compile the relevant feature configuration so the moved metrics, server, and scheduler modules and both adjusted test paths are resolved…
Passed Passed checks: 14 passed
Check name Status Explanation
Title check Passed The title "Move self-named module files to mod.rs form" clearly summarises the main change: three self-named module files (metrics.rs, server/runtime/server.rs, client/pool/scheduler.rs) are moved to …
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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.
Testing (Overall) Passed PASS: The pull request introduces no new functionality or behavioural logic. The diff contains only three file relocations: src/metrics.rs to src/metrics/mod.rs is byte-identical, and the schedule…
User-Facing Documentation Passed The pull request only renames three internal Rust module files to mod.rs and adjusts two test #[path] attributes. The diff shows no user-facing functionality, API, CLI behaviour, or usage change. …
Developer Documentation Passed Pass. The pull request only relocates three Rust module files to mod.rs paths. The only content changes recompute two test #[path] attributes. No internal API, architectural boundary, abstraction,…
Module-Level Documentation Passed Pass. Keep the existing module-level documentation. The three moved modules retain //! docstrings at the start of src/metrics/mod.rs:1, src/server/runtime/server/mod.rs:1, and `src/client/pool/s…
Testing (Unit And Behavioural) Passed Pass the testing check. The diff only renames three Rust module files and updates two relative #[path] attributes. It introduces no local behaviour, error path, invariant, or externally observable wor…
Testing (Property / Proof) Passed PASS — Do not add property tests. The pull request only moves three Rust module files and updates two #[path] attributes. The diff shows no runtime logic, input range, state transition, ordering inv…
Unit Architecture Passed Accept the change for Unit Architecture. The reviewed range contains only three file moves and two relative #[path] updates. src/metrics.rs moves unchanged to src/metrics/mod.rs; the other modul…
Domain Architecture Passed Pass. The pull request only relocates three Rust module files to mod.rs paths. The only content changes are two test #[path] attributes, adjusted for the new file locations; src/metrics.rs is by…
Observability Passed Pass the observability check. The pull request only renames three Rust module files. It changes two test-module paths to match the new locations and makes no operational behaviour, logging, metrics, t…
Description check Passed The pull request description directly matches the changeset. It explains the three module moves, the updated #[path] attributes, the preserved content, and the lint objective.
Full details: Title check

Explanation

The title "Move self-named module files to mod.rs form" clearly summarises the main change: three self-named module files (metrics.rs, server/runtime/server.rs, client/pool/scheduler.rs) are moved to mod.rs paths, as stated in the objectives and description. The title does not reference a roadmap item or issue number, and the title requirements in this context do not mandate one because no roadmap task or GitHub issue is referenced in the PR description. No execplan is involved, so the prefix rules do not apply.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

Full details: Testing (Overall)

Explanation

PASS: The pull request introduces no new functionality or behavioural logic. The diff contains only three file relocations: src/metrics.rs to src/metrics/mod.rs is byte-identical, and the scheduler and server files retain their content apart from corrected #[path] attributes. The existing substantive test modules remain present and correctly referenced by ../scheduler_tests.rs and observation_tests.rs. No additional tests are required by this check for a structural-only change.

Full details: User-Facing Documentation

Explanation

The pull request only renames three internal Rust module files to mod.rs and adjusts two test #[path] attributes. The diff shows no user-facing functionality, API, CLI behaviour, or usage change. No user-guide update is required.

Full details: Developer Documentation

Explanation

Pass. The pull request only relocates three Rust module files to mod.rs paths. The only content changes recompute two test #[path] attributes. No internal API, architectural boundary, abstraction, tooling requirement, build requirement, roadmap item, or new execplan changes. No developer-guide or design-document update is required.

Full details: Module-Level Documentation

Explanation

Pass. Keep the existing module-level documentation. The three moved modules retain //! docstrings at the start of src/metrics/mod.rs:1, src/server/runtime/server/mod.rs:1, and src/client/pool/scheduler/mod.rs:1. These docs state each module's purpose and function. The metrics documentation also identifies its relationship to the metrics crate. The pull request changes only file paths and two test-module paths; it removes no required module documentation.

Full details: Testing (Unit And Behavioural)

Explanation

Pass the testing check. The diff only renames three Rust module files and updates two relative #[path] attributes. It introduces no local behaviour, error path, invariant, or externally observable workflow. Existing scheduler and server tests remain in place, and the updated paths point to the existing test files.

Full details: Testing (Property / Proof)

Explanation

PASS — Do not add property tests. The pull request only moves three Rust module files and updates two #[path] attributes. The diff shows no runtime logic, input range, state transition, ordering invariant, lemma, or proof assumption. The module-path edits are directly auditable.

Full details: Unit Architecture

Explanation

Accept the change for Unit Architecture. The reviewed range contains only three file moves and two relative #[path] updates. src/metrics.rs moves unchanged to src/metrics/mod.rs; the other modules retain their contents apart from paths to existing test files. The diff adds no query, command, dependency, fallibility, state, or responsibility changes.

Full details: Domain Architecture

Explanation

Pass. The pull request only relocates three Rust module files to mod.rs paths. The only content changes are two test #[path] attributes, adjusted for the new file locations; src/metrics.rs is byte-identical after the move. No domain logic, adapter boundary, dependency, command invariant, or external-system handling changes.

Full details: Observability

Explanation

Pass the observability check. The pull request only renames three Rust module files. It changes two test-module paths to match the new locations and makes no operational behaviour, logging, metrics, tracing, or alert changes.

Full details: Testing (Compile-Time / Ui)

Explanation

The pull request changes Rust compile-time module resolution: three module files move to mod.rs, and two #[path] attributes change. The authoritative diff contains only three renames and two path edits; it adds no compile-time test. The repository has a trybuild harness in tests/compile_error.rs, but its existing fixtures cover unrelated public API contracts. This does not meet the required trybuild coverage for the introduced compile-time behaviour.

Resolution

Add a focused trybuild pass fixture under tests/ui and register it in tests/compile_error.rs. Compile the relevant feature configuration so the moved metrics, server, and scheduler modules and both adjusted test paths are resolved by the compiler.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Point the paths to files anew.
Keep each test module in view.
Scheduler takes one step above.
Server finds its file close by.
Let both test paths compile true.

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

codescene-access[bot]

This comment was marked as outdated.

@leynos
leynos added this pull request to stack #802 October 23, 2026 11:32
Clippy's `self_named_module_files` requires a directory-backed module to
live in `mod.rs`. Three modules already had a sibling directory, so each
`foo.rs` is now `foo/mod.rs` with `git mv`, keeping the change
content-preserving:

- `src/metrics.rs` -> `src/metrics/mod.rs`
- `src/server/runtime/server.rs` -> `src/server/runtime/server/mod.rs`
- `src/client/pool/scheduler.rs` -> `src/client/pool/scheduler/mod.rs`

The `#[path]` attributes pointing at test modules were recomputed against
the new locations, not simply retained. `scheduler_tests.rs` stays in the
parent directory and now uses `../scheduler_tests.rs`;
`observation_tests.rs` already lived in `server/`, so its attribute drops
the now-redundant `server/` prefix.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@leynos
leynos force-pushed the harden-lint-self-named-modules-20261022 branch from cc48b70 to d493667 Compare October 23, 2026 13:15
@leynos
leynos marked this pull request as ready for review October 23, 2026 14:48
@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Sorry @leynos, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 6 days and 6 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T14:50:59.560184Z d493667 Draft marked ready
🔒 Security Review ✅ Completed 2026-10-23T14:50:34.486727Z d493667 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4936677f2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


#[cfg(test)]
#[path = "scheduler_tests.rs"]
#[path = "../scheduler_tests.rs"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update source-of-truth docs for the moved modules

This move leaves current traceability documentation pointing to files that no longer exist: docs/adr-013-client-pool-scheduler-and-slot-ownership.md:110 names src/client/pool/scheduler.rs, docs/adr-014-server-shutdown-ownership.md:41-45 names both src/server/runtime/server.rs and src/metrics.rs, and docs/users-guide.md:2857 also names src/metrics.rs. Update these active references to their new mod.rs paths so the repository's documented source surfaces remain navigable; historical execution-plan references can remain unchanged.

AGENTS.md reference: AGENTS.md:L44-L47

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
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