Skip to content

fix(jcode-tui): gate cache_expected_warm re-export behind #[cfg(test)] - #150

Closed
KooshaPari wants to merge 1 commit into
masterfrom
fix/tui-cache-expected-warm-unused-import
Closed

KooshaPari wants to merge 1 commit into
masterfrom
fix/tui-cache-expected-warm-unused-import

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

User description

Closes #149

Summary

Gate the pub(crate) use kv_cache_problem::cache_expected_warm; re-export in crates/jcode-tui/src/tui/mod.rs behind #[cfg(test)]. The re-export is only consumed by the #[cfg(test)] mod tests block (lines 1883 and 1885 — super::cache_expected_warm); the neighbouring KvCacheProblemKind re-export is already #[cfg(test)]-gated on the same lines. Mirroring that gating clears the unused_imports warning that turns into a hard error under -D warnings (Quality Guardrails CI).

Diff is 1 deletion + 2 insertions in one file, no behavioural change. cargo fmt -p jcode-tui -- --check passes.

Root cause

Commit 55d4432ad fix(tui): re-export cache_expected_warm for mod.rs tests added the unconditional re-export to resolve an E0425 path error in the test block. The validation tag on that commit was cargo-check-tui-tests (in progress) and the warning was not caught at the time because the lib build path doesn't touch the test block.

The function cache_expected_warm is pub(crate) in kv_cache_problem.rs and has exactly one caller in the entire crate — the test block that uses super::cache_expected_warm(Some(&timer)). Under --all-targets --all-features -- -D warnings clippy reports the re-export as unused (the test path doesn't bind a non-test consumer of the re-export). It then becomes a hard error.

Fix

--- a/crates/jcode-tui/src/tui/mod.rs
+++ b/crates/jcode-tui/src/tui/mod.rs
@@ -1067,9 +1067,10 @@ impl CacheTtlInfo {
 pub use crate::provider::{cache_ttl_for_provider, cache_ttl_for_provider_model};

 mod kv_cache_problem;
-pub(crate) use kv_cache_problem::cache_expected_warm;
 #[cfg(test)]
 pub(crate) use kv_cache_problem::KvCacheProblemKind;
+#[cfg(test)]
+pub(crate) use kv_cache_problem::cache_expected_warm;
 pub(crate) use kv_cache_problem::detect_kv_cache_problem;

 #[derive(Debug, Clone, Copy, PartialEq, Eq)]

Validation

  • cargo fmt -p jcode-tui -- --check -> exit 0. No diff in crates/jcode-tui/src/tui/mod.rs (or anywhere else in the crate). The two #[cfg(test)]-gated re-exports are in rustfmt's sorted order (K before c).
  • cargo clippy -p jcode-tui --all-targets --all-features -- -D warnings -> BLOCKED on this dev machine by an unrelated environment failure (tikv-jemalloc-sys build script: cc cannot link against /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.B.tbd — unknown architecture arm64e). The first run of the same command on this worktree completed (cache-hit build, 26 min) and produced zero unused import warnings on the edited file, but did not exercise the unmodified master tree; CI is the source of truth for the warning-to-error transition. Master is reproducible on the GitHub Actions runners where the toolchain is healthy.
  • cargo test -p jcode-tui --lib -> BLOCKED on the same env failure. Pre-edit master and post-edit branch both fail at the same place, so this does not regress the test surface.

Note for reviewer — cargo test -p jcode-tui --lib is expected to show the same 21 pre-existing known-failing tests (#135) before and after this change; that is owned by another worker.

Independent of #129 and #134

This PR is the minimum change to clear the Quality Guardrails gate. It does not touch cache_expected_warm's implementation (that is PR #134, fix/cache-estimate-not-evidence) and does not fix the unrelated rustfmt drift in this file or the other 6 files (that is PR #129).

All three PRs touch crates/jcode-tui/src/tui/mod.rs, so the recommended merge order is:

  1. fix(ci): clear repo-wide rustfmt drift + env! macro in cli_exit_status #129 first (rustfmt drift in 7 files including this one — establishes the canonical sorted order of the kv_cache_problem use block).
  2. This PR (fix(jcode-tui): gate cache_expected_warm re-export behind #[cfg(test)] #150) second (only the cfg(test) move on the now-sorted block).
  3. fix(jcode-tui): cache_expected_warm returns false on estimates, not just cold #134 third (function-logic fix in kv_cache_problem.rs; touch here is incidental if the kv_cache_problem module signature changes).

Or cherry-pick onto the integration branch in that order if any of the three ships first.

Ledger

tx-agent:     jcode
tx-validated: cargo-fmt
tx-task:      fix/jcode-tui-cache-expected-warm-unused-import
tx-scope:     crates/jcode-tui/src/tui/mod.rs
tx-intent:    clear unused-import warning in Quality Guardrails CI

Commit: 683570bc6 on branch fix/tui-cache-expected-warm-unused-import.


CodeAnt-AI Description

Keep strict lint builds clear of a test-only cache helper warning

What Changed

  • The cache helper is now re-exported only for tests, where it is used; test access remains unchanged
  • Non-test builds no longer report the unused re-export

Impact

✅ Warning-free strict lint builds
✅ Cache helper remains available in tests

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

The pub(crate) re-export of cache_expected_warm was unconditional, but
its sole consumer is the #[cfg(test)] mod tests block at line 1883/1885
(super::cache_expected_warm). Under 'cargo clippy --all-targets --all-features
-- -D warnings' (Quality Guardrails CI) the re-export trips an unused-import
diagnostic that becomes a hard error.

The neighbouring KvCacheProblemKind re-export on the very next line is
already #[cfg(test)]-gated. Mirror that gating for cache_expected_warm so
the lib build has no dead re-export and the test build still resolves
super::cache_expected_warm as before.

Minimal diff: +3 / -1 lines, single file.

tx-agent:     jcode
tx-validated: cargo-fmt
tx-task:      fix/jcode-tui-cache-expected-warm-unused-import
tx-scope:     crates/jcode-tui/src/tui/mod.rs
tx-intent:    clear unused-import warning in Quality Guardrails CI

Independent of PR #134 (function-logic fix in kv_cache_problem.rs) and
PR #129 (unrelated rustfmt drift across 7 files). Merge order matters
because all three touch crates/jcode-tui/src/tui/mod.rs:
  #129 first -> this PR -> #134
or cherry-pick if conflicts.
Copilot AI balanced review requested due to automatic review settings October 19, 2026 22:15
@codeant-ai

codeant-ai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 683570b Oct 19, 2026 · 22:15 22:17

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codeant-ai

codeant-ai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: bfda0a88-611b-47a6-b5fe-b8ec710e580e
📥 Commits

Reviewing files that changed from the base of the PR and between b988614 and 683570b.

📒 Files selected for processing: 1
  • crates/jcode-tui/src/tui/mod.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@codeant-ai codeant-ai Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Oct 19, 2026
@codeant-ai

codeant-ai Bot commented Oct 19, 2026

Copy link
Copy Markdown

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge; it limits the cache_expected_warm re-export to test builds, with no concrete functional concern shown.

Assessed commit: 683570bc6aa3

KooshaPari added a commit that referenced this pull request Oct 20, 2026
…PR stack

tx-agent: jcode
tx-validated: manual
tx-task: governance-2026-10-19
tx-scope: docs/sessions/2026-10-19-orchestration-governance
tx-intent: give the operator a no-force-push merge order for PRs #152/#127/#140/#148/#129/#132/#134/#150/#145
@kilo-code-bot

kilo-code-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The change correctly gates the test-only cache_expected_warm re-export behind #[cfg(test)], mirroring the adjacent KvCacheProblemKind re-export. Test access via super::cache_expected_warm remains valid since the consumer is itself #[cfg(test)]. No behavioral change; minimal and well-scoped.

Files Reviewed (1 file)
  • crates/jcode-tui/src/tui/mod.rs

Reviewed by free · Input: 19K · Output: 685 · Cached: 134.8K

@KooshaPari

Copy link
Copy Markdown
Owner Author

Closing as already landed.

Evidence: git merge-tree --write-tree origin/master origin/pr150 produces tree c1912771b742, which is byte-identical to master's tree. Merging this PR would change nothing.

The substantive change is present on master: crates/jcode-tui/src/tui/mod.rs already carries #[cfg(test)] pub(crate) use kv_cache_problem::cache_expected_warm;, which is exactly what this PR adds.

Reopen if that is wrong.

@KooshaPari KooshaPari closed this Oct 28, 2026
@KooshaPari KooshaPari reopened this Nov 5, 2026
@sonarqubecloud

sonarqubecloud Bot commented Nov 5, 2026

Copy link
Copy Markdown

@KooshaPari

Copy link
Copy Markdown
Owner Author

Closing under the host-ops closure audit (2026-11-11): the same change already landed on master (matching commit subject); this PR is the leftover branch. The branch fix/tui-cache-expected-warm-unused-import is preserved on the remote, so the work is recoverable with git fetch origin fix/tui-cache-expected-warm-unused-import or by reopening this PR. Nothing was deleted.

@KooshaPari KooshaPari closed this Nov 11, 2026
@KooshaPari
KooshaPari deleted the fix/tui-cache-expected-warm-unused-import branch November 27, 2026 09:42
KooshaPari added a commit that referenced this pull request Nov 28, 2026
… plan (#375)

* docs(sessions): add cross-harness orchestration governance proposal

Proposes 4 enforcement mechanisms for the "Always Subagent — main context is management-only" operator directive (2026-10-11 21:08); records the 2026-10-19 manual cross-harness propagation of the rule to all 4 derivative AGENTS.md copies (codex, forge, kcode, helioslite); lists operator-approved next steps (none yet; each mechanism awaiting decision).

tx-agent: jcode
tx-validated: manual
tx-task: governance-2026-10-19
tx-scope: docs/sessions/2026-10-19-orchestration-governance
tx-intent: capture the cross-harness propagation decision + enforcement backlog in the repo

* docs(sessions): add fix-forward merge integration plan for the KCode PR stack

tx-agent: jcode
tx-validated: manual
tx-task: governance-2026-10-19
tx-scope: docs/sessions/2026-10-19-orchestration-governance
tx-intent: give the operator a no-force-push merge order for PRs #152/#127/#140/#148/#129/#132/#134/#150/#145

* docs(ci): rebuild the merge integration plan against master 2aea04d

tx-agent: jcode
tx-validated: manual
tx-task: 143
tx-scope: docs/sessions/2026-10-19-orchestration-governance
tx-intent: replace the stale 2026-10-19 PR stack plan with one built from current master ground truth

* docs(ci): rebuild the merge integration plan against master 2aea04d

tx-agent: jcode
tx-validated: manual
tx-task: 143
tx-scope: docs/sessions/2026-10-19-orchestration-governance
tx-intent: replace the stale 2026-10-19 PR stack plan with one built from current master ground truth

* docs(merge): refresh the merge plan with the recomputed stack and resolved conflicts

The recomputed residuals (recomputed against origin/master 2aea04d
via git merge-tree --write-tree) now cover 12 open PRs in the KCode
stack. The four PRs previously flagged as needing hand-resolved
conflicts (#140, #127, #157, #158) have already been merged against
origin/master by a parallel agent as real 2-parent merge commits at
d6e4cfa, b6508e6, 264c09a, and 47b42e2 respectively; merge-tree
reports zero conflict markers for all four. Two new PRs (#163 transport
pipe-stem, #164 CI timeout headroom) extend the stack to 12.

The CI Quality Guardrails clippy gate has a coverage gap that no
existing PR fixes: the command is 'cargo clippy --all-targets
--all-features -- -D warnings' with no --workspace, so exactly one
workspace member (jcode-sdk) is unreachable from the root package and
is never linted. In the green run id 39390720989 the cargo test -p
jcode-sdk parity step still emitted the 'never used' warning for the
Subscriber alias at crates/jcode-sdk/src/client.rs:330. The --workspace
change is NOT a no-op and may surface additional pre-existing
violations; this is recorded as an OPEN RISK, not a resolved fact.

The KCode self-hosted runner desk-kcode-1 wedged on 2026-10-21 in the
Build & Test (desk-linux) job of run 39530002307. Root cause: the
desk WSL2 instance is capped by .wslconfig at memory=16GB (not the
64GB the Windows host has), was competing with a 1h43m orphaned
cargo llvm-cov --workspace job, and the Build step in
.github/workflows/ci.yml has no per-step run_with_timeout.py wrapper.
Remediation (terminating the orphan) brought memory from 13.9/16 GB to
9.4/16 GB and recovered the runner.

Detailed conflict resolutions and the runner wedge root-cause analysis
moved to a new companion file 05a_MERGE_EVIDENCE.md so the plan itself
fits the 500-line cap.

tx-agent: jcode
tx-validated: manual
tx-scope: docs/sessions/2026-10-19-orchestration-governance/
tx-intent: Refresh the merge plan against recomputed 12-PR residuals + 4 applied conflict resolutions + clippy coverage gap + runner wedge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(jcode-tui): gate cache_expected_warm re-export behind #[cfg(test)] to clear unused-import under -D warnings

2 participants