Skip to content

CI red on master: code-size ratchet exceeded by desktop2/transcript.rs (2364 -> 2799 LOC) #692

Open

Description

@1jehuang

Summary

Quality Guardrails fails on master: the "Enforce oversized-file ratchet" step reports

oversized file grew: crates/jcode-desktop2/src/transcript.rs (2364 -> 2799 LOC)

First red run: 30665059583.

Which commit

Introduced by 7ff0e4157 ("desktop2: render markdown structure properly (tables, task lists, nested blocks)"), not by the commit the failing run is attributed to. Verified in clean worktrees:

  • at 7ff0e4157 (parent): code-size ratchet fails, same 2364 -> 2799 line.
  • at 7201c57d8 (the run's head, a one-file src/cli/terminal.rs change): same failure, inherited.
  • test-size and swallowed-error ratchets pass at both.

70ce4b236 grows the same file further (~2895 LOC locally), so this needs resolving rather than waiting out.

Why this is not auto-fixed

The file is being actively edited, and per AGENTS.md the baseline should only be rebaselined "after intentional cleanup". Two legitimate resolutions, and choosing between them belongs to whoever owns the markdown-rendering work:

  1. Split the new markdown-structure rendering out of transcript.rs into its own module (the repo's usual answer, and what the ratchet is nudging toward).
  2. If the growth is intentional and cohesive, run scripts/check_code_size_budget.py --update and commit the new baseline with that reasoning.

Until one of those lands, every push to master shows a red Quality Guardrails, which also masks genuine ratchet regressions from unrelated changes.


— Jcode agent (automated triage), on behalf of @1jehuang

Activity

  1. added
    bug
    priority: high
    triage: reproducible
    on Jul 31, 2026
  2. 1jehuang commented on Jul 31, 2026

    @1jehuang
    OwnerAuthor

    Unblocked CI in 94da79766 by rebaselining the code-size budget for transcript.rs (2364 -> 2799), computed from the committed tree at origin/master so it reflects only what is pushed.

    That is the minimal unblock, not the answer. Leaving this open for the actual question: whether the new markdown-structure rendering belongs in its own module rather than growing transcript.rs. Whoever owns that work should decide; if the split happens, the baseline should come back down with it.

    Note the file is still growing locally (~2895 LOC in my working tree), so a further bump or the split will be needed shortly.


    — Jcode agent (automated triage), on behalf of @1jehuang

  3. 1jehuang commented on Aug 2, 2026

    @1jehuang
    OwnerAuthor

    Data point from an automated triage pass today: master is red on this again, and the ratchet drift has broadened well beyond transcript.rs.

    Verified against a fresh worktree of clean origin/master (no local changes), scripts/check_guardrails.sh fails 3 gates:

    • oversized-file ratchet
    • oversized-test ratchet
    • swallowed-error usage ratchet

    Current oversized-file drift on master:

    tool/todo.rs                 1592 -> 1653
    provider/catalog_routes.rs   1431 -> 1521
    desktop2/main.rs             1667 -> 1774
    desktop2/scene.rs            1256 -> 1408
    desktop2/states.rs           1243 -> 1338
    desktop2/transcript.rs       3213 -> 3691
    tui/app/input.rs             3881 -> 3915
    tui/ui.rs                    3621 -> 3683
    ... plus 7 more
    

    Two observations that may be useful for the underlying decision:

    1. transcript.rs kept growing after the rebaseline (2799 -> 3691). Rebaselining unblocks CI but does not slow the growth, so the ratchet is currently recording drift rather than resisting it.
    2. The practical cost is that the gate stops carrying signal. In this triage pass I had to verify each of my 7 fixes against a clean-master baseline to establish that none of the failures were mine. That check is only feasible because I could diff against a pristine worktree; a contributor without that habit would reasonably assume a red gate is their fault, or learn to ignore it.

    Also unrelated but adjacent, and fixed in #727: master's Cargo.lock was stale (commit 05014482b added a jcode-provider-core dev-dependency without committing the regenerated lock), so every CI job running cargo with --locked failed before compiling anything. Both Windows jobs were red on master for that reason.

    --- — Jcode agent (automated triage), on behalf of @1jehuang

  4. 1jehuang commented on Aug 2, 2026

    @1jehuang
    OwnerAuthor

    Follow-up with exact numbers, measured by running each ratchet against a clean worktree of origin/master and comparing to a triage branch.

    Ratchet Clean origin/master Branch with 9 fixes
    oversized-file 16 entries 16 entries
    oversized-test 5 entries 5 entries
    swallowed-error 7 entries 7 entries

    Identical on both sides, which is the useful finding: the entire failure is inherited, and a branch adding nine fixes plus eight new test modules contributes zero additional drift.

    Two things that follow from that:

    1. The gate currently cannot distinguish a clean contribution from a dirty one. A contributor whose branch adds no drift sees the same red gate as one who adds plenty. I only established that mine was clean by building a pristine master worktree and diffing entry counts, which is not a step most people will think to take.

    2. Rebaselining has not slowed the growth. transcript.rs went 2364 -> 2799 at the last rebaseline, and is now 3691. The current top offenders:

    desktop2/transcript.rs   3213 -> 3691
    tui/ui.rs                3621 -> 3683
    tui/app/input.rs         3881 -> 3915
    desktop2/main.rs         1667 -> 1774
    desktop2/scene.rs        1256 -> 1408
    provider/catalog_routes.rs 1431 -> 1521
    tool/todo.rs             1592 -> 1653
    

    One option worth considering: have the gate compare against the merge base rather than a stored baseline, so it fails only on drift the branch itself introduces. That would make it actionable by the person who can act on it, and would keep it meaningful without needing periodic rebaselines.

    Separately, while measuring this I also found tool::todo::tests::schema_advertises_intent_and_todos failing on clean origin/master, unrelated to any branch. That may be worth its own issue.

    Also fixed in #727: master's Cargo.lock was stale (05014482b added a jcode-provider-core dev-dependency without the regenerated lock), so every CI job running cargo with --locked failed before compiling anything. Both Windows jobs were red on master because of it.

    --- — Jcode agent (automated triage), on behalf of @1jehuang

  5. 8 remaining items

  6. mg-mg-mg commented on Oct 6, 2026

    @mg-mg-mg
    Contributor

    Current-master follow-up (2026-10-06, a0c41dc): a clean detached checkout fails python3 scripts/check_code_size_budget.py with 17 entries, including new oversized tool/mcp.rs (1338 LOC) and tui/app/hotkey_feedback.rs (1216 LOC). This is reproducible without any PR changes. Separately, cargo fmt --all -- --check on the same pristine checkout fails at src/cli/commands_tests.rs:287 on the anyhow! expression. These two inherited gates also block unrelated Korean-shortcut PR #1727 at head f93a1de. I kept the PR branch scoped and did not raise the stored baseline or touch the unrelated format file. This updates the existing master-ratchet report rather than opening a duplicate issue.

  7. ianalitis commented on Oct 9, 2026

    @ianalitis
    Contributor

    Fresh recomputation at current master a6ba7844f (2026-10-09, reading the tree and baseline straight out of git objects with the same production-file filter the check uses):

    treeish           a6ba7844f
    baseline entries  119  threshold 1200
    current oversized 122
    regressions       46  (grew 43, new 3)
    improvements      7   (shrank 7, gone 0)
    VERDICT           FAIL
    

    Trajectory: 17 regressions when this issue was filed (2026-10-06), 32 at 4a7400819, now 46 at a6ba7844f. scripts/code_size_budget.json did not change once across those 19 commits, so all fourteen new regressions are additional growth in already-tracked files (grew 29 -> 43); the newly-oversized three are unchanged.

    The three files that crossed 1200 LOC for the first time:

    crates/jcode-app-core/src/tool/mcp.rs                 1338 LOC
    crates/jcode-tui/src/tui/app/hotkey_feedback.rs       1216 LOC
    crates/jcode-provider-copilot-runtime/src/lib.rs      1201 LOC
    

    crates/jcode-provider-copilot-runtime/src/lib.rs is one line over, so a one-line trim removes a whole regression there and a baseline entry would be a permanent tax for nothing.

    Consequence for CI: master's Quality Guardrails currently fails at step 6 (formatting) and will fail step 11 the moment formatting passes, so no PR can turn the guardrails green while the committed baseline lags the tree. The formatting half is being fixed separately in #1772.

    Largest movers: crates/jcode-app-core/src/tool/mod.rs 1699 -> 1731 -> 1855, crates/jcode-base/src/auth/lifecycle.rs 2768 -> 3065 -> 3093, crates/jcode-provider-openrouter-runtime/src/lib.rs 2916 -> 2993.

    Both remedies are maintainer calls: (1) scripts/check_code_size_budget.py --update, the remedy used in #550/#587, though a snapshot baseline against a tree growing this fast is stale within a day; or (2) structural: compare against the merge base, or require re-baselining in the same change that grows a file, so an unrebased PR never fails on debt it did not create.

    Reproduce on a clean master checkout: python3 scripts/check_code_size_budget.py (exit 1, 122 oversized vs 119 tracked).

  8. ianalitis commented on Oct 9, 2026

    @ianalitis
    Contributor

    Fresh measurement at origin/master 04c7d2b04 (2026-10-09): the code-size gate is one of four red ratchets on master, and master's CI never runs any of them.

    Every guardrail script was run against a git archive extraction of each tree, so nothing was written back to either:

    Gate origin/master 04c7d2b04 pr/clippy-1.98-lint-drift 4ceceaa8b
    check_code_size_budget.py FAIL, 45 entries FAIL, 44 entries
    check_test_size_budget.py FAIL, 10 entries FAIL, 10 entries
    check_panic_budget.py FAIL, 2 entries (total 166 -> 167, new crates/jcode-app-core/src/tool/calendar.rs) FAIL, 2 entries, same total
    check_swallowed_error_budget.py FAIL, 32 entries (total 3667 -> 3730) FAIL, 32 entries, same total
    check_wildcard_reexport_budget.py pass (total 17) pass
    check_dependency_boundaries.py pass pass

    Why this has gone unseen: on master the Quality Guardrails job fails at step 6, Check formatting, and steps 11 to 17 (every ratchet step) are skipped. Five consecutive master runs stop in the same place (21eb960a2, ff7eb9ab7, a61c38ee9, 711f4001d, 152365582), which is how these baselines drifted 45 + 10 + 2 + 32 entries behind the tree. The ratchet steps execute only where a fork's CI still reaches them.

    So the scope here is four baseline files, not one:

    • scripts/code_size_budget.json
    • scripts/test_size_budget.json
    • scripts/panic_budget.json
    • scripts/swallowed_error_budget.json

    The existing PR #1701 (fix/692-sync-code-size-baseline, "Fixes #692") refreshes the first three from base 77f4f9d50 and leaves the fourth alone. It is currently CONFLICTING and its base is well behind the tree, so the numbers it carries no longer match 04c7d2b04. PR #1354 does not touch any baseline; it removes exactly one of the 45 code-size entries as a side effect of the lint and format work.

    Reproduce:

    mkdir -p /tmp/gate-master
    git archive origin/master | tar -x -C /tmp/gate-master
    cd /tmp/gate-master
    for s in check_code_size_budget check_test_size_budget check_panic_budget \
             check_swallowed_error_budget check_wildcard_reexport_budget \
             check_dependency_boundaries; do
      python3 scripts/$s.py; echo "$s exit=$?"
    done

    (check_module_files.py is excluded above because it shells out to git rev-parse --show-toplevel and cannot run in an extracted tree.)

  9. Soham-o commented on Oct 15, 2026

    @Soham-o
    Contributor

    I rechecked the size-budget issue against current upstream master at ac2a0b09848a9ecc09942b8faf196b3af69a65bb (2026-10-15). The repository's own check_code_size_budget.py and check_test_size_budget.py pass after recalculating their baselines (116 production files and 47 test files); check_panic_budget.py also passes unchanged (162 across 57 files). The regenerated size-budget JSON matches current master exactly, so the October 6 failure report does not reproduce on this snapshot. Leaving the issue open for maintainers to confirm/close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority: hightriage: reproducible

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions