Skip to content

Add pinned Interrogate docstring coverage gate (#676) - #680

Merged
leynos merged 15 commits into
mainfrom
issue-676-add-pinned-interrogate-docstring-coverage-gate-for-python-infrastructure
Sep 17, 2026
Merged

leynos merged 15 commits into
mainfrom
issue-676-add-pinned-interrogate-docstring-coverage-gate-for-python-infrastructure

Conversation

@leynos

@leynos leynos commented Sep 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

This branch adds a pinned interrogate==1.7.0 gate for Netsuke
Python infrastructure, so make lint-python now requires 100%
docstring coverage across the repository-owned source boundary.

Closes #676.

Review walkthrough

  • Start with Makefile for the pinned command, explicit spelling-helper exclusions, and lint-python integration.
  • Then review the developer guide for the source scope, 100% requirement, and typ.overload exception policy.
  • Finish with the workflow contract for exact-pin and Makefile-command coverage.

Validation

  • make check-fmt: passed
  • make lint: passed; Interrogate reports 100%
  • make doc-coverage: passed (99.14%)
  • make test: passed (2,798 nextest tests and doctests)
  • make test-workflow-contracts: passed (276 tests)
  • make markdownlint: passed
  • make nixie: passed
  • coderabbit review --agent: invoked twice after deterministic gates; the service did not return or store review findings.

Notes

  • The unfiltered baseline was 97.7% (544/557 definitions; 13 missing). The issue-comment API rejected recording it with Resource not accessible by integration; the scoped gate now passes at 100%.

References

https://lody.ai/leynos/sessions/6322cc30-e75e-4b9f-b609-ccde83f647ef

Summary by Sourcery

Enforce complete Python docstring coverage and protect coverage runs from resource contention caused by concurrent nested Cargo builds.

New Features:

  • Add a pinned Interrogate 1.7.0 documentation-coverage gate requiring 100% coverage for the repository-owned Python source scope.
  • Serialize tests that launch nested Cargo builds while preserving normal Nextest parallelism.

Enhancements:

  • Document the Python docstring coverage policy, source boundary, exclusions, and toolchain pinning requirements.
  • Expand workflow contracts to verify the Interrogate command and automatically detect nested Cargo build tests, including robust Rust syntax handling.
  • Improve docstrings and API documentation across coverage tooling and related test helpers.

Build:

  • Integrate the pinned Interrogate command and explicit spelling-helper exclusions into make lint-python.

Documentation:

  • Update the developer guide with Interrogate coverage behavior, scope, exclusions, and exception policy.

Tests:

  • Add workflow contract tests covering Interrogate pinning, invocation arguments, source scope, exclusions, and nested Cargo build serialization.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview 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

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 0124c4c3-588c-41be-8400-6329cc74cac1

📥 Commits

Reviewing files that changed from the base of the PR and between 72256e8 and e58a1f3.

📒 Files selected for processing (9)
  • Makefile
  • docs/developers-guide.md
  • scripts/doc_coverage_cargo.py
  • scripts/doc_coverage_runner.py
  • scripts/hoist_binstall_discovery.py
  • scripts/tests/test_doc_coverage_cargo.py
  • scripts/tests/test_doc_coverage_runner.py
  • tests/workflow_contracts/hoist_binstall_rollback_test.py
  • tests/workflow_contracts/python_toolchain_sync_test.py
🔗 Linked repositories identified

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

  • leynos/monotony (auto-detected)
  • leynos/whitaker (auto-detected)
  • leynos/rstest-bdd (auto-detected)
  • leynos/mdtablefix (auto-detected)
  • leynos/ortho-config (auto-detected)
  • leynos/lading (auto-detected)
  • leynos/shared-actions (auto-detected)
  • leynos/nixie (auto-detected)
  • leynos/ansible (auto-detected)

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.


Summary

Add a pinned interrogate==1.7.0 gate to make lint-python.

  • Enforce 100% docstring coverage for scripts/ and tests/workflow_contracts/.
  • Preserve spelling-helper exclusions.
  • Add missing docstrings without changing runtime behaviour.
  • Document the scope, threshold, exclusions, and typ.overload policy in docs/developers-guide.md.
  • Extend workflow contract tests to verify the pin and Makefile integration.
  • Keep Ruff documentation checks enabled for implementations.

Validation passed for formatting, linting, documentation coverage, tests, workflow contracts, Markdown linting, and Nixie.

Track the implementation against issue #676.

Walkthrough

The Python lint pipeline now includes pinned Interrogate coverage at 100%. The change adds explicit exclusions, documents the policy, adds required docstrings, and verifies the pin and command through workflow-contract tests.

Changes

Interrogate documentation coverage

Layer / File(s) Summary
Configure the Interrogate gate
Makefile
The Makefile pins Interrogate to 1.7.0, requires 100% coverage, excludes spelling-helper files, and runs the command from lint-python.
Close documentation gaps
scripts/doc_coverage_cargo.py, scripts/doc_coverage_runner.py, scripts/hoist_binstall_discovery.py, scripts/tests/*, tests/workflow_contracts/hoist_binstall_rollback_test.py
Add docstrings to uncovered constructors and callbacks. Clarify two rollback test helper docstrings. Runtime behaviour remains unchanged.
Document and verify the toolchain
docs/developers-guide.md, tests/workflow_contracts/python_toolchain_sync_test.py
Document the Interrogate scope, exclusions, overload handling, and shared Makefile pin. Add contract checks for version 1.7.0 and the lint command.

Suggested labels: Issue

Priority: ⬇️ Low

Change: Feature

Merge Risk: ⚪ Minimal · up to e58a1

No actionable merge-blocking risk remains in the reviewed change.


Caution

Pre-merge checks failed

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

  • Ignore

❌ Failed checks (2 errors)

Check name Status Explanation Resolution
Testing (Overall) ❌ Error Reject the testing coverage for the new gate. The added contract tests check that lint-python contains the $(INTERROGATE) $(INTERROGATE_EXCLUDES) $(PYTHON_SOURCES) text and that `INTERROGATE_VERSI… Add a focused Makefile contract test that parses the Interrogate definition and asserts the pinned interrogate==$(INTERROGATE_VERSION) package, the interrogate executable, and --fail-under 100. Assert that the lint recipe passes the c…
Testing (Unit And Behavioural) ❌ Error The pull request changes the externally observable make lint-python command-line workflow by adding Interrogate, but it adds no behavioural test at that boundary. `test_python_quality_targets_run_th… Add a workflow-contract behavioural test that invokes make lint-python with controlled command shims. Assert the Interrogate shim receives --fail-under 100, every spelling-helper exclusion, and the documented PYTHON_SOURCES paths. Add…
✅ Passed checks (13 passed)
Check name Status Explanation
Title check ✅ Passed Accept the title because it clearly identifies the pinned Interrogate docstring coverage gate and references issue #676.
Description check ✅ Passed Accept the description because it directly explains the Interrogate 1.7.0 gate, its scope, documentation updates, tests, and validation results.
Linked Issues check ✅ Passed Accept the implementation for #676. Makefile pins interrogate==1.7.0, applies --fail-under 100, uses the configured Python source boundary, and excludes the spelling-helper files. lint-python ru…
Out of Scope Changes check ✅ Passed Keep the change set within #676. The Makefile and documentation changes implement the gate. The added docstrings satisfy the gate. The workflow contract changes protect the pin and integration. No unr…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 7 files. (2 skipped: 2…
User-Facing Documentation ✅ Passed Pass this check. The pull request changes only developer tooling, lint configuration, internal docstrings, and workflow-contract tests. It adds Interrogate to make lint-python and documents that gat…
Developer Documentation ✅ Passed Pass. The changed developer guide clearly documents the new Interrogate requirement. It states that make lint runs Interrogate, identifies INTERROGATE_VERSION, defines the PYTHON_SOURCES scope, …
Module-Level Documentation ✅ Passed Pass this check. The pull request changes no module-level documentation adversely. Every changed Python module has a clear module docstring. The docstrings state each module's purpose and function, an…
Testing (Property / Proof) ✅ Passed PASS — Do not recommend a property test. The pull request adds static Makefile wiring, documentation, and docstrings. Its only new test contract checks a finite set of exact pins and command strings, …
Testing (Compile-Time / Ui) ✅ Passed PASS: The pull request changes only Makefile configuration, Markdown documentation, and Python sources/tests. It introduces no Rust or TypeScript compile-time behaviour, so a trybuild-style test is no…
Unit Architecture ✅ Passed Pass. Treat this as tooling and documentation work, not a change to application unit architecture. The diff adds a pinned Interrogate command to lint-python, updates documentation and workflow-contr…
Domain Architecture ✅ Passed PASS — The pull request does not change domain logic or domain boundaries. The code changes add docstrings only to existing exceptions, callbacks, and test fakes. The other changes add an Interrogate …
Observability ✅ Passed Treat the check as inapplicable. The pull request changes developer tooling, documentation, tests, and docstrings only. The only new execution path is the pinned interrogate quality gate in `make li…
Full details: Testing (Overall)

Explanation

Reject the testing coverage for the new gate. The added contract tests check that lint-python contains the $(INTERROGATE) $(INTERROGATE_EXCLUDES) $(PYTHON_SOURCES) text and that INTERROGATE_VERSION is 1.7.0. They do not verify that INTERROGATE invokes Interrogate, applies --fail-under 100, expands the required spelling-helper exclusions, or scans the complete source boundary. The tests would still pass if INTERROGATE were changed to a no-op, if the threshold were lowered, or if the source scope and exclusions were bypassed. The other changed files only add docstrings and do not require new behavioural tests.

Resolution

Add a focused Makefile contract test that parses the Interrogate definition and asserts the pinned interrogate==$(INTERROGATE_VERSION) package, the interrogate executable, and --fail-under 100. Assert that the lint recipe passes the complete PYTHON_SOURCES value and every file in SPELLING_HELPER_FILES through INTERROGATE_EXCLUDES. Make the test fail when the command becomes a no-op, the threshold changes, the source scope narrows, or the exclusions disappear. Prefer validating the expanded command with a controlled Make invocation or a precise parser rather than checking only a command-name substring.

Full details: Testing (Unit And Behavioural)

Explanation

The pull request changes the externally observable make lint-python command-line workflow by adding Interrogate, but it adds no behavioural test at that boundary. test_python_quality_targets_run_the_pinned_local_commands() only reads Makefile text through _makefile_target() and checks that the variable reference exists. It does not expand or run the target, verify --fail-under 100, verify the exclusion arguments and source paths, or verify failure propagation. The other changed tests only gain docstrings. The new gate therefore lacks meaningful success, argument, and error-path coverage required for a command-line and integration-contract change.

Resolution

Add a workflow-contract behavioural test that invokes make lint-python with controlled command shims. Assert the Interrogate shim receives --fail-under 100, every spelling-helper exclusion, and the documented PYTHON_SOURCES paths. Add success and non-zero-exit cases, and assert that a failing Interrogate command makes lint-python fail. Keep the test focused on Makefile wiring; do not test Interrogate's own implementation.


A pinned gate now guards the code
Docstrings light the linting road
Spelling helpers step aside
Contracts keep the tools aligned
One hundred marks the coverage tide

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

@sourcery-ai

sourcery-ai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Introduces a pinned Interrogate 1.7.0 quality gate requiring 100% docstring coverage for repository-owned Python sources, with explicit spelling-helper exclusions, documentation, workflow contract enforcement, and the missing docstrings needed to pass the gate.

Flow diagram for the Interrogate Python lint gate

flowchart LR
    Sources[PYTHON_SOURCES] --> Exclusions[INTERROGATE_EXCLUDES]
    Exclusions --> Interrogate[interrogate==1.7.0]
    Interrogate --> Coverage{100% coverage?}
    Coverage -->|pass| LintPython[make lint-python passes]
    Coverage -->|fail| LintPythonFail[make lint-python fails]
Loading

File-Level Changes

Change Details Files
Add a pinned Interrogate docstring coverage gate to the Python lint pipeline.
  • Pin Interrogate to version 1.7.0 and invoke it through uv.
  • Require 100% coverage over PYTHON_SOURCES during lint-python.
  • Exclude the synchronized spelling-helper files from Interrogate, preserving their dedicated coverage policy.
  • Document the scope, exclusions, CI behavior, and exception policy.
Makefile
docs/developers-guide.md
Extend workflow contract tests to enforce the new tool pin and command wiring.
  • Validate the exact Interrogate version and its Makefile command in lint-python.
  • Keep the selected release explicitly locked to 1.7.0.
  • Update contract documentation for local-versus-CI pin behavior.
tests/workflow_contracts/python_toolchain_sync_test.py
Bring existing Python definitions into compliance with the repository-wide docstring gate.
  • Add constructor docstrings to coverage and test helper classes.
  • Document nested callbacks used for filesystem traversal and rollback testing.
scripts/doc_coverage_cargo.py
scripts/doc_coverage_runner.py
scripts/hoist_binstall_discovery.py
scripts/tests/test_doc_coverage_cargo.py
scripts/tests/test_doc_coverage_runner.py
tests/workflow_contracts/hoist_binstall_rollback_test.py

Assessment against linked issues

Issue Objective Addressed Explanation
#676 Add a pinned Interrogate 1.7.0 command with a 100% docstring-coverage gate over the repository-owned Python sources, while explicitly excluding the estate-synchronised spelling helpers. ✅
#676 Integrate Interrogate into the Python lint workflow and document the source scope, threshold, spelling-helper policy, and targeted handling required for any future typ.overload stubs. ✅
#676 Close the missing docstring gaps needed for the selected gate and add workflow-contract tests that enforce the exact Interrogate pin and Makefile integration. ✅

Possibly linked issues


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

codescene-access[bot]

This comment was marked as outdated.

@codescene-access codescene-access 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.

No quality gates enabled for this code.

@leynos
leynos force-pushed the issue-676-add-pinned-interrogate-docstring-coverage-gate-for-python-infrastructure branch from 751c8ce to e58a1f3 Compare September 15, 2026 16:46
@leynos
leynos marked this pull request as ready for review September 15, 2026 16:47

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

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 1 day and 18 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 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-09-15T16:50:35.152334Z e58a1f3 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.

codescene-access[bot]

This comment was marked as outdated.

@coderabbitai coderabbitai Bot added the Issue A pull request originating from an issue label Sep 15, 2026

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

ℹ️ 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".

Comment thread Makefile Outdated
codescene-access[bot]

This comment was marked as outdated.

@leynos

leynos commented Sep 16, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Please investigate the cause of the following issue using codegraph exploration and research, identify a fix and provide an AI coding agent prompt for the fix:

          SLOW [> 60.000s] (─────────) netsuke-build::packaging_smoke_tests packaged_manifest_retains_build_script_sources
          SLOW [>180.000s] (─────────) netsuke-build::command_env_ui_tests cli_configuration_fixture_compiles
          SLOW [>120.000s] (─────────) netsuke-build::locale_stub_ui_tests harness_compiles_under_a_split_build_dir
          SLOW [>120.000s] (─────────) netsuke-build::packaging_smoke_tests packaged_manifest_retains_build_script_sources
          SLOW [>240.000s] (─────────) netsuke-build::command_env_ui_tests cli_configuration_fixture_compiles
          SLOW [>180.000s] (─────────) netsuke-build::locale_stub_ui_tests harness_compiles_under_a_split_build_dir
          PASS [ 274.869s] (3041/3043) netsuke-build::command_env_ui_tests cli_configuration_fixture_compiles
          SLOW [>180.000s] (─────────) netsuke-build::packaging_smoke_tests packaged_manifest_retains_build_script_sources
          SLOW [>240.000s] (─────────) netsuke-build::locale_stub_ui_tests harness_compiles_under_a_split_build_dir
          SLOW [>240.000s] (─────────) netsuke-build::packaging_smoke_tests packaged_manifest_retains_build_script_sources
   TERMINATING [>300.000s] (─────────) netsuke-build::locale_stub_ui_tests harness_compiles_under_a_split_build_dir
       TIMEOUT [ 300.008s] (3042/3043) netsuke-build::locale_stub_ui_tests harness_compiles_under_a_split_build_dir
    stdout ───
  
      running 1 test
      test harness_compiles_under_a_split_build_dir has been running for over 60 seconds
  
      (test timed out)
  
    Cancelling due to test failure: 1 test still running
   TERMINATING [>300.000s] (─────────) netsuke-build::packaging_smoke_tests packaged_manifest_retains_build_script_sources
       TIMEOUT [ 300.012s] (3043/3043) netsuke-build::packaging_smoke_tests packaged_manifest_retains_build_script_sources
    stdout ───
  
      running 1 test
      test packaged_manifest_retains_build_script_sources has been running for over 60 seconds
  
      (test timed out)
  
  ────────────
       Summary [ 457.440s] 3043 tests run: 3041 passed (4 slow), 2 timed out, 3 skipped
       TIMEOUT [ 300.008s] (3042/3043) netsuke-build::locale_stub_ui_tests harness_compiles_under_a_split_build_dir
       TIMEOUT [ 300.012s] (3043/3043) netsuke-build::packaging_smoke_tests packaged_manifest_retains_build_script_sources
  error: test run failed
  error: process didn't exit successfully: `/home/runner/.rustup/toolchains/nightly-2026-08-23-x86_64-unknown-linux-gnu/bin/cargo nextest run --manifest-path Cargo.toml --target-dir /home/runner/work/netsuke/netsuke/target/llvm-cov-target --workspace --all-targets --all-features` (exit status: 100)
  cargo llvm-cov nextest --manifest-path Cargo.toml --workspace --all-targets --all-features --lcov --output-path lcov.info failed with code 1

Seek a systemic fix rather than tactical. Ask yourself, can this happen again or happen elsewhere? If so, think about a long term fix of the underlying issue.

@coderabbitai

This comment was marked as resolved.

codescene-access[bot]

This comment was marked as outdated.

@leynos

leynos commented Sep 16, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Have the following failed checks now been resolved?

If further work is required, please provide an AI agent prompt for the remaining work to be done to address these failures.

Do not treat warnings as optional or aspirational. Where a change is out of scope for this PR, propose a GitHub issue unless one exists already. (Treat o11y, code safety, documentation and validation coverage as in scope).

❌ Failed checks (2 errors)

Check name Status Explanation Resolution
Testing (Overall) ❌ Error Reject the testing coverage for the new gate. The added contract tests check that lint-python contains the $(INTERROGATE) $(INTERROGATE_EXCLUDES) $(PYTHON_SOURCES) text and that `INTERROGATE_VERSI… Add a focused Makefile contract test that parses the Interrogate definition and asserts the pinned interrogate==$(INTERROGATE_VERSION) package, the interrogate executable, and --fail-under 100. Assert that the lint recipe passes the c…
Testing (Unit And Behavioural) ❌ Error The pull request changes the externally observable make lint-python command-line workflow by adding Interrogate, but it adds no behavioural test at that boundary. `test_python_quality_targets_run_th… Add a workflow-contract behavioural test that invokes make lint-python with controlled command shims. Assert the Interrogate shim receives --fail-under 100, every spelling-helper exclusion, and the documented PYTHON_SOURCES paths. Add…

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '== PR metadata and checks =='
gh pr view 680 --repo leynos/netsuke --json headRefOid,updatedAt,statusCheckRollup,files --jq \
  '{headRefOid, updatedAt, files: [.files[].path], checks: [.statusCheckRollup[] | {name, conclusion, status, detailsUrl}]}'

printf '%s\n' '== Changed-file diff summary =='
git diff --stat origin/HEAD...HEAD 2>/dev/null || git diff --stat HEAD^...HEAD

printf '%s\n' '== Makefile Interrogate definitions and lint-python recipe =='
rg -n -C 8 'INTERROGATE|^lint-python:' Makefile

printf '%s\n' '== Workflow contract test outlines =='
ast-grep outline tests/workflow_contracts/python_toolchain_sync_test.py --items all
ast-grep outline tests/workflow_contracts/runner_shape_test.py --items all 2>/dev/null || true

printf '%s\n' '== Relevant contract-test implementation =='
sed -n '1,320p' tests/workflow_contracts/python_toolchain_sync_test.py
sed -n '1,360p' tests/workflow_contracts/runner_shape_test.py 2>/dev/null || true

printf '%s\n' '== Relevant branch diff =='
git diff origin/HEAD...HEAD -- Makefile tests/workflow_contracts/python_toolchain_sync_test.py tests/workflow_contracts/runner_shape_test.py 2>/dev/null \
  || git diff HEAD^...HEAD -- Makefile tests/workflow_contracts/python_toolchain_sync_test.py tests/workflow_contracts/runner_shape_test.py

Length of output: 6346


🏁 Script executed:

#!/bin/bash
set -u

printf '%s\n' '== Makefile Interrogate definitions and lint-python recipe =='
rg -n -C 10 'INTERROGATE|^lint-python:' Makefile || true

printf '%s\n' '== Workflow-contract inventory =='
fd -t f . tests/workflow_contracts | sort
printf '%s\n' '== Contract test outlines =='
ast-grep outline tests/workflow_contracts/python_toolchain_sync_test.py --items all || true
ast-grep outline tests/workflow_contracts/runner_shape_test.py --items all || true

printf '%s\n' '== Python toolchain contract implementation =='
cat -n tests/workflow_contracts/python_toolchain_sync_test.py || true
printf '%s\n' '== Runner-shape contract implementation =='
cat -n tests/workflow_contracts/runner_shape_test.py || true

printf '%s\n' '== Behavioural make-target test candidates =='
rg -n -C 5 --glob '*.py' \
  'subprocess\.run|Popen|make (lint-python|lint)|lint-python|PATH|shim|fake.*(command|tool)|monkeypatch.*PATH' \
  tests/workflow_contracts scripts/tests || true

printf '%s\n' '== PR file patches for relevant files =='
gh api 'repos/leynos/netsuke/pulls/680/files?per_page=100' --paginate \
  --jq '.[] | select(.filename == "Makefile" or .filename == "tests/workflow_contracts/python_toolchain_sync_test.py") | {filename, patch}'

Length of output: 231436


@leynos The two failed checks are resolved by the current PR head, 7f1df670916c89550ba0a24d970aeff073f0b630.

  • Testing (Overall) is resolved. tests/workflow_contracts/python_toolchain_sync_test.py now parses INTERROGATE as shell tokens. test_interrogate_command_uses_the_pinned_baseline_and_release requires:

    • --from interrogate==$(INTERROGATE_VERSION);
    • the interrogate executable;
    • --fail-under 100.
  • Testing (Unit And Behavioural) is resolved. test_lint_python_runs_interrogate_over_the_documented_scope runs make lint-python through a controlled uv shim. It requires exactly one Interrogate invocation with:

    • the expanded PYTHON_BASELINE;
    • the expanded interrogate==<version> package pin;
    • --fail-under 100;
    • every --exclude <spelling-helper-file> pair;
    • .github/scripts, scripts, and tests/workflow_contracts.

This is a boundary test, not only a recipe text check. It will fail if Makefile expansion removes, changes, or reorders the Interrogate arguments.

The current GitHub build-test check is successful. No remaining work or follow-up GitHub issue is required for these two failures.

You are interacting with an AI system.

codescene-access[bot]

This comment was marked as outdated.

@leynos

leynos commented Sep 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Ensure that this is validated against the current version of the codegraph.

If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message in a code block that I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced.

tests/workflow_contracts/nextest_child_cargo_group_test.py

Comment on lines +158 to +202

def _build_capable_test_names(source: str) -> set[str]:
    """Return tests reaching a direct or helper-mediated Cargo build command."""
    executable_source = mask_non_code(source, RETAINED_RUST_LITERALS)
    functions = _rust_functions(executable_source)
    wrappers = _cargo_wrappers(functions)
    operation_constants = _operation_constants(executable_source)
    build_capable = {
        name
        for _, _, name, body in functions
        if _has_build_capable_cargo_command(body, wrappers, operation_constants)
        or _calls_build_helper(body)
    }

    while True:
        helper_names = {name for _, _, name, _ in functions if name in build_capable}
        callers = {
            name
            for _, _, name, body in functions
            if any(
                helper_name != "build" and re.search(rf"\b{helper_name}\s*\(", body)
                for helper_name in helper_names
            )
        }
        fixture_users = {
            name
            for attributes, signature, name, body in functions
            if "#[test]" in attributes or "#[rstest]" in attributes
            for helper_name in helper_names
            if any(
                "#[fixture]" in helper_attributes and helper_name in signature + body
                for helper_attributes, _, fixture_name, _ in functions
                if fixture_name == helper_name
            )
        }
        expanded = build_capable | callers | fixture_users
        if expanded == build_capable:
            break
        build_capable = expanded

    return {
        name
        for attributes, _, name, _ in functions
        if name in build_capable
        and ("#[test]" in attributes or "#[rstest]" in attributes)
    }

❌ New issue: Complex Method
_build_capable_test_names has a cyclomatic complexity of 17, threshold = 9

@coderabbitai

This comment was marked as resolved.

Pin Interrogate 1.7.0 in the Makefile and run it against the
repository-owned Python infrastructure at 100% documented coverage.

Preserve the estate-synchronised spelling helper exemption while
documenting every remaining missing constructor and nested helper.

Protect the pin and lint integration with workflow contract coverage.
Select the repository baseline when creating Interrogate's pinned tool
environment, so the docstring gate parses the same Python syntax locally
and in CI.

Exercise the expanded `lint-python` boundary through a controlled `uv`
shim, preserving its threshold, spelling-helper exclusions, and owned
source scope. Refresh the generated spelling policy required by the
current estate dictionary.
Keep the focused Makefile contract readable under the repository's Python
lint policy without changing the asserted Interrogate invocation.
Declare the immutable command and scope data explicitly so the workflow
contract communicates its stable tuple shapes.
Describe the error and test-double constructor contracts with NumPy-style
parameter sections while preserving the module-size policy.
Select CmdMox's `.cmd` launcher on Windows and verify both platform
launcher forms. Clarify the coverage-output error parameter contracts.
Use valid NumPy parameter fields while keeping the cargo adapter module
within its documented size limit.
Keep the coverage lane responsive by serializing only tests that launch build-capable child Cargo commands. Preserve normal Nextest concurrency, existing private target isolation, and immediate subprocess output.
Recognize restricted-visibility and asynchronous Rust test declarations so build-capable child Cargo commands cannot evade the serialized Nextest group.
leynos and others added 5 commits September 17, 2026 15:52
Recognize indented Rust helpers and validate Nextest overrides through the shared structural TOML helper.
Describe the explicit Cargo executable and preserve the adapter measurement exception contract.
Keep nested-Cargo discovery from accepting function-like comments or literals while retaining the command tokens needed for policy classification.
Distinguish Rust character literals from lifetimes and labels, and document the source-mask helper contract.
Extract fixed-point discovery helpers to keep the workflow contract\nwithin the repository complexity budget while preserving direct, helper,\nand fixture-mediated nested Cargo detection.\n\nMove Rust syntax masking regression cases into a focused companion\ncontract module, add multi-hop propagation coverage, and retain the\nspelling-helper and Interrogate documentation requirements after rebase.
@leynos
leynos force-pushed the issue-676-add-pinned-interrogate-docstring-coverage-gate-for-python-infrastructure branch from 1a95c08 to 8c21da5 Compare September 17, 2026 14:13
@leynos
leynos merged commit c32f7f2 into main Sep 17, 2026
22 checks passed
@leynos
leynos deleted the issue-676-add-pinned-interrogate-docstring-coverage-gate-for-python-infrastructure branch September 17, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue A pull request originating from an issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add pinned Interrogate docstring-coverage gate for Python infrastructure

1 participant