Skip to content

fix(ci): make the Rust layout gate warn early, cover core/, and ratchet its pins - #6817

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
M3gA-Mind:fix/layout-gate-6310
Sep 30, 2026
Merged

senamakel merged 1 commit into
tinyhumansai:mainfrom
M3gA-Mind:fix/layout-gate-6310

Conversation

@M3gA-Mind

@M3gA-Mind M3gA-Mind commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Warn band. The layout gate now lists files past 725 lines in its log without failing, so an author sees the margin in their own PR instead of a later PR turning main red.
  • Explicit scope. Removed the name-based prune (directory === ROOT over api/bin/core/lib.rs/main.rs/rpc). Four of those six names no longer exist. core/ held eight unenforced files (up to 3631 lines); they are now pinned at their current size instead of skipped.
  • Ratchet. A pinned file below its pin now fails with the exact value to lower it to, or asks for the entry to be dropped once the file fits 750. Every pin is lowered to its current size; three entries that already fit are removed.
  • Duplicate pins. subagent_host/lifecycle.rs (1304 and 1318) and subagent_host/ops/runner.rs (1793 twice) were listed twice, and a Map silently keeps the last. Each is now listed once, and the gate fails on a repeat.
  • Script-only change: no Rust source is touched.

Problem

#6310: the gate had no warning output, pruned core/ from the line limit by directory position, and only checked legacy pins for file existence, so a shrinking file silently regained headroom. The pin list also had two duplicated keys, which hid one pin each.

Solution

  • WARN_AT = 725 applies to unpinned files, printed via console.warn before the pass/fail result.
  • The line-limit loop walks every .rs under crates/openhuman-core/src through the existing allRustFiles (the separate pruning walker is deleted).
  • For a pinned file: lineCount < pin fails. The message reads "lower the pin to N" above 750, or "remove its legacy exception" at 750 or below.
  • LEGACY_LIMIT_ENTRIES is the source array; the gate fails if any file appears twice in it before it becomes the Map.
  • Pin choices for the duplicates: lifecycle.rs is 1313, which exceeds 1304, so the effective pin 1318 was the real one; it is now lowered to 1313 by the ratchet. runner.rs is 1427 and is pinned at that.

