Skip to content

Add DeepWiki README badge and fix optional cmd-mox typing for ty checker - #64

Merged
leynos merged 4 commits into
mainfrom
docs/readme-deepwiki-badge
May 7, 2026
Merged

Add DeepWiki README badge and fix optional cmd-mox typing for ty checker#64
leynos merged 4 commits into
mainfrom
docs/readme-deepwiki-badge

Conversation

@lodyai

@lodyai lodyai Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary

This branch adds the DeepWiki documentation badge next to the readme title so
that readers can open the DeepWiki-hosted repository overview. It also
adjusts the optional cmd-mox loader in publish execution so ty accepts
None when the dependency is absent, restoring a clean make typecheck gate
alongside existing ruff rules.

There is no associated roadmap task, execplan or issue.

Review walkthrough

Validation

  • make build
  • make check-fmt
  • make lint
  • make typecheck
  • make test: 432 passed
  • markdownlint README.md

Repository-wide make markdownlint still reports pre-existing MD013 line-length
findings elsewhere; only README.md was covered for markdownlint for this change.

Notes

  • After pushing, the remote surfaced https://github.com/leynos/lading/pull/new/docs/readme-deepwiki-badge as the PR creation shortcut.

Summary by Sourcery

Add a DeepWiki documentation badge to the README and tighten typing around the optional cmd-mox dependency in publish execution.

New Features:

  • Expose a DeepWiki-hosted documentation entry point via a badge in the README header.

Bug Fixes:

  • Adjust the optional cmd-mox loader in publish execution so type checking correctly accepts a missing dependency without errors.

Enhancements:

  • Clarify typing for the cmd-mox command runner module using explicit type annotations and guarded imports for type checking.

leynos and others added 2 commits May 4, 2026 21:07
`ty` rejects assigning `None` to a name typed as the imported
`command_runner` module under `ModuleNotFoundError`. Give
`cmd_runner_module` an explicit `types.ModuleType | None` annotation and
load the module in try/else so both branches remain well typed. Keep
`types` under `TYPE_CHECKING` to satisfy ruff import rules and group the
block with other typing-only imports.

Co-authored-by: Cursor <cursoragent@cursor.com>
Link the repository overview on DeepWiki for discoverability from the main
readme.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 51bdd4da-b817-464c-93db-5b41bad538f8

📥 Commits

Reviewing files that changed from the base of the PR and between e544525 and 4fdfb79.

📒 Files selected for processing (1)
  • lading/commands/publish_execution.py

Changes

This PR adds a DeepWiki documentation badge to the README and makes typing/import changes in lading/commands/publish_execution.py so the optional cmd-mox dependency is accepted as absent by the type-checker and avoids runtime NameError when annotations are evaluated.

README.md

  • Added DeepWiki badge linking to the DeepWiki project page, placed at the top of the README.

lading/commands/publish_execution.py

  • Added from __future__ import annotations to defer annotation evaluation.
  • Expanded module docstring to record the _invoke/cmd-mox routing story and the rationale for keeping a module-scope types import.
  • Imported types at module scope (with a documented rationale and a suppressed ruff TC003 lint) so types.ModuleType can be used in runtime-visible annotations without causing NameError.
  • Reworked optional cmd-mox handling:
    • Guarded optional import so cmd_runner_module: types.ModuleType | None is set to the loaded module or None when cmd-mox is missing.
    • Routed cmd-mox command-runner use through the _cmd_runner_module / cmd_runner_module pattern and explicit typing.
  • No functional changes to publish logic, subprocess invocation, passthrough handling, or public APIs; changes are limited to docstring, typing, import and defensive loading.

Issues and follow-ups

  • Issue #65 created (assigned to leynos): add configurable lockfile rebuild mechanism after lading bump (Makefile target, docs update, config key lockfile_manifests, rebuild_lockfiles option).
  • Issue #66 created (assigned to leynos): fix relative links when adopting workspace READMEs and move README transposition to bump time (rewrite relative links or convert to absolute URLs; cover with tests).

Validation

All checks passed:

  • make build
  • make check-fmt
  • make lint
  • make typecheck
  • make test (432 passed)
  • markdownlint README.md (repository-wide MD013 pre-existing)

Walkthrough

Summarise two unrelated edits: a DeepWiki badge was added to the README header; separately, lading/commands/publish_execution.py gained an expanded module docstring, a module-scope types import, and the optional cmd_mox import was routed through an intermediate _cmd_runner_module with an explicit cmd_runner_module: types.ModuleType | None annotation. No runtime behaviour changed.

Changes

Documentation Badge

Layer / File(s) Summary
Badge Addition
README.md
Inserted an "Ask DeepWiki" badge (image + link) near the top of the README.

Publish Execution: Import and Typing Adjustments

Layer / File(s) Summary
Module doc & types import
lading/commands/publish_execution.py
Replaced minimal top-level docstring with an expanded module docstring and added import types at module scope.
Optional import wiring & typing
lading/commands/publish_execution.py
Changed optional cmd_mox import to assign via an intermediate _cmd_runner_module inside try/except and declared `cmd_runner_module: types.ModuleType
Non-functional
lading/commands/publish_execution.py
No changes to command execution logic, subprocess invocation, cmd-mox stub routing, passthrough handling, or other runtime behaviour.

"A badge now gleams upon the page,
while module notes expand with sage.
Types arrive to mark the slot,
imports route but change naught. ✨📘"


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Testing (Overall) ❓ Inconclusive No result was produced after verification. Marking as INCONCLUSIVE. Re-run the check or adjust instructions to produce a final result.
✅ Passed checks (17 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects both main changes: adding the DeepWiki README badge and fixing optional cmd-mox typing for the type checker.
Description check ✅ Passed The description provides comprehensive context aligned with the changeset, detailing the DeepWiki badge addition, cmd-mox typing fixes, validation steps, and referenced file changes.
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.
User-Facing Documentation ✅ Passed No user-facing changes. DeepWiki badge is a documentation link; publish_execution.py changes are internal type-checking fixes with no public API changes.
Developer Documentation ✅ Passed PR adds typing annotations for optional cmd-mox dependency and a README badge. No new APIs, architectural changes, tooling requirements, or multi-language docs needed. Documented inline in code.
Module-Level Documentation ✅ Passed The publish_execution.py module docstring (13 lines) comprehensively explains purpose, utility, function, and relationships to lading.commands.publish and tests. All requirements met.
Testing (Unit And Behavioural) ✅ Passed Adequate test coverage present. 15 unit tests cover exported functions and internal helpers. Integration/BDD tests exercise publish workflows. Type checking via CI pyright validates typing changes.
Testing (Property / Proof) ✅ Passed No invariants, proof assumptions, or axioms introduced. Changes are type refinements and optional dependency import restructuring only.
Testing (Compile-Time / Ui) ✅ Passed Python project using pyright type-checking via make typecheck. PR's type annotation and import changes covered by existing type-check and unit tests. Trybuild and snapshot tests not applicable.
Unit Architecture ✅ Passed Optional dependency has explicit typing and bounds checking. Queries stay pure. Commands handle effects correctly. Dependencies are injectable via parameters.
Domain Architecture ✅ Passed Domain architecture maintained. Changes improve typing hygiene and guard optional dependencies without breaching domain-adapter separation.
Observability ✅ Passed PR introduces no operational behaviour changes. Changes are typing/import refactoring and documentation improvements only. No new error paths, decision points, or observability requirements apply.
Security And Privacy ✅ Passed No secrets exposed. Environment variables redacted in logs. Safe subprocess invocation. Optional dependencies handled securely. DeepWiki badge is public.
Performance And Resource Use ✅ Passed Bounded streaming with 4096-byte chunks, efficient PATH deduplication, minimal conversions. No regressions, unbounded allocations, or blocking operations detected.
Concurrency And State ✅ Passed PR contains only typing and import changes. No concurrency logic or shared state modifications were made. Threading code unchanged.
✨ 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 docs/readme-deepwiki-badge

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

codescene-delta-analysis[bot]

This comment was marked as outdated.

@sourcery-ai

sourcery-ai Bot commented May 4, 2026

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

Reviewer's Guide

Adds a DeepWiki documentation badge to the README and refactors the optional cmd-mox import in publish_execution.py to be explicitly typed and type-checker-friendly when the dependency is absent.

Flow diagram for optional cmd_mox import and typing in publish_execution

flowchart TD
    A[Module_imports_publish_execution] --> B[Initialize_cmd_runner_module_annotation]
    B --> C{Import_cmd_mox_command_runner}
    C -->|Success| D[Assign__cmd_runner_module_to_cmd_runner_module]
    C -->|ModuleNotFoundError| E[Set_cmd_runner_module_to_None]
    D --> F[Runtime_functions_use_cmd_runner_module_if_not_None]
    E --> F
    subgraph Type_checking
      G[TYPE_CHECKING_block_imports_types_and_PublishPreflightError]
      H[cmd_runner_module_annotated_as_ModuleType_or_None]
    end
    A --> G
    G --> H
    H --> C
Loading

File-Level Changes

Change Details Files
Refine optional cmd-mox dependency loading to satisfy static type checking while preserving runtime optionality.
  • Move TYPE_CHECKING-only imports (including PublishPreflightError) into a dedicated TYPE_CHECKING block near the top of the module.
  • Introduce an explicit cmd_runner_module: types.ModuleType
None annotation.
  • Refactor the cmd-mox import into a try/except/else pattern that assigns cmd_runner_module to None on ModuleNotFoundError and to the imported module otherwise, avoiding type: ignore usage.
  • Expose DeepWiki-hosted repository overview via a README badge link.
    • Add an "Ask DeepWiki" badge image under the main README title.
    • Link the badge to the DeepWiki page for the repository.
    README.md

    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

    @leynos

    leynos commented May 4, 2026

    Copy link
    Copy Markdown
    Owner

    @coderabbitai please add a GitHub issue for configurable lockfile rebuild mechanism following bump that allows the rebuild of lockfiles using, for example:

    Add a Makefile target and mandate it in docs/releasing-crates.md so future version bumps have an explicit regeneration step in the release checklist:

    cargo generate-lockfile --manifest-path crates/rstest-bdd/tests/ui_lints/Cargo.toml

    An example configuration might read:

    lockfile_manifests = [
      "crates/rstest-bdd/tests/ui_lints/Cargo.toml",
    ]

    Cargo.toml itself need not be specified as it is assumed.

    A separate rebuild_lockfiles during lading bump defaults to true.

    @coderabbitai

    coderabbitai Bot commented May 4, 2026

    Copy link
    Copy Markdown

    Tip

    For best results, initiate chat on the files or code changes.

    🧩 Analysis chain

    🏁 Script executed:

    #!/bin/bash
    gh issue create \
      --repo leynos/lading \
      --title "Configurable lockfile rebuild mechanism following bump" \
      --body "## Overview
    
    Add a configurable lockfile rebuild mechanism that runs automatically after \`lading bump\`, regenerating any nested \`Cargo.lock\` files listed in configuration.
    
    Raised by `@leynos` in https://github.com/leynos/lading/pull/64.
    
    ## Motivation
    
    Nested crates (e.g. \`crates/rstest-bdd/tests/ui_lints\`) maintain their own \`Cargo.lock\` files. After a version bump these become stale, and there is currently no explicit regeneration step in the release checklist.
    
    ## Proposed Changes
    
    ### 1. Makefile target
    
    Add a \`Makefile\` target to regenerate all configured lockfiles, e.g.:
    
    \`\`\`makefile
    regenerate-lockfiles:
    	cargo generate-lockfile --manifest-path crates/rstest-bdd/tests/ui_lints/Cargo.toml
    \`\`\`
    
    ### 2. Release checklist (\`docs/releasing-crates.md\`)
    
    Mandate the lockfile regeneration step in the release checklist so future version bumps include an explicit regeneration pass.
    
    ### 3. Configuration
    
    Allow lockfile manifests to be declared in configuration:
    
    \`\`\`toml
    lockfile_manifests = [
      \"crates/rstest-bdd/tests/ui_lints/Cargo.toml\",
    ]
    \`\`\`
    
    \`Cargo.toml\` at the workspace root need not be specified — it is assumed.
    
    ### 4. \`lading bump\` flag
    
    Introduce a \`rebuild_lockfiles\` option during \`lading bump\` that defaults to \`true\`, so lockfiles are regenerated automatically unless explicitly opted out.
    
    ## Acceptance Criteria
    
    - [ ] \`Makefile\` target regenerates all configured lockfiles
    - [ ] \`docs/releasing-crates.md\` includes the regeneration step in the release checklist
    - [ ] \`lockfile_manifests\` config key is supported and documented
    - [ ] \`lading bump\` rebuilds lockfiles by default (\`rebuild_lockfiles = true\`)
    - [ ] \`rebuild_lockfiles = false\` skips regeneration
    " \
      --assignee leynos
    

    Length of output: 43


    @leynos: The issue has been created and assigned to you — #65: Configurable lockfile rebuild mechanism following bump.

    It covers all four proposed changes:

    1. Makefile targetregenerate-lockfiles invoking cargo generate-lockfile per configured manifest.
    2. docs/releasing-crates.md — mandating the regeneration step in the release checklist.
    3. lockfile_manifests config key — listing nested manifests to rebuild; the workspace Cargo.toml is assumed implicitly.
    4. lading bump flagrebuild_lockfiles defaulting to true, skippable via rebuild_lockfiles = false.

    @leynos

    leynos commented May 4, 2026

    Copy link
    Copy Markdown
    Owner

    @coderabbitai please create a new GitHub issue for the following:

    When using the workspace README adoption feature, relative links in the Markdown file should be updated to reflect the correct location. README.md transposition should be done at bump time rather than publish time to enable this.

    Because this README lives under crates/rstest-bdd/, the current relative link won’t resolve to the top-level docs/ directory. Please update it to a correct relative path (e.g. ../../docs/v0-6-0-migration-guide.md) or use an absolute URL so the migration guide is reachable.

    @coderabbitai

    coderabbitai Bot commented May 4, 2026

    Copy link
    Copy Markdown

    Tip

    For best results, initiate chat on the files or code changes.

    🧩 Analysis chain

    🏁 Script executed:

    #!/bin/bash
    gh issue create \
      --repo leynos/lading \
      --title "Fix relative links in workspace README adoption and move transposition to bump time" \
      --body "## Overview
    
    When using the workspace README adoption feature, relative links in a crate's \`README.md\` should be updated to reflect the correct resolved location. To make this possible, \`README.md\` transposition must be performed at bump time rather than publish time.
    
    Raised by `@leynos` in https://github.com/leynos/lading/pull/64.
    
    ## Problem
    
    Because a crate README (e.g. \`crates/rstest-bdd/README.md\`) lives in a subdirectory, any relative links it contains will not resolve correctly after the file is transposed to the workspace root or published to crates.io. For example, a relative link such as \`docs/v0-6-0-migration-guide.md\` will not resolve to the top-level \`docs/\` directory.
    
    ## Proposed Changes
    
    ### 1. Move README transposition to bump time
    
    Perform \`README.md\` transposition during \`lading bump\` rather than at publish time. This gives the tool an opportunity to rewrite relative links before the file is committed.
    
    ### 2. Rewrite relative links during transposition
    
    During transposition, update relative links in the adopted README to correctly reflect the file's new location. For example:
    
    - Rewrite \`docs/v0-6-0-migration-guide.md\` → \`../../docs/v0-6-0-migration-guide.md\` (correct relative path from the crate subdirectory), or
    - Replace relative links with absolute URLs where appropriate.
    
    ## Acceptance Criteria
    
    - [ ] README transposition is performed at bump time, not publish time
    - [ ] Relative links in transposed READMEs are rewritten to resolve correctly from their new location
    - [ ] Alternatively, relative links may be converted to absolute URLs
    - [ ] Behaviour is covered by tests
    " \
      --assignee leynos
    

    Length of output: 43


    @leynos: The issue has been created and assigned to you — #66: Fix relative links in workspace README adoption and move transposition to bump time.

    It covers both required changes:

    1. Move transposition to bump time — perform README.md transposition during lading bump rather than at publish time, so link rewriting can happen before the file is committed.
    2. Rewrite relative links — during transposition, resolve relative links to their correct paths from the crate's subdirectory (e.g. ../../docs/v0-6-0-migration-guide.md) or convert them to absolute URLs.

    @leynos
    leynos marked this pull request as ready for review May 5, 2026 09:15

    @sourcery-ai sourcery-ai 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.

    Hey - I've left some high level feedback:

    • The cmd_runner_module: types.ModuleType | None annotation references types at runtime while types is only imported under TYPE_CHECKING, which can raise a NameError unless from __future__ import annotations is guaranteed for this module; consider either importing types unconditionally or using a string annotation / typing alias to keep it purely type-checker-only.
    Prompt for AI Agents
    Please address the comments from this code review:
    
    ## Overall Comments
    - The `cmd_runner_module: types.ModuleType | None` annotation references `types` at runtime while `types` is only imported under `TYPE_CHECKING`, which can raise a `NameError` unless `from __future__ import annotations` is guaranteed for this module; consider either importing `types` unconditionally or using a string annotation / `typing` alias to keep it purely type-checker-only.

    Sourcery is free for open source - if you like our reviews please consider sharing them ✨
    Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

    Review feedback noted that `types.ModuleType` annotations can fail with
    `NameError` if `types` is only loaded under `TYPE_CHECKING` and deferral
    does not apply everywhere. Keep stdlib `types` material at module scope and
    document the rationale next to the guarded ruff `TC003` suppression.
    
    Co-authored-by: Cursor <cursoragent@cursor.com>
    codescene-delta-analysis[bot]

    This comment was marked as outdated.

    @leynos

    leynos commented May 5, 2026

    Copy link
    Copy Markdown
    Owner

    @coderabbitai Have the following now been resolved?

    • The cmd_runner_module: types.ModuleType | None annotation references types at runtime while types is only imported under TYPE_CHECKING, which can raise a NameError unless from __future__ import annotations is guaranteed for this module; consider either importing types unconditionally or using a string annotation / typing alias to keep it purely type-checker-only.

    @coderabbitai

    coderabbitai Bot commented May 5, 2026

    Copy link
    Copy Markdown

    Tip

    For best results, initiate chat on the files or code changes.

    🧩 Analysis chain

    🏁 Script executed:

    #!/bin/bash
    # Check current state of publish_execution.py on the PR branch
    cat lading/commands/publish_execution.py | head -60
    

    Length of output: 1551


    @leynos: Yes, the issue is fully resolved. The fix applies two independent safeguards:

    1. from __future__ import annotations (line 9) — defers all annotation evaluation, so types.ModuleType | None is never evaluated as a runtime expression.
    2. import types # noqa: TC003 at module scope (line 18) — imports types unconditionally, so even if annotation evaluation does run at runtime, no NameError can be raised.

    The module docstring records the reasoning explicitly, so future maintainers know why types must remain at module scope rather than under TYPE_CHECKING.

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

    🤖 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 `@lading/commands/publish_execution.py`:
    - Around line 1-7: Replace the current module docstring with a purpose-first
    docstring that explains this module provides command-execution helpers for
    publish operations (brief description, main utilities, and key exports such as
    split_command, should_use_cmd_mox_stub, normalise_cmd_mox_command and when to
    use them), and move the implementation-detail about keeping the stdlib types
    import at module scope into an inline comment adjacent to the types import
    (leave the import as-is and add a short comment: why module-scope types is
    required so cmd_runner_module: types.ModuleType | None annotations won’t raise
    NameError).
    
    🪄 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 Plus

    Run ID: b95066ff-c032-4f48-994d-026f780601cf

    📥 Commits

    Reviewing files that changed from the base of the PR and between e0bd72e and e544525.

    📒 Files selected for processing (1)
    • lading/commands/publish_execution.py

    Comment thread lading/commands/publish_execution.py
    Describe ``_invoke``, the cmd-mox routing story and the exported helper
    aliases. Keep the stdlib ``types`` rationale next to the import so the import
    block stays isort-clean.
    
    Co-authored-by: Cursor <cursoragent@cursor.com>
    @leynos
    leynos merged commit 28c6cf4 into main May 7, 2026
    4 checks passed
    @leynos
    leynos deleted the docs/readme-deepwiki-badge branch May 7, 2026 21:41
    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