Skip to content

static: ban git submodules org-wide (no-submodules check) - #256

Merged
thedavidmeister merged 5 commits into
mainfrom
ci/no-submodules
Jul 5, 2026
Merged

thedavidmeister merged 5 commits into
mainfrom
ci/no-submodules

Conversation

@thedavidmeister

@thedavidmeister thedavidmeister commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Migrates the rain-org-health scan's advisory submodules signal into a hard static gate — implemented in Rust as the first subcommand of the #255 binary, not more bash:

  • rainix-static/ crate (std-only): rainix-static no-submodules [dir] with two detection legs — ROOT .gitmodules (git only reads the root one; vendored copies are inert and pass) + any committed gitlink entry (git ls-files -s mode 160000, catching ghost pointers whose .gitmodules was deleted). Subcommand dispatch is ready for the remaining Convert the static-check shell libraries to Rust #255 migrations (no-ignored-tests, no-custom-natspec, flake-pin guard).
  • Five unit tests mirroring the originally-proposed BATS cases, running INSIDE the nix build (doCheck, nativeCheckInputs = git) — a broken check cannot ship as a cached binary.
  • Flake package packages.rainix-static (cachix-cached); the composite runs nix run github:rainlanguage/rainix/${RAINIX_SHA:-main}#rainix-static -- no-submodules . per the org flake-pin convention (RAINIX_SHA is exported by the calling reusables).
  • Wired into BOTH rainix-sol-static and rainix-rs-static; smoke-verified clean against rainix itself.

Blast radius — please confirm before merging. Repos currently carrying .gitmodules that will go static-red on their next CI run: cyclofinance/cyclo.site, cyclofinance/cyclo.sol, cyclofinance/cyclo.subgraph, cyclofinance/rflr-nix, rainlanguage/curve, rainlanguage/flow, rainlanguage/interpreter-subgraph, rainlanguage/orderbook-subgraph. cyclo.site alone has ~27 vetted PRs in flight that would red on retrigger — that pressure is the point of the soldeer migration, but the wave is yours to time.

