Skip to content

Pin lockfile discovery and validation I/O decisions (#83) - #125

Merged
leynos merged 17 commits into
mainfrom
issue-83-remove-rglob-pass
Jul 26, 2026
Merged

Pin lockfile discovery and validation I/O decisions (#83)#125
leynos merged 17 commits into
mainfrom
issue-83-remove-rglob-pass

Conversation

@leynos

@leynos leynos commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #83

  • The redundant rglob pass flagged in the issue no longer exists: discover_tracked_lockfiles already relies solely on git ls-files plus the target/ filter and Cargo.toml adjacency check (landed with the lockfile-refresh rework in PR Refresh stale Cargo lockfiles before publish preflight (#61) #75's follow-ups). This PR completes the issue's remaining item: the evaluation of short-circuiting _validate_lockfile_freshness on the first stale lockfile.
  • Decision: keep classifying every tracked lockfile. The aggregated error lists each stale lockfile with its repair command so operators fix the whole workspace in one pass; the extra read-only cargo metadata --locked probes are cheap compared with replaying the pre-flight once per lockfile. Unexpected failures still raise immediately.
  • Rationale recorded in _collect_stale_lockfiles and docs/developers-guide.md.

Testing

  • New regression test pins that all lockfiles are probed even when the first is already stale, and that the error lists every stale path.
  • New regression test (test_discover_tracked_lockfiles_ignores_untracked_on_disk) pins the simpler, git-driven discovery path: an untracked Cargo.lock sitting on disk beside a valid manifest is never returned, proving discovery consults git ls-files alone and does not glob the tree (the redundant rglob pass is gone).
  • make check-fmt, make lint, make typecheck, and make test (696 passed) all green after rebasing onto current main.
  • coderabbit review --agent: 0 findings.

🤖 Generated with Claude Code

Summary by Sourcery

Document and test the decision to always classify all tracked lockfiles during publish preflight validation so that errors report every stale lockfile at once.

Documentation:

  • Clarify developer documentation to explain why lockfile validation does not short-circuit on the first stale lockfile and instead reports all stale lockfiles.

Tests:

  • Add regression test ensuring lockfile validation probes all tracked lockfiles and reports each stale path in the aggregated error.

References

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review 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: Pro Plus

Run ID: 1280eff5-995b-47fb-9450-e7402c12fa55

📥 Commits

Reviewing files that changed from the base of the PR and between 909a9d1 and 4490a52.

📒 Files selected for processing (1)
  • Makefile
🔗 Linked repositories identified

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

  • leynos/cmd-mox (auto-detected)
  • leynos/cuprum (auto-detected)
  • leynos/shared-actions (auto-detected)

Summary

Completes issue #83’s lockfile validation decision by checking every tracked Cargo.lock, aggregating stale-lockfile repair commands, and failing immediately on unexpected errors.

Changes

  • Added unit, property-based, and BDD coverage for lockfile classification, aggregation, and error short-circuiting.
  • Added discovery coverage confirming untracked on-disk lockfiles are ignored.
  • Updated developer, user, and design documentation to describe the behaviour.
  • Pinned ty through uv, pinned the coverage upload action, and updated typo handling.

Validation

Formatting, linting, type checking, and tests pass, with 696 tests passing.

Walkthrough

Clarify that publish pre-flight classifies every tracked Cargo.lock, aggregates stale-lockfile diagnostics, and still aborts on unexpected errors. Expand unit and BDD coverage, pin ty through uv, and update spelling configuration.

Changes

Lockfile validation clarification

Layer / File(s) Summary
Git-based lockfile discovery
tests/unit/test_lockfile.py
Verify that discovery returns only git-tracked lockfiles, excluding untracked files present on disk.
Full lockfile freshness classification
lading/commands/publish_preflight.py, tests/unit/publish/test_preflight_lockfile_validation.py, docs/developers-guide.md, docs/users-guide.md, docs/lading-design.md
Document and test validation of every tracked lockfile, aggregation of all stale paths and repair commands, and immediate abort on the first unexpected error.
Aggregated publish pre-flight scenario
tests/bdd/features/cli.feature, tests/bdd/steps/test_publish_given_steps.py, tests/bdd/steps/test_common_steps.py
Exercise nested stale tracked lockfiles and verify that publish reports every stale path and its repair command.

Tooling maintenance

Layer / File(s) Summary
Pinned type-check tooling
Makefile, .github/workflows/ci.yml
Run ty at version 0.0.32 through uv in local type-checking and CI setup, and pin the coverage upload action.
Spelling and rollout parsing
typos.toml, scripts/typos_rollout.py
Add polymerisable word mappings and use validated values before sorting and deduplicating rollout entries.

Sequence Diagram(s)

sequenceDiagram
  participant Publish as lading publish
  participant Discovery as discover_tracked_lockfiles
  participant Preflight as _validate_lockfile_freshness
  participant Cargo as cargo metadata --locked
  participant Error as PublishPreflightError

  Publish->>Discovery: Enumerate git-tracked Cargo.lock files
  Discovery-->>Preflight: Return ordered lockfile paths
  loop Each tracked lockfile
    Preflight->>Cargo: Check freshness for adjacent Cargo.toml
    Cargo-->>Preflight: Fresh, stale, or unexpected error
  end
  Preflight->>Error: Aggregate stale paths and repair commands
  Error-->>Publish: Exit with diagnostic
Loading

Possibly related PRs

Suggested labels: Issue

Suggested reviewers: codescene-delta-analysis, codescene-access

Poem

Every lockfile joins the queue,
Fresh or stale, each path comes through.
Errors stop the ordered flight,
Repairs gather in one light.
Git keeps untracked files from view.

🚥 Pre-merge checks | ✅ 19 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also changes Makefile, CI, typos config, and a typing helper that are unrelated to issue #83. Split those unrelated edits into separate PRs or remove them from this issue-focused change.
✅ Passed checks (19 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the lockfile discovery and validation work and includes the linked issue reference.
Description check ✅ Passed The description is on-topic and summarises the lockfile validation and discovery changes.
Linked Issues check ✅ Passed The PR covers issue #83's validation behaviour and test/doc updates, and the discovery work is reflected in tests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Testing (Overall) ✅ Passed PASS: New tests exercise real behaviour—full stale-lockfile aggregation, abort-on-error semantics, and git-driven discovery that excludes an untracked on-disk lockfile.
User-Facing Documentation ✅ Passed docs/users-guide.md now documents the changed publish pre-flight behaviour, including checking all tracked Cargo.lock files and listing per-file repairs; no parallel locale docs exist.
Developer Documentation ✅ Passed PASS: docs/developers-guide.md and docs/lading-design.md record the lockfile-validation decision, and docs/users-guide.md/roadmap.md stay in sync.
Module-Level Documentation ✅ Passed Every changed Python module starts with a module docstring, and the key modules spell out purpose and relationships (pre-flight, test fixtures, CLI steps, typos config).
Testing (Unit And Behavioural) ✅ Passed PASS: Unit tests cover fresh/stale/error paths and invariants, and the BDD scenario drives lading publish via subprocess at the CLI boundary, not a private helper.
Testing (Property / Proof) ✅ Passed Hypothesis property tests cover fresh/stale/error orderings and verify every tracked lockfile is probed without short-circuiting.
Testing (Compile-Time / Ui) ✅ Passed Pass: no Rust/TS compile-time boundary exists, and the user-facing stale-lockfile message is snapshot-tested while BDD checks stay focused.
Unit Architecture ✅ Passed PASS: The PR keeps lockfile discovery and validation behind an injected repository port, and the new tests exercise only those explicit seams.
Domain Architecture ✅ Passed No domain-layer coupling was introduced: the lockfile code already uses a repository port, and the PR changes are docs/tests plus a Makefile tweak.
Observability ✅ Passed PASS: lockfile discovery/validation already logs decision points and emits bounded outcome/duration metrics; stale errors aggregate paths and repair commands.
Security And Privacy ✅ Passed PASS: Changes only aggregate stale Cargo.lock paths and add tests/docs; no secrets, auth, permissions, or unsafe input handling introduced.
Performance And Resource Use ✅ Passed Accept the trade-off: discovery stays single-pass, stale-lockfile aggregation is linear and bounded by tracked lockfiles, and tests/docs pin the no-short-circuit behaviour.
Concurrency And State ✅ Passed PASS: The PR keeps lockfile validation synchronous and instance-local; tests use per-test fixtures, with no shared mutability, async work, or interleaving hazards introduced.
Architectural Complexity And Maintainability ✅ Passed PASS: runtime code keeps the existing explicit repository port and simple loop; the PR adds docs and tests only, with no new layer, registry, or dependency.
Rust Compiler Lint Integrity ✅ Passed No Rust files change in the PR range, and no new #[allow]/#[expect] suppressions or clone-heavy Rust edits appear.
📋 Issue Planner

Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).

View plan for ticket: #83

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-83-remove-rglob-pass

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

@sourcery-ai

sourcery-ai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

Ensure lockfile freshness validation always classifies all tracked lockfiles (rather than short-circuiting on the first stale one), document this I/O decision, and pin the behavior with a regression test.

Flow diagram for lockfile freshness validation classification behavior

flowchart TD
  A[Start lockfile freshness validation] --> B[discover_tracked_lockfiles]
  B --> C{Next tracked lockfile?}
  C -->|No| D{Any stale lockfiles recorded?}
  C -->|Yes| E[cargo metadata --locked]
  E --> F{Result for lockfile}
  F -->|Stale| G[Record lockfile as stale]
  F -->|Fresh| C
  F -->|Unexpected failure| H[Raise PublishPreflightError immediately]
  G --> C
  D -->|Yes| I[Raise aggregated error listing all stale lockfiles and repair commands]
  D -->|No| J[Proceed with cargo check/test pre-flight]
Loading

File-Level Changes

Change Details Files
Pin _validate_lockfile_freshness behavior to always probe every tracked lockfile and report all stale ones in a single aggregated error.
  • Add a regression test that mocks tracked lockfiles discovery and freshness validation to ensure all lockfiles are probed even when the first is stale.
  • Verify that _validate_lockfile_freshness raises a preflight error listing every stale lockfile path and that each lockfile’s adjacent Cargo.toml is probed.
tests/unit/publish/test_preflight_lockfile_validation.py
Document the decision to fully classify lockfiles and the rationale for not short-circuiting on the first stale result.
  • Clarify _collect_stale_lockfiles docstring to describe probing every tracked lockfile, the aggregated error behavior, and the cost tradeoff versus replaying preflight per lockfile.
  • Update the developers guide to explain why lockfile validation does not short-circuit and how that supports single-pass workspace repair.
lading/commands/publish_preflight.py
docs/developers-guide.md

Assessment against linked issues

Issue Objective Addressed Explanation
#83 Replace the redundant rglob pass in discover_tracked_lockfiles with direct reliance on git ls-files plus the target/ filter and Cargo.toml adjacency check. The PR does not modify discover_tracked_lockfiles or any related discovery logic; it only adds a test, a code comment, and documentation for lockfile validation behavior. Although the PR description notes that this change already exists on main from earlier work, this specific PR does not implement it.
#83 Evaluate whether _validate_lockfile_freshness should short-circuit after the first stale lockfile and implement the chosen behavior (including documenting the decision).
#83 Update unit tests to reflect the simpler lockfile discovery/validation path. The new regression test covers the decision to classify every lockfile (validation behavior), but there are no changes to tests specifically reflecting the simpler discovery path or the removal of the rglob pass.

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

@leynos
leynos force-pushed the issue-83-remove-rglob-pass branch from 8dbe8ec to 96e5ace Compare July 8, 2026 17:57
codescene-access[bot]

This comment was marked as outdated.

@leynos

leynos commented Jul 8, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai looking at the codebase, is this concern still relevant or is it made redundant by the PR's findings?

Assessment against linked issues

Issue Objective Addressed Explanation
#83 Replace the redundant rglob pass in discover_tracked_lockfiles with direct reliance on git ls-files plus the target/ filter and Cargo.toml adjacency check. The PR does not modify discover_tracked_lockfiles or any related discovery logic; it only adds a test, a code comment, and documentation for lockfile validation behavior. Although the PR description notes that this change already exists on main from earlier work, this specific PR does not implement it.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n "discover_tracked_lockfiles" -A 30 | head -100

Length of output: 229


🏁 Script executed:

#!/bin/bash
fd -e py | xargs grep -l "discover_tracked_lockfiles" 2>/dev/null
echo "---"
rg -n "rglob" --type py
echo "---"
rg -n "def discover_tracked_lockfiles" -A 40 --type py

Length of output: 666


🏁 Script executed:

#!/bin/bash
cat -n lading/commands/lockfile.py

Length of output: 9679


@leynos, confirmed by reading lading/commands/lockfile.py on this branch: discover_tracked_lockfiles (Lines 119–170) issues a single git ls-files "**/Cargo.lock" "Cargo.lock" call, then filters candidates through _lockfiles_with_manifests, which drops anything under a target/ directory and requires an adjacent Cargo.toml. No rglob call exists anywhere in the file. The module docstring (Lines 8–11) states this explicitly as the current design.

Treat the earlier assessment table as stale on this point. The rglob redundancy from #83 is already resolved on main; this PR correctly scopes itself to the remaining item — documenting and testing the "classify every lockfile, don't short-circuit" decision. Close out that row of the table rather than treating it as an open gap in this PR.

codescene-access[bot]

This comment was marked as outdated.

@lodyai
lodyai Bot force-pushed the issue-83-remove-rglob-pass branch from 48655ba to 3aef8d2 Compare July 8, 2026 21:20
codescene-access[bot]

This comment was marked as outdated.

@pandalump
pandalump marked this pull request as ready for review July 9, 2026 08:52
@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lodyai
lodyai Bot force-pushed the issue-83-remove-rglob-pass branch from 3aef8d2 to 8cbe18d Compare July 9, 2026 13:01
codescene-access[bot]

This comment was marked as outdated.

@leynos

leynos commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot added the Issue label Jul 9, 2026

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

🤖 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 `@tests/unit/publish/test_preflight_lockfile_validation.py`:
- Around line 223-226: The test in test_preflight_lockfile_validation uses bare
asserts, so update each assertion in the preflight lockfile validation test to
include a clear failure message. Add messages to the assertions comparing probed
paths and checking each lockfile path in the exception message, using the
existing test variables like probed, lockfiles, and excinfo to keep the failure
output actionable.

In `@tests/unit/test_lockfile.py`:
- Around line 133-142: Add failure messages to the stub runner’s bare assertions
in the test helper so mismatches are diagnosable. In runner, update the checks
on command and cwd to use assertion messages instead of plain asserts, keeping
the existing behavior while making failures clearer.
🪄 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: 4d68175f-6ca7-42b1-bca1-f59f48e601dd

📥 Commits

Reviewing files that changed from the base of the PR and between f6c3489 and 8cbe18d.

📒 Files selected for processing (4)
  • docs/developers-guide.md
  • lading/commands/publish_preflight.py
  • tests/unit/publish/test_preflight_lockfile_validation.py
  • tests/unit/test_lockfile.py
🔗 Linked repositories identified

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

  • leynos/cmd-mox (auto-detected)
  • leynos/shared-actions (auto-detected)

Comment thread tests/unit/publish/test_preflight_lockfile_validation.py Outdated
Comment thread tests/unit/test_lockfile.py
@lodyai
lodyai Bot force-pushed the issue-83-remove-rglob-pass branch from 8cbe18d to 731e458 Compare July 14, 2026 01:25
codescene-access[bot]

This comment was marked as outdated.

@leynos

leynos commented Jul 14, 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 I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced.

tests/unit/publish/test_preflight_lockfile_validation.py

Comment on file

        match="failed to download registry index",
    ):
        publish_preflight._validate_lockfile_freshness(tmp_path, repository=repository)

❌ New issue: Code Duplication
The module contains 2 functions with similar structure: test_validate_lockfile_freshness_error_snapshot,test_validate_lockfile_freshness_reports_stale_lockfiles

@leynos

leynos commented Jul 14, 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 documentation and validation coverage as in scope).

#83 Update unit tests to reflect the simpler lockfile discovery/validation path. ❌ The new regression test covers the decision to classify every lockfile (validation behavior), but there are no changes to tests specifically reflecting the simpler discovery path or the removal of the rglob pass.

@coderabbitai

This comment was marked as resolved.

@leynos

leynos commented Jul 14, 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 documentation and validation coverage as in scope).

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Testing (Property / Proof) ⚠️ Warning Treat the all-lockfiles classification as a sequence invariant; the PR only pins one 3-lockfile example, so add property-based coverage over varying sequences and outcomes. Add a Hypothesis test for _collect_stale_lockfiles/_validate_lockfile_freshness that varies lockfile counts, order, and stale/failure outcomes; keep the regression example.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "=== lockfile.py ==="
cat -n lading/commands/lockfile.py
echo "=== test_lockfile.py ==="
cat -n tests/unit/test_lockfile.py
echo "=== rglob search ==="
rg -n "rglob" --type py
echo "=== issue 83 ==="
gh issue view 83 --repo leynos/lading --json title,body,state,comments 2>/dev/null || true

Length of output: 45267


@leynos, yes — that check is now resolved.

tests/unit/test_lockfile.py Lines 113–153 add test_discover_tracked_lockfiles_ignores_untracked_on_disk, which pins the git-driven discovery path directly: it places an untracked Cargo.lock on disk beside a valid Cargo.toml, stubs git ls-files to omit it, and asserts discover_tracked_lockfiles excludes it — proving no filesystem walk (rglob or otherwise) occurs and discovery relies solely on git output. The docstring on that test explicitly references issue #83 and the removed rglob pass.

This sits alongside the pre-existing test_discover_tracked_lockfiles_filters_missing_manifests (Lines 68–110), test_discover_tracked_lockfiles_accepts_manifest_probe (Lines 156–184), and the hypothesis-based test_discover_tracked_lockfiles_invariants (Lines 423–445), which together exercise git ls-files, the target/ exclusion, and the Cargo.toml adjacency check exhaustively. I also re-confirmed rg -n "rglob" --type py returns no hits anywhere in the repository on this branch.

So the earlier finding — "no changes to tests specifically reflecting the simpler discovery path" — no longer holds. Treat that check as satisfied; no further work is required for issue #83 in this PR.

[resolve]

@leynos

leynos commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@leynos

leynos commented Jul 22, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Have the following now been resolved?

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Developer Documentation ⚠️ Warning Keep docs in sync: docs/lading-design.md still misstates that _build_stale_lockfile_message composes a PublishPreflightError; the code returns str and _validate_lockfile_freshness raises it. Rewrite the design note to match the code: say _build_stale_lockfile_message builds the message, and _validate_lockfile_freshness raises PublishPreflightError with it.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== production symbols ==="
ast-grep outline lading/commands/publish_preflight.py \
  --items all \
  --match '_build_stale_lockfile_message|_validate_lockfile_freshness' \
  --view expanded

echo "=== production implementations ==="
rg -n -A75 -B8 \
  '^def _build_stale_lockfile_message|^def _validate_lockfile_freshness' \
  lading/commands/publish_preflight.py

echo "=== design-document references ==="
rg -n -i -C5 \
  '_build_stale_lockfile_message|_validate_lockfile_freshness|PublishPreflightError|stale lockfile' \
  docs/lading-design.md

Length of output: 7322


@leynos, mark this warning as resolved.

docs/lading-design.md Lines 511–515 now matches the current implementation precisely:

  • _build_stale_lockfile_message builds and returns the diagnostic str (lading/commands/publish_preflight.py Lines 238–254).
  • _validate_lockfile_freshness receives that message and raises PublishPreflightError(message) (lading/commands/publish_preflight.py Lines 276–278).

No further documentation change or follow-up issue is required.

[resolve]

The property test test_validate_lockfile_freshness_probes_every_lockfile_
until_error carried a nested if/else with two comprehensions and two
assertion loops, tripping the cyclomatic-complexity review check. Extract
the no-error branch into _assert_no_error_outcomes and the error-abort
branch into _assert_error_aborts_classification, leaving the test to
locate the first error and dispatch. Assertions, diagnostic messages, and
the Hypothesis strategy/settings are unchanged, so fresh-only, stale-only,
mixed, and first-error-abort sequences keep their coverage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
codescene-access[bot]

This comment was marked as outdated.

@leynos

leynos commented Jul 22, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

`_string_list` returned `tuple(sorted(set(value)))` where `value` narrows
only to `list[object]` after the `isinstance(value, list)` guard; the
runtime `all(isinstance(item, str) ...)` check does not narrow the element
type, so `set(value)` is `set[object]` and `sorted` rejects it under a
newer `ty`. Build a `list[str]` via an isinstance-narrowing comprehension
so the sort key type is provable.

The diagnostic slipped in because both the Makefile and CI installed `ty`
unpinned (latest). Pin it: add `TY_VERSION` and invoke the checker via
`uv tool run ty@$(TY_VERSION)` (matching the ruff/typos pattern, so local
runs are pinned too), drop the now-unused PATH `ty` prerequisite, and pin
`uv tool install ty==0.0.32` in CI with a sync comment. Makefile and CI
now agree on the ty version and must be bumped together.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

- CI: drop the duplicate `uv tool install ty==0.0.32`. `make typecheck` now
  runs `uv tool run ty@$(TY_VERSION)`, so the Makefile's TY_VERSION is the
  single source of truth and a separate CI pin could only drift.
- typos_rollout._string_list: the isinstance guard already proves every
  element is a str, so cast the validated list directly instead of filtering
  it a second time; keeps the sort key type provable under ty without the
  redundant pass. TypeError behaviour is unchanged.
- Pin the remaining tag-referenced actions to immutable commit SHAs (verified
  against upstream tags): astral-sh/setup-uv@37802adc (v7, = v7.6.0) and
  actions/upload-artifact@ea165f8d (v4), each retaining its version comment.
- Correct the pkg-index-collision comment to reference the list strategy's
  max_size, not max_examples.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

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

🤖 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 @.github/workflows/ci.yml:
- Around line 25-35: Update the “Install CLI tools” comment in the workflow to
state that TY_VERSION in the Makefile is the sole ty version declaration and
should be updated there. Remove wording that implies a separate CI pin or
requires synchronizing two locations; leave the installation commands and ruff
guidance unchanged.

In `@scripts/typos_rollout.py`:
- Around line 57-60: Inline the single-use strings assignment in the return
expression of the surrounding function, passing typ.cast("list[str]", value)
directly to set and preserving the existing sorting and tuple conversion.
🪄 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: 3dcdef0d-c402-4413-8158-5c1154696fc4

📥 Commits

Reviewing files that changed from the base of the PR and between 1614d41 and a221eb8.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • scripts/typos_rollout.py
  • tests/unit/publish/test_preflight_lockfile_validation.py
🔗 Linked repositories identified

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

  • leynos/cmd-mox (auto-detected)
  • leynos/cuprum (auto-detected)
  • leynos/shared-actions (auto-detected)

Comment thread .github/workflows/ci.yml
Comment thread scripts/typos_rollout.py Outdated
@leynos

leynos commented Jul 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume@coderabbitai Have the following now been resolved?

.github/workflows/ci.yml (1)

25-25: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Pin the workflow actions to commit SHAs. Replace astral-sh/setup-uv@v7 with astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7 and actions/upload-artifact@v4 with actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 in .github/workflows/ci.yml.

🤖 Detailed instructions

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

In @.github/workflows/ci.yml at line 25, Pin the workflow actions in the CI
configuration to immutable commit SHAs: update astral-sh/setup-uv to
37802adc94f370d6bfd71619e3f0bf239e1f3b78 while retaining the v7 version comment,
and update actions/upload-artifact to ea165f8d65b6e75b540449e92b4886f43607fa02
while retaining the v4 comment.

Source: Linters/SAST tools

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

ast-grep outline .github/workflows/ci.yml --items all --view expanded || true
echo "=== Relevant workflow action references ==="
rg -n -C 3 '^\s*uses:\s*(astral-sh/setup-uv|actions/upload-artifact)@' .github/workflows/ci.yml
echo "=== All external action references ==="
rg -n '^\s*uses:\s*[^[:space:]]+@' .github/workflows/ci.yml

Length of output: 1562


@leynos, mark this finding as resolved.

.github/workflows/ci.yml now contains both requested immutable pins with their version comments retained:

  • Line 25: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
  • Line 91: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4

No remaining work is required for this specific SAST finding. The workflow also contains other version-tagged actions, but they are outside the explicitly reported replacements and must be tracked by a separate finding if the security policy requires pinning every third-party action.

✅ Action performed

Reviews resumed.

- ci.yml: reword the "Install CLI tools" comment so it names the Makefile's
  TY_VERSION as the sole ty version declaration to update, dropping the
  reference to a (now non-existent) duplicate CI pin. Install commands and the
  ruff guidance are unchanged.
- typos_rollout._string_list: inline the single-use `strings` cast directly
  into the return expression; behaviour and the type-narrowing cast are
  unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

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

♻️ Duplicate comments (1)
.github/workflows/ci.yml (1)

30-32: 📐 Maintainability & Code Quality | 🟡 Minor

Synchronize the TY pin documentation.

Update the Makefile comment referenced here: it still describes a separate uv tool install ty==... pin and instructs maintainers to update both sites, contradicting this workflow’s claim that TY_VERSION is the sole declaration. Remove the stale wording and document uv tool run ty@$(TY_VERSION) as the only source.

🤖 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 @.github/workflows/ci.yml around lines 30 - 32, Update the referenced TY pin
comment in the Makefile to remove the stale separate-installation and
dual-update instructions. Document that make typecheck invokes ty via uv tool
run ty@$(TY_VERSION) and that TY_VERSION is the sole version declaration.
🤖 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.

Duplicate comments:
In @.github/workflows/ci.yml:
- Around line 30-32: Update the referenced TY pin comment in the Makefile to
remove the stale separate-installation and dual-update instructions. Document
that make typecheck invokes ty via uv tool run ty@$(TY_VERSION) and that
TY_VERSION is the sole version declaration.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d7427885-0801-4b95-8d3b-78a3b91f6e72

📥 Commits

Reviewing files that changed from the base of the PR and between 1614d41 and 909a9d1.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • scripts/typos_rollout.py
  • tests/unit/publish/test_preflight_lockfile_validation.py
🔗 Linked repositories identified

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

  • leynos/cmd-mox (auto-detected)
  • leynos/cuprum (auto-detected)
  • leynos/shared-actions (auto-detected)

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

The comment still referenced the `uv tool install ty==` CI step (removed
when ty moved to `uv tool run ty@$(TY_VERSION)`) and instructed bumping two
sites. Restate it: `make typecheck` invokes ty via the pinned uv tool run,
TY_VERSION is the sole declaration, and CI installs no separate ty.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 merged commit 175c306 into main Jul 26, 2026
7 checks passed
@leynos
leynos deleted the issue-83-remove-rglob-pass branch July 26, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eliminate redundant rglob I/O pass in discover_tracked_lockfiles

2 participants