Inherited, not fixed here: on upstream/main @ 1b82b9dba4, the gate still fails on four files that overflowed before this PR (#6788, #6793, #6809), and this PR deliberately leaves them to their owner:

  • session_host/runtime_session.rs 1993 > 1990
  • tinyagents/turn_runner.rs 752 > 750
  • inference/provider/openhuman_backend_model.rs 759 > 750
  • inference/provider/openhuman_backend_model_tests.rs 761 > 750

With this PR the gate reports exactly those four failures and nothing new. static:module-pins (tinychannels) is also red on main and is likewise inherited.

Submission Checklist

  • Tests added or updated: scripts/__tests__/check-openhuman-rust-layout.test.mjs, 8 tests, including the exact-limit / exact-pin controls. Revert check: against the pre-PR script (with its new Map([...]) literal only renamed so pins can be injected), the 2 controls pass and all 6 new-behaviour tests fail.
  • N/A: Diff coverage applies to Vitest / cargo-llvm-cov; this is a Node CI script covered by node --test.
  • N/A: Coverage matrix: CI tooling, no product feature row.
  • N/A: Feature IDs: no product feature touched.
  • N/A: No external network dependency: the gate reads the local tree only.
  • N/A: Manual smoke checklist: not a release-cut surface.
  • Linked issue closed via Closes in ## Related.

Impact

  • CI only. The gate now also fails when a pinned file shrinks without its pin being lowered, and when a core/ file grows past its new pin.
  • There is no runtime impact.

Related

Closes #6310

  • Follow-up PR(s)/TODOs: the four inherited overflows above; other crates (e.g. openhuman-app/src/lib.rs) are still outside the line limit, which is noted in the gate's scope comment.

AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: fix/layout-gate-6310
  • Commit SHA: 66752a6

Validation Run

  • N/A: pnpm --filter openhuman-app format:check, because no app files changed
  • N/A: pnpm typecheck, because no TypeScript changed
  • Focused tests: node --test scripts/__tests__/check-openhuman-rust-layout.test.mjs scripts/__tests__/self-hosted-lanes.test.mjs: 28/28 pass
  • N/A: Rust fmt/check, because no Rust changed
  • N/A: Tauri fmt/check, because no Tauri changed

Validation Blocked

  • command: node scripts/ci/check-openhuman-rust-layout.mjs
  • error: exits 1 on the four inherited overflows listed above (same four as on main)
  • impact: Rust Quality stays red until those files are split upstream

Behavior Changes

  • Intended behavior change: the gate warns at 725, covers core/, enforces monotonic pins, and rejects duplicate pins.
  • User-visible effect: none (CI only).

Parity Contract

  • Legacy behavior preserved: the 750 limit, the pinned-file ceiling, the stale-entry check, and the naming, inline-test and manifest checks are unchanged.
  • Guard/fallback/dispatch parity checks: N/A

Duplicate / Superseded PR Handling

  • Duplicate PR(s): none
  • Canonical PR: this
  • Resolution (closed/superseded/updated): N/A

Summary by CodeRabbit

  • Chores
    • Rust code-size checks now apply consistently across the codebase, with stricter handling for files that exceed the limit.
    • Oversized files are flagged as they approach the limit, and recorded exceptions must be updated as files change.
  • Tests
    • Added coverage for code-size thresholds, exception tracking, and duplicate exception entries.
  • Documentation
    • Updated CI guidance to reflect the current limits and exception requirements.

…et its pins

- Warn band: files past 725 lines are listed (without failing) so the
  margin shows in the author's own PR log.
- Scope: drop the name-based prune of `api`/`bin`/`core`/`lib.rs`/`main.rs`/
  `rpc` at the top of `crates/openhuman-core/src`. Only `core/` and `lib.rs`
  still exist; the eight oversized `core/` files are pinned at their current
  size instead of being skipped.
- Ratchet: a pinned file below its pin fails with the value to lower it to, or
  asks for the entry to be removed once it fits the 750-line limit. Pins are
  lowered to today's sizes and the three that already fit are removed.
- Duplicate pins: `subagent_host/lifecycle.rs` (1304, 1318) and
  `subagent_host/ops/runner.rs` (1793 twice) were each listed twice; a Map
  keeps the last one. Each is now listed once and the gate fails on a repeat.

Closes tinyhumansai#6310
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: fae85d88-b134-42de-b37d-0e4f2755856d

📥 Commits

Reviewing files that changed from the base of the PR and between 1b82b9d and 66752a6.

📒 Files selected for processing (3)
  • scripts/__tests__/check-openhuman-rust-layout.test.mjs
  • scripts/ci/README.md
  • scripts/ci/check-openhuman-rust-layout.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The Rust layout gate now checks every Rust file under its source root, warns for unpinned files above 725 lines, and enforces exact-size pins for oversized files. It also rejects duplicate pins and requires pins to decrease when pinned files shrink.

Changes

Rust Layout Gate

Layer / File(s) Summary
Expand coverage and update legacy pins
scripts/ci/check-openhuman-rust-layout.mjs, scripts/ci/README.md
The gate applies the line limit to all Rust files under the source root. The legacy-pin list is updated, duplicate paths fail, and the README describes the revised policy.
Warn near the limit and ratchet pins
scripts/ci/check-openhuman-rust-layout.mjs, scripts/__tests__/check-openhuman-rust-layout.test.mjs
Unpinned files above 725 lines produce warnings. Pinned files that shrink require a lower pin or removal of the exception. Tests cover the limits, warning band, core-source coverage, pin updates, and duplicate pins.

Priority: ⬆️ High

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: High

Suggested reviewers: senamakel

Merge Risk: ⚪ Minimal · up to 66752

The gate adds broader coverage, near-limit warnings, and stricter pin maintenance without introducing new failures. No actionable merge-blocking risk remains from this change; existing layout violations remain separate follow-up work.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR lowers existing legacy pins, including the four legacy pins that #6310 explicitly states should not be tightened in this work. That change is outside the issue scope. The new core/ pins are i… Remove the unrelated tightening of the existing legacy pins, or move that work to a separate linked issue. Keep the warning band, full core/ coverage, ratchet logic, and related tests.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed PR #6817 implements the coding objectives in #6310. check-openhuman-rust-layout.mjs adds the 725-line warning band, checks all Rust files under crates/openhuman-core/src, and adds exact-pin shrink…
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 2 functions across 2 files. (1 skipped: 1 …
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main changes: early warnings, coverage of core/, and ratcheted pins in the Rust layout gate.
Full details: Out of Scope Changes check

Explanation

The PR lowers existing legacy pins, including the four legacy pins that #6310 explicitly states should not be tightened in this work. That change is outside the issue scope. The new core/ pins are in scope because they explicitly handle the documented pruning gap. The warning, gate changes, ratchet checks, tests, and documentation support the issue objectives.

  • Fix all pre-merge checks with AI

A rabbit checks each Rust file’s length,
The pins must match with measured strength.
Near the limit, a warning shows,
A shrinking file’s old pin goes.
Duplicate pins are turned away,
The gate now counts the wider way.

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

@tinysweeper

tinysweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Tiny Sweeper reviewed this change across 6 lane(s) and found 1 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below.

State: Incomplete
Priority: medium
Reviewed head: 66752a6b0c2b
Updated: 1790771690 (Unix time)

Review snapshot

Change surface Files Review signal Count
Production 1 Active findings 1
Tests 1 Noted findings 0
Documentation 1 Resolved findings 0
Configuration 0 Pending checks/questions 9

Completeness: Incomplete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

What changed

The review could not produce a supported behavioral summary; inspect the cited changed surface and lane details below.

Features

None identified with supported citations.

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

Findings

  • medium · e2e · End-to-end job `Rust Feature-Gate Smoke (gates off)` will not run on this change — `Rust Feature-Gate Smoke (gates off)` in `.github/workflows/ci-lite.yml` will not run for this pull request: the forge reports it as skipped, so a job condition was false for this (\.github/workflows/ci\-lite\.yml)

Pending checks: Rust E2E (mock backend), Build Playwright E2E Artifact, E2E (Playwright / web lane), Desktop E2E (full suite, 3 OS)

Could not review: scripts/__tests__/check-openhuman-rust-layout.test.mjs, scripts/ci/README.md, scripts/ci/check-openhuman-rust-layout.mjs

Before merge

  • Complete the critique review for scripts/__tests__/check-openhuman-rust-layout.test.mjs, scripts/ci/README.md, scripts/ci/check-openhuman-rust-layout.mjs.
  • Complete the security review for scripts/__tests__/check-openhuman-rust-layout.test.mjs, scripts/ci/check-openhuman-rust-layout.mjs.
  • Wait for Rust E2E (mock backend), Build Playwright E2E Artifact, E2E (Playwright / web lane), Desktop E2E (full suite, 3 OS).

How this fits together

flowchart LR
  n0["allRustFiles<br/>changed"]:::changed
  n1["rustFiles<br/>changed"]:::changed
  n2["directory"]:::impacted
  n3["file"]:::impacted
  n4["files"]:::impacted
  n0 -->|uses| n2
  n0 -->|uses| n3
  n1 -->|uses| n2
  n1 -->|uses| n3
  n3 -->|uses| n2
  n4 -->|uses| n2
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading
Agent review details

critique

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: scripts/__tests__/check-openhuman-rust-layout.test.mjs, scripts/ci/README.md, scripts/ci/check-openhuman-rust-layout.mjs
  • Lane summary: Reviewed 0 files; 0 findings. 3 files could not be reviewed: scripts/__tests__/check-openhuman-rust-layout.test.mjs, scripts/ci/README.md, scripts/ci/check-openhuman-rust-layout.mjs.

security

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: scripts/__tests__/check-openhuman-rust-layout.test.mjs, scripts/ci/check-openhuman-rust-layout.mjs
  • Lane summary: Reviewed 0 files; 0 findings. 2 files could not be reviewed: scripts/__tests__/check-openhuman-rust-layout.test.mjs, scripts/ci/check-openhuman-rust-layout.mjs. 1 file was not security-reviewed: scripts/ci/README.md (prose or tabular data).

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The gate's line-limit checks now apply to all files under `crates/openhuman-core/src`, including previously excluded directories, with a warn band, a monotonic pin ratchet, and duplicate detection. Every new clause is covered by a dedicated unit test in a throwaway tree; the existing checks (naming, inline test mod) are unaffected. The change looks sound. _The code index is behind this pull request (indexed at `a65c48a3ec18`), so retrieved context may be out of date._ _Memory was unavailable (model: cortex: v1/recall: timed out after 10s), so this review ran without it._

commits

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: Nothing sensitive found in what this pull request commits.

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The pull request refines the Rust layout CI gate with a warning band, enforced coverage of core/, a ratchet for pinned files, and duplicate-pin rejection. All changes are limited to CI scripts and tests, appear correct, and match the stated design. _The code index is behind this pull request (indexed at `a65c48a3ec18`), so retrieved context may be out of date._ _Memory was unavailable (model: cortex: v1/recall: timed out after 10s), so this review ran without it._

e2e

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: This change is internal CI infrastructure — it modifies a static-analysis gate script that enforces Rust file layout rules and adds unit tests for that script. It has no external surface (no route, command, flag, screen, persisted format, or message queue) that any end-to-end harness drives, and it does not alter any product behaviour. It is e2e-unobservable and needs no end-to-end test coverage. Waiting on end-to-end jobs: `Rust E2E (mock backend)`, `Build Playwright E2E Artifact`, `E2E (Playwright / web lane)`, `Desktop E2E (full suite, 3 OS)`.
  • Unresolved questions/checks: Rust E2E (mock backend), Build Playwright E2E Artifact, E2E (Playwright / web lane), Desktop E2E (full suite, 3 OS)
  • Evidence: \.github/workflows/ci\-lite\.yml — End-to-end job `Rust Feature-Gate Smoke (gates off)` will not run on this change
Evidence and run details
  • Models: ladder/vectors, deepseek/deepseek-v4-flash
  • Spend: $0.005055
  • Tokens: 54611 input · 9059 output · 17408 cached · 779 embedding
Head State Pass summary
66752a6b0c2b incomplete 1 active finding(s), 0 resolved finding(s) (at 1790771690)

tinysweeper 0.1.0

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

tinysweeper found nothing blocking, but could not review everything, so this is not an approval: scripts/__tests__/check-openhuman-rust-layout.test.mjs, scripts/ci/README.md, scripts/ci/check-openhuman-rust-layout.mjs.

             $0.0051 · 54,611 in / 9,059 out · 17,408 cached (32%)  · ladder/vectors, deepseek/deepseek-v4-flash · 779 embedded
tests:       $0.0008 · 17,484 in / 2,751 out · 17,408 cached (100%) · deepseek/deepseek-v4-flash
description: $0.0013 · 9,719 in  / 3,021 out · 0 cached (0%)        · deepseek/deepseek-v4-flash
e2e:         $0.0020 · 20,009 in / 1,306 out · 0 cached (0%)        · deepseek/deepseek-v4-flash

@tinysweeper tinysweeper Bot added the priority: p2 Soon. Real but survivable — a rough edge, a gap, a thing that will bite later. label Sep 30, 2026
@senamakel
senamakel merged commit 89b11fb into tinyhumansai:main Sep 30, 2026
41 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p2 Soon. Real but survivable — a rough edge, a gap, a thing that will bite later.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rust layout gate: main is one line from red (two files at exactly 750, one legacy pin at 0), no warning band, and two gaps in the gate

2 participants