Repository navigation
fix(build): restore cargo check/test gates on master (7 defects) - #116
KooshaPari wants to merge 5 commits into
Conversation
…ster Found during a fresh-baseline audit at master 521c66e. All four are verifiable build defects, not judgment calls. 1. assets/app-icons rename: crates/jcode-setup-hints/src/macos_launcher.rs references lowercase `kcode.icns`, but only `Jcode.icns` was tracked. The decollation rename commit (901b331, #33) was reverted by f19b47b (#36) at the asset layer while the code reference survived, so the code and the asset diverged. `git mv` the icon; bytes are unchanged (sha256 4863e67d...). 2. crates/jcode-provider-grok-build-runtime: src/bin/fake_acp.rs uses `serde_json::{Value, json}` but the crate never declared the dependency. Add serde_json = { version = "1", features = ["raw_value"] }, matching the workspace root and the sibling jcode-provider-openrouter-runtime. 3. crates/jcode-app-core/src/update_product.rs lost two symbols the updater still calls. Commit 7fdbe2f (#113) rewrote this file (327+/19-) and replaced the original 31-line hard self-update block with a semver-heuristic one, dropping `SELF_UPDATE_ENABLED` and `require_update_channel`. The callers at update.rs:212, 272, 489, 985 still expect them, so jcode-app-core never compiled after #113. Restored both with the original unconditional fail-closed semantics: KCode self-update stays off regardless of semver, env overrides, or a renamed executable. Added a second test that the guard refuses even for an upstream-classified semver, so the semver heuristic cannot be spoofed into reaching a release endpoint. 4. crates/jcode-app-core/src/ambient/runner_live_delivery_tests.rs: the ScheduledItem initializer added by 6cf71ed (#98) does not set `recurrence`, which the struct gained in dbc9fb1. lib-test target failed to build (E0063). Set `recurrence: Recurrence::Once` to match runner_tests.rs:307. Verification: `cargo check --workspace` exits 0 (7m06s) with no new warnings versus the pre-existing 7 in jcode-app-core (the product-identity API added by #113 is itself dead code: update.rs keeps its own `GITHUB_REPO = "KooshaPari/KCode"` at line 36 and never calls update_repo/resolve_update_repo -- flagged, not fixed here). tx-agent: jcode tx-validated: cargo-check tx-task: KCode master build restoration tx-scope: assets, jcode-provider-grok-build-runtime, jcode-app-core tx-intent: restore a compilable master baseline after #113/#98 regressions
… compile Fifth master build defect, and the second one from the same commit. `cargo check --workspace` only builds non-test targets, so the defects from 6cf71ed (#98) -- this one and the `recurrence` omission -- were invisible to that gate and only surface under `cargo test --workspace --lib`, which exits 101 on this tree. Commit 6cf71ed (#98) added the test `cache_estimate_is_not_evidence_of_an_expected_warm_hit` at crates/jcode-tui/src/tui/mod.rs:1875, calling `super::cache_expected_warm`. That function is defined at kv_cache_problem.rs:82 as a private `fn` in the submodule, and mod.rs re-exports only `KvCacheProblemKind` and `detect_kv_cache_problem`. E0425: not found in `super`. Fix follows the convention already used by the neighbouring re-exports: `pub(crate)` on the definition and a `pub(crate) use kv_cache_problem::cache_expected_warm;` re-export in mod.rs, plus adding it to the test module's `use super::{...}` list. Note on cfg: the function must NOT be `#[cfg(test)]`-gated. It is called from non-test code at kv_cache_problem.rs:105 (`detect_kv_cache_problem`), so gating it breaks the plain lib target with "found an item that was configured out". The first attempt at this commit got that wrong; corrected and verified against both targets. Verification: `cargo check -p jcode-tui` exits 0 and `cargo check -p jcode-tui --lib --tests` exits 0 (1m57s), no errors. tx-agent: jcode tx-validated: cargo-check tx-task: KCode master build restoration tx-scope: jcode-tui tx-intent: restore a compilable jcode-tui lib-test target after #98
`cargo check --workspace` does not build test targets, so this was invisible to that gate and only surfaced under `cargo test --workspace --lib`. Two distinct problems in crates/jcode-harness-api-server/src/translate_tests.rs: **1. Four patterns no longer type-checked (E0308).** `Outbound::Reply` became `Reply(Box<ServerFrame>)` (see the production call sites, which all go through `ServerFrame::reply`), but four assertions still wrote the frame inline and unboxed: - `session_tool_controls_require_attachment_and_negotiated_support` (id 9) - `configure_tools_...` (id 10) - the `list_tools` unknown/invalid-id loop (id 3) - `detach_waits_for_release_barrier_and_drops_late_callbacks` (id 12) Converted each to the idiomatic form for a boxed variant: bind the payload with `[Outbound::Reply(frame)]` and move the field checks into the guard, which also lets the guard assert `reply_to` explicitly. Preserving the original `..` behaviour is not possible for `reply_to` once the payload is bound, so the guards now assert the concrete ids the production path actually sets — `error_reply` builds via `ServerFrame::reply`, so `reply_to` is `Some(api_id)` in every one of these cases (verified against translate.rs:3428). Note: `Box::new(...)` in the pattern position is NOT valid Rust (E0164, "fn calls are not allowed in patterns"), so the binding form is the only correct fix. **2. One genuinely stale decollation expectation.** `credential_provisioning_normalizes_gemini_and_supports_jcode` expected `KCODE_API_KEY=jcode-secret`, but the test's own input is `kcode-secret` and the file it reads is `kcode-subscription.env`. The production mapping at translate.rs:3006-3007 (`"subscription" | "jcode" | "jcode-subscription"` -> provider name `"jcode"`, key `KCODE_API_KEY`) is correct and was writing the right value; only the assertion string was stale. Corrected to `kcode-secret`. Verification: `cargo test -p jcode-harness-api-server --lib` exits 0, 160 passed / 0 failed. The crate was 157 passed / 3 failed before this commit. tx-agent: jcode tx-validated: test tx-task: KCode master build restoration tx-scope: jcode-harness-api-server tx-intent: restore a compilable and green jcode-harness-api-server lib-test target
Third test-only compile break, again invisible to `cargo check --workspace` because that gate does not build test targets. crates/jcode-setup-hints/src/keymap/conflicts.rs referenced a field named `kcode` on `Conflict`, but the struct field is `jcode` (conflicts.rs:37-42, with the doc comments on those lines also reading "The jcode binding ..."). Every sibling assertion in the same test module already uses `c.jcode.field`, so this was a single stale site. E0609: no field `kcode` on type `Conflict`. Changed `conflicts[0].kcode.field` to `conflicts[0].jcode.field`. `detects_terminal_claiming_alternate_enter` is now green. Note: two other decollation string mismatches remain in this crate but are runtime assertion failures rather than compile errors, so they are recorded below rather than folded into this build-repair commit. Verification: `cargo test -p jcode-setup-hints --lib` now compiles and runs: 143 passed, 6 failed (was: 1 build error, 0 tests run). tx-agent: jcode tx-validated: test tx-task: KCode master build restoration tx-scope: jcode-setup-hints tx-intent: restore a compilable jcode-setup-hints lib-test target
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Warning Review limit reachedYou'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 59 minutes. View limit details
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. Comment |
CodeAnt Nitpicks2 code suggestions1. Both new checks shadow the loop’s expected
|
CodeAnt PR Risk: Medium Risk
Assessed commit: |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (8 files)
Previous Review Summary (commit 466608a)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 466608a)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
Files Reviewed (9 files)
DetailsCRITICAL issues in translate_tests.rs: At line 3524 and 3603, the new pattern uses The original code correctly compared the bound value against the expected value. The fix should preserve that validation, e.g.: matches!(&frame.event, ApiEvent::Error { code: actual, .. } if actual == &code)This is a logic error introduced by the PR's test refactoring and compromises test correctness. WARNING in kv_cache_problem.rs: At line 82, pub(crate) fn cache_expected_warm(cache_ttl: Option<&CacheTtlInfo>) -> bool {
cache_ttl.map(|info| !info.is_cold && !info.is_estimate).unwrap_or(false)
}This is a pre-existing behavior gap relative to the test's expectations; addressing it would align implementation with test semantics. The other changes (icon rename, dependency additions, field additions, struct initialization) correctly address the stated build issues. The overall approach to restore build gates is sound. Reviewed by free · Input: 105.7K · Output: 11.9K · Cached: 121.4K |
The live-attach resume History payload exceeds the OS socket buffer (measured 14,642 bytes on master). write_all at client_state.rs:861 then backpressures forever, deadlocking all 6 resume tests that discarded their peer via _peer_stream. Add drain_peer(), which binds the peer to a background read_line loop and yields frames over an UnboundedReceiver, plus assert_peer_history_for(), a bounded assertion that pins the History frame instead of letting a resume silently stop writing and still pass. Wire drain_peer into all 7 resume test files. The resume suite previously hung indefinitely; it now completes in 7.00s with 7 passed. Test-only change. No production source modified. tx-agent: jcode tx-validated: test tx-scope: crates/jcode-app-core/src/server/client_session_tests/resume tx-intent: fix pre-existing resume test deadlock from undrained peer socket backpressure
Addendum: resume test deadlock fixed (c89a0d6)Separately from the 7 build defects, this branch now also fixes a pre-existing test deadlock in Root cause
let result = writer_guard.write_all(json.as_bytes()).await; // blocks forever, len=14642
Fix (test-only, no production source changed)
Verification
Known pre-existing issue, NOT introduced hereThe full crate suite still stalls at 0% CPU on 10 tests. I sampled the hung process and the deepest frame is I verified it is not a regression from this change by stashing the resume edits and re-running the identical suite: the baseline stalls on the same 10 tests, including the resume test this commit makes pass. 302 tests reach Fixing that would require changing production harness code, which is outside this PR's scope — flagging it here for your call. |
Decollision residue: crates/jcode-app-core/src/update.rs calls update_product::SELF_UPDATE_ENABLED and update_product::require_update_channel, but update_product.rs was missing both. The build failed with 5 E0425 errors. Both items were removed during the decollision arc and never restored. Fix is surgical, mirrors the original PR #116 design (option b path, unconditional self-update disabled, fail-closed). This supersedes the icon-rename half of PR #116 (we took the opposite icon path in #117); the remaining 6 build fixes in #116 are still pending. tx-agent: jcode tx-validated: cargo-check-app-core (in progress) tx-task: fixes 5 E0425 errors in update.rs tx-scope: crates/jcode-app-core/src/update_product.rs tx-intent: restore missing API surface; close the build break
…idue) The decollision arc renamed many surface symbols to `jcode` (the canonical name retained for code-level references; `kcode` is the binary and CLI user-visible name). The struct's field is `jcode`, but this one test had a leftover `kcode`. The test failed to compile (E0609: unknown field) and was bundled in PR #116; this is the surgical extraction. tx-agent: jcode tx-validated: cargo-check-setup-hints (in progress) tx-task: fix E0609 in conflicts.rs:474 tx-scope: crates/jcode-setup-hints/src/keymap/conflicts.rs tx-intent: close one test compile break; tiny standalone fix
A test in mod.rs (line 1883) calls super::cache_expected_warm, but the function was private in kv_cache_problem.rs. Test compilation failed with E0425. The visibility was tightened during the decollision arc; the test that exercises it was not updated. This is the second of seven PR #116 fixes extracted to its own commit (matches the PR's intent exactly: visibility bump from default to pub(crate)). tx-agent: jcode tx-validated: cargo-check-tui-tests (in progress) tx-task: fix E0425 in tui/mod.rs:1883 tx-scope: crates/jcode-tui/src/tui/kv_cache_problem.rs tx-intent: close second of 7 PR #116 build defects
The test in tui/mod.rs:1883 calls super::cache_expected_warm, but
super:: from the test module's perspective is tui itself, not the
kv_cache_problem submodule. The test was looking for the function
in the wrong namespace.
Fix: re-export cache_expected_warm from kv_cache_problem at the
tui module level, then import it via super::{...} in the tests.
Matches PR #116's intent for this defect.
tx-agent: jcode
tx-validated: cargo-check-tui-tests (in progress)
tx-task: fix E0425 in tui/mod.rs:1883 (path fix)
tx-scope: crates/jcode-tui/src/tui/mod.rs
tx-intent: close third of 7 PR #116 build defects
The struct gained a 'recurrence: Recurrence' field but the test fixture was not updated. E0063 missing field blocks the lib test from compiling. PR #116 added the same line; this is the surgical extraction. tx-agent: jcode tx-validated: cargo-check-app-core-tests (in progress) tx-task: fix E0063 in runner_live_delivery_tests.rs:59 tx-scope: crates/jcode-app-core/src/ambient/runner_live_delivery_tests.rs tx-intent: close fourth of 7 PR #116 build defects
Outbound::Reply is now wrapped in Box<ServerFrame>, but four tests in translate_tests.rs were still passing ServerFrame directly via struct-literal pattern, causing E0308 mismatched types. The new pattern extracts 'frame' from the Box and asserts on its fields with separate conditions. Also updates the KCODE_API_KEY fixture value from 'jcode-secret' to 'kcode-secret' to match the test's actual subscription state (the env var name is kcode-, the value was mis-keyed). This bundles 5 of 7 PR #116 defects in one file: 4 matches! refactors + 1 fixture fix. tx-agent: jcode tx-validated: cargo-check-harness-api-server-tests (in progress) tx-task: fix E0308 in translate_tests.rs:3629, 3567, 3601, 3636 tx-scope: crates/jcode-harness-api-server/src/translate_tests.rs tx-intent: close fifth of 7 PR #116 build defects
|
Closing as superseded. The 4 build-break fix commits in this branch (BLD-01 through BLD-04, BLD-05, BLD-06) were already extracted and merged to master as individual commits in the previous session:
Master currently passes The 5th commit
If the resume tests do deadlock in the future, the 🤖 Closed with Jcode |
… never landed) (#125) Fix resume deadlock by draining peers before control-plane handback Re-lands the resume deadlock fix (issue #126). Verified against the current master tip (081c1cf, which includes PR #128 and two unrelated commits landed by other agents in between). Merge simulation, not branch-only evidence: merge-tree 6134a11 (clean, no conflicts) squash commit bba6da5be (parents: origin/master + fix/resume-peer-drain-relend) detached worktree at bba6da5be: cargo check -p jcode-app-core --lib -> EXITCODE=0 cargo test -p jcode-app-core --lib resume -> EXITCODE=0, 24 passed / 0 failed All 6 of this PR's new tests pass on the post-merge tree: handle_resume_session_allows_multiple_live_tui_attach handle_resume_session_allows_live_attach_when_existing_agent_is_busy handle_resume_session_allows_attach_from_different_client_instance handle_resume_session_allows_attach_without_local_history handle_resume_session_allows_reconnect_takeover_with_local_history handle_resume_session_allows_same_client_instance_takeover_without_local_history Note on naming: no test is literally named "drain". The PR title describes the drain fix; the regression coverage is in the six peer-attach takeover tests above. Shape: 12 files, 668 insertions / 14 deletions. Exactly one code commit (b99b19b, test-only, +48 lines in client_session_tests/resume.rs); the other 6 test files change are line-count-only (14 out / 14 in) plus docs/session records. CI red gates were each individually proven master-equivalent in a prior session; Require Linked Issue is green. tx-agent: jcode tx-validated: test tx-scope: crates/jcode-app-core tx-intent: stop the resume deadlock by draining existing peers before the control plane hands the session back tx-task: #125, #126
) Records the forward-path work that extracted PR #25 (opencode-go draft) into a clean re-implementation on a feature branch and shipped it as PR #119. Also closed PR #25 and PR #116 as superseded. tx-agent: jcode tx-validated: manual tx-task: session-2026-10-18 tx-scope: docs/sessions/2026-10-18-pr25-extraction tx-intent: preserve session record for PR #25 extraction + open-PR forward-path triage
User description
Summary
Repairs the
cargo check/cargo testgates onmaster. Neither gate was passing at521c66eb3:cargo check --workspaceexited 101 andcargo test --workspace --libcould not even finish compiling.Seven defects, each verified by re-running cargo rather than asserted from memory.
Blockers to
cargo check --workspace(4)assets/app-icons/kcode.icnsreferenced but does not exist in the tree (only the staleJcode.icns)crates/jcode-landing/,jcode-packagingfake_acp.rsusesserde_jsonwithout the dependency declaredcrates/jcode-provider-grok-build-runtime/update_product.rswas rewritten by7fdbe2f6c(#113) and droppedSELF_UPDATE_ENABLED+require_update_channel, whichupdate.rsstill calls at :212, :272, :489, :985crates/jcode-app-core/ScheduledItemmissingrecurrence(E0063)crates/.../runner_live_delivery_tests.rsBlockers only to lib-test targets (3)
These are invisible to
cargo check --workspace, which does not build test targets. All three were found only undercargo test --workspace --lib.jcode-tuicache_expected_warmunreachable from themod.rstest modulejcode-harness-api-serverOutbound::Reply(Box<ServerFrame>)as unboxed (E0308); plus one stalejcode-secretassertion that should bekcode-secretjcode-setup-hintskcodefield that does not exist onConflict(E0609); only one site, the siblings already usedjcodeVerification
Known failures intentionally NOT fixed here
jcode-setup-hintshas 6 remaining runtime test failures that are pre-existing behaviour bugs, not build breaks. All six are in files last touched by6cf71ed4e(#98), and none are caused by the changes in this branch.linux_env::tests::gnome_list_merge_preserves_foreign_entries_and_replaces_oursleft: 0, right: 1atlinux_env.rs:831linux_env::tests::kde_ini_upsert_replaces_our_sections_and_keeps_othersleft: 0, right: 1atlinux_env.rs:890linux_niri::shortcut_tests::failed_forwarding_does_not_launch_a_terminalleft: Some(0), right: Some(7)linux_niri::shortcut_tests::regular_desktop_shortcuts_forward_exact_aliaseskittywhere the test expects awtypechord sequencemacos_launcher::...::macos_notification_bundle_is_faceless_and_uses_multicall_binaryjcode-notification-broker, production constant iskcode-notification-broker(macos_launcher.rs:23)setup_hints_tests::first_three_launches_can_include_hotkey_notice_toosetup_hints_tests.rs:38Fixing these needs product decisions about intended behaviour (Gnome/KDE merge semantics, which binary the niri shortcuts should forward to, and the broker id), so they are flagged rather than silently patched.
One more finding, also deliberately untouched
The product-identity API introduced by
7fdbe2f6c(#113) is entirely dead code.update_repo,resolve_update_repo,update_repo_forandfork_update_disallowed_errorhave no callers:update.rsstill declares its ownconst GITHUB_REPO: &str = "KooshaPari/KCode"at line 36 and never consults the new API. This is the reason for the 7 "never used" warnings in the build output. Left as-is because deciding whether #113's API orupdate.rs's constant wins is an operator call.tx-agent: jcode
tx-validated: test
CodeAnt-AI Description
Restore workspace checks and keep KCode self-updates disabled
What Changed
Impact
✅ Workspace checks and library tests can run✅ KCode avoids incompatible upstream self-updates✅ Resume tests verify history delivery without hanging💡 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:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
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:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
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.