Follow-ups once merged: drop the redundant submodules signal from the org-health scan; migrate the three existing bash checks into the binary (#255).

🤖 Generated with Claude Code

Root .gitmodules or any committed gitlink (mode 160000) fails sol- and
rs-static. Deps come from soldeer/npm/nix. BATS-covered lib script is
the single source of truth; the composite sources it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@thedavidmeister thedavidmeister self-assigned this Jul 5, 2026
@coderabbitai

coderabbitai Bot commented Jul 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@thedavidmeister, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 21527564-3463-4dc7-ad19-8e3c40e09df7

📥 Commits

Reviewing files that changed from the base of the PR and between 81fda7d and 49cee7c.

⛔ Files ignored due to path filters (1)
  • rainix-static/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • .github/actions/no-custom-natspec/action.yml
  • .github/actions/no-ignored-tests/action.yml
  • .github/actions/no-submodules/action.yml
  • REUSE.toml
  • flake.nix
  • rainix-static/.gitignore
  • rainix-static/Cargo.toml
  • rainix-static/src/main.rs
📝 Walkthrough

Walkthrough

Adds a check_no_submodules shell function that detects .gitmodules files and committed gitlink entries, a composite GitHub Action wrapping it, workflow steps invoking that action in two static-check pipelines, a Bats test suite, and a flake.nix update to run the new tests.

Changes

No-submodules CI Enforcement

Layer / File(s) Summary
Submodule detection logic
lib/no-submodules.sh
Adds check_no_submodules(), which checks for a root .gitmodules file and committed gitlink entries (mode 160000), prints findings, and returns a nonzero status on any offenders.
Composite action and workflow wiring
.github/actions/no-submodules/action.yml, .github/workflows/rainix-rs-static.yaml, .github/workflows/rainix-sol-static.yaml
Adds a composite action that sources the script and runs check_no_submodules ., and wires that action as an early step in the rainix-rs-static and rainix-sol-static workflows.
Test suite and task wiring
test/bats/task/no-submodules.test.bats, flake.nix
Adds a Bats suite covering clean repos, root .gitmodules, gitlink entries, vendored .gitmodules, and missing .git cases, and adds the new test file to the default-shell-test task's bats invocations.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Workflow as rainix-*-static.yaml
  participant Action as no-submodules action
  participant Script as no-submodules.sh
  Workflow->>Action: uses no-submodules@main
  Action->>Script: source and call check_no_submodules .
  Script-->>Action: exit status (clean or fail)
  Action-->>Workflow: step result
Loading

Related Issues: None specified

Related PRs: None specified

Suggested labels: ci, tests

Suggested reviewers: None specified

🐰 A gitlink lurking, sly and small,
Now caught by scripts that check them all,
No modules hidden, none allowed,
Bats confirm it, clean and proud,
CI hops on, guarding every wall.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding an org-wide static check to ban Git submodules.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/no-submodules

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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

🧹 Nitpick comments (1)
lib/no-submodules.sh (1)

21-22: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Filenames containing spaces get truncated in the offender list.

awk default field splitting treats both spaces and tabs as delimiters, so $4 only prints up to the first space in a path with spaces in it — detection (fail=1) still works correctly, only the printed path is garbled. Low-risk edge case given typical dependency paths.

♻️ Proposed fix using tab-based field split
-  gitlinks=$(git -C "$dir" ls-files -s 2>/dev/null | awk '$1 == "160000" { print "  " $4 }')
+  gitlinks=$(git -C "$dir" ls-files -s 2>/dev/null | awk -F'\t' '$1 ~ /^160000 /{ print "  " $2 }')
🤖 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 `@lib/no-submodules.sh` around lines 21 - 22, The offender list in the
no-submodules check can truncate paths with spaces because awk is using default
whitespace splitting; update the gitlinks pipeline in no-submodules.sh so the
path extraction uses tab-based parsing instead of $4 from space-delimited
fields. Keep the existing fail detection behavior, but adjust the awk logic in
the gitlinks assignment to preserve the full pathname when printing submodule
offenders.
🤖 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.

Nitpick comments:
In `@lib/no-submodules.sh`:
- Around line 21-22: The offender list in the no-submodules check can truncate
paths with spaces because awk is using default whitespace splitting; update the
gitlinks pipeline in no-submodules.sh so the path extraction uses tab-based
parsing instead of $4 from space-delimited fields. Keep the existing fail
detection behavior, but adjust the awk logic in the gitlinks assignment to
preserve the full pathname when printing submodule offenders.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 89472221-9fd0-4683-9bb5-de9e94c6980d

📥 Commits

Reviewing files that changed from the base of the PR and between dfe2472 and 81fda7d.

📒 Files selected for processing (6)
  • .github/actions/no-submodules/action.yml
  • .github/workflows/rainix-rs-static.yaml
  • .github/workflows/rainix-sol-static.yaml
  • flake.nix
  • lib/no-submodules.sh
  • test/bats/task/no-submodules.test.bats

thedavidmeister and others added 3 commits July 5, 2026 01:49
Births the rainix-static crate (#255): checks as
subcommands, std-only, unit tests mirroring the retired BATS cases
(root .gitmodules, ghost gitlink 160000, vendored-inert, non-git file
leg), run inside the nix build via doCheck. The composite nix-runs the
cachix-cached package at the pinned RAINIX_SHA; bash lib and BATS
retired.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The all-files yamlfmt hook reflows one inherited multiline description
per run; fold every action.yml description in one pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@thedavidmeister
thedavidmeister merged commit 46aa235 into main Jul 5, 2026
13 checks passed
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment:

S/M/L PR Classification Guidelines:

This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed.

Small (S)

Characteristics:

  • Simple bug fixes, typos, or minor refactoring
  • Single-purpose changes affecting 1-2 files
  • Documentation updates
  • Configuration tweaks
  • Changes that require minimal context to review

Review Effort: Would have taken 5-10 minutes

Examples:

  • Fix typo in variable name
  • Update README with new instructions
  • Adjust configuration values
  • Simple one-line bug fixes
  • Import statement cleanup

Medium (M)

Characteristics:

  • Feature additions or enhancements
  • Refactoring that touches multiple files but maintains existing behavior
  • Breaking changes with backward compatibility
  • Changes requiring some domain knowledge to review

Review Effort: Would have taken 15-30 minutes

Examples:

  • Add new feature or component
  • Refactor common utility functions
  • Update dependencies with minor breaking changes
  • Add new component with tests
  • Performance optimizations
  • More complex bug fixes

Large (L)

Characteristics:

  • Major feature implementations
  • Breaking changes or API redesigns
  • Complex refactoring across multiple modules
  • New architectural patterns or significant design changes
  • Changes requiring deep context and multiple review rounds

Review Effort: Would have taken 45+ minutes

Examples:

  • Complete new feature with frontend/backend changes
  • Protocol upgrades or breaking changes
  • Major architectural refactoring
  • Framework or technology upgrades

Additional Factors to Consider

When deciding between sizes, also consider:

  • Test coverage impact: More comprehensive test changes lean toward larger classification
  • Risk level: Changes to critical systems bump up a size category
  • Team familiarity: Novel patterns or technologies increase complexity

Notes:

  • the assessment must be for the totality of the PR, that means comparing the base branch to the last commit of the PR
  • the assessment output must be exactly one of: S, M or L (single-line comment) in format of: SIZE={S/M/L}
  • do not include any additional text, only the size classification
  • your assessment comment must not include tips or additional sections
  • do NOT tag me or anyone else on your comment

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Tip

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

SIZE=M

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