Repository navigation
fix(update): resolve #104 three blockers (prefix allowlist, identity override, size budget) - #113
KooshaPari wants to merge 5 commits into
Conversation
The updater hardcoded `const GITHUB_REPO: &str = "1jehuang/jcode"`, so every build -- including fork builds -- resolved GitHub releases from upstream jcode and installed them over itself. For a fork product that silently replaces the fork binary with upstream code, which breaks product decollision: jcode and the fork are separate products with separate release channels, separate binaries and forward-only data sync. Make "which repo may this build update itself from" a product-identity question rather than a hardcoded constant: - crates/jcode-app-core/src/update_product.rs (new): resolves the update repo slug and returns `None` for a fork build. `None` is fail-closed and every caller treats it as "auto-update is unavailable", never as "fall back to upstream". Identity is read from the build's semver channel suffix (`BASEVERSION-<letter>semver[-channel]`), reusing the convention jcode-build-meta already parses, so it needs no new build-time knob and cannot drift from `--version`. - update.rs: should_auto_update() bails before the periodic background check fires; fetch_latest_release_blocking() and latest_main_sha_blocking() bail instead of building an upstream URL; both network call sites return fork_update_disallowed_error() so `/update` reports a clear reason rather than an opaque network failure or a false success. Tests cover fork semvers never resolving to the upstream slug, upstream semvers keeping their behavior, the empty-channel and `v`-prefix edge cases, and that the live resolver agrees with the pure resolver. tx-agent: jcode tx-validated: manual tx-intent: stop a fork build self-replacing with upstream code tx-scope: crates/jcode-app-core/src/update.rs, crates/jcode-app-core/src/update_product.rs
) The decollation change in 1a3f491 grew the already-oversized update.rs from 1771 to 1784 LOC, which tripped scripts/check_code_size_budget.py (exit 1 on this branch, exit 0 on pristine master 748eeaa). The script's policy is that existing tracked oversized files must shrink or stay flat, so an explicit --update baseline refresh would have hidden new debt. Instead the growth is paid for by moving code out: - resolve_update_repo() added to update_product.rs: collapses the two repeated `let Some(repo) = update_repo() else { bail }` blocks in update.rs into one call each. Behavior is identical, only the redundant boilerplate at two call sites is gone. - is_inside_git_repo() moved from update.rs into update_product.rs; the wrapper in update.rs delegates. The dev-checkout guard in should_auto_update is unchanged in behavior. Result: update.rs is now 1768 LOC, down from the 1771 LOC baseline, so the gate reports an improvement rather than a regression. update_product.rs is 198 LOC, well under the 1200 threshold and no new oversized file exists. The baseline file scripts/code_size_budget.json is untouched. tx-agent: jcode tx-validated: manual tx-task: "#94" tx-intent: satisfy the repo's own code-size ratchet without raising the baseline
Add the missing trailing newline so `cargo fmt --check` passes (was exit 1). Suppress the new dead_code warning on `is_fork_build` with the crate's established `#[allow(dead_code)]` pattern (40 existing uses). Measured after this commit: - cargo fmt --check exit 0 - cargo clippy -p jcode-app-core --lib exit 0 (no update_product warnings) - python3 scripts/check_code_size_budget.py exit 0 - cargo test -p jcode-app-core --lib update exit 0 (97 passed, 1 ignored) tx-agent: jcode tx-validated: lint tx-scope: crates/jcode-app-core/src/update_product.rs tx-intent: close the last two quality gates on PR #94
…into fix/pr94-three-blockers
…override, size budget) Issue 1: Tighten semver_has_channel() to a known fork-prefix allowlist (k, p, fork-) instead of treating any nonempty suffix after "-" as a fork marker. Upstream prereleases like 1.0.0-alpha.1 are no longer misclassified as fork builds. Added tests: upstream_prereleases_are_not_forks, fork_prefix_is_recognized, bare_fork_prefix_is_not_valid. Issue 2: Add identity guard to current_semver(). A JCODE_RUNTIME_RELEASE_SEMVER override that would change product identity (fork->upstream or upstream->fork) is now rejected with a SECURITY warning log, and the compiled semver is used as the authoritative identity. Closes the CodeAnt HIGH RISK attack path. Issue 3: update.rs is 1768 LOC (under 1771 budget). The merge with PR #94 branch already moved update_repo()/is_inside_git_repo() helpers to update_product.rs. No additional code movement needed. Closes #104 Follow-up to PR #94 tx-agent: crane tx-validated: cargo-check tx-scope: crates/jcode-app-core/src/update_product.rs tx-intent: resolve three blockers filed in #104 against PR #94
🤖 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 47 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 PR Risk: Low Risk
Assessed commit: |
…override, size budget) (#113) Pick up just the `update_product.rs` half of #113 (which carried the real fixes) — the `update.rs` portion of the PR overlaps with #98's rename and is no longer needed. tx-agent: jcode tx-validated: manual tx-scope: crates/jcode-app-core/src/update_product.rs tx-intent: close #104 with the prefix-allowlist + identity-override fixes tx-pr: 113
…merge from chore/xirp-custom-harness-discovery-20261014
Squash-consolidates 64 commits from chore/xirp-custom-harness-discovery-20261014
into a single commit on master. The branch's atomicity is preserved on
origin/chore/xirp-custom-harness-discovery-20261014 (immutable history).
Subagent findings shipped on this commit (all 5 subagents DONE):
* mizaru (T1): vendor-contact-search — 9 candidate channels exhausted,
no public Xirp contact exists. -> STATE.md §19.1 + vendor-question-draft.md
'Channel options' footer (operator must use personal/internal Spotify contact).
* hibiscus (T1): xj07-spec-discovery — spec found verbatim at
docs/XIRP_CUSTOM_HARNESS.md:132. -> STATE.md §23 (5 acceptance criteria
+ 4-step implementation sketch). XJ-07 marked as the highest-leverage
bounded-work item (fully Jcode-side, no vendor change needed).
* daisy (T1): jcode-fork §22 audit — 3 matches (PRs #64, #67, #75 on
KooshaPari/Jcode, identical SHAs to KCode). Forks share pre-2026-10-08
history. -> §22-NEW-FINDING 'Cross-fork audit' section.
* blossom (T1): kcode-open-PR §22 audit — 0 matches in 13 OPEN PRs
(live count, not the 9 estimated). All §22-pattern PRs already
accounted for. PR #25/#26 flagged as separate-class problem (orphan
issue link, NOT edited per stop condition). -> §22-NEW-FINDING
'OPEN KCode PRs audit' + closed-loop section.
* cactus (T2): xj03-bridge-deploy — 4 deliverables:
1. scripts/portal-mcp-bridge.json ([email protected] entry)
2. scripts/stub-cimd-server.py (local SEP-991 CIMD server)
3. scripts/test-portal-bridge.sh (verification harness)
4. docs/sessions/2026-10-15-portal-xirp-resume/XJ-03-DEPLOY.md
(8-step unblock checklist + open redirect_uri path issue)
Real deploy blocked on 3 sequential conditions (CIMD Worker live,
Spotify allow-list append, redirect_uri path confirmation).
-> STATE.md §24.
PR 103 superseded by this commit. The branch is left intact at origin
(per AGENTS.md 'the PRs are intentionally left OPEN; SHA-equivalence of
the merge commits is the authoritative truth').
Also carries one upstream-related commit already on local master:
7fdbe2f fix(update): resolve #104 three blockers (PR #113)
This was on local master ahead of origin; included in the push.
tx-agent: jcode
tx-validated: manual
tx-task: xj03-bridge-deploy+squash-merge
tx-scope: docs/ scripts/ crates/jcode-app-core/src/update_product.rs
tx-parent: chore/xirp-custom-harness-discovery-20261014@ceba3e297
tx-intent: Land the full 5-subagent XJ-* discovery + audit-correction
arc on master as a single squash-commit, preserving the
branch's atomicity in immutable history.
Already landed on
|
| Check | Result |
|---|---|
| Master commit | 7fdbe2f6c2acd466f8f8740c79de6ad2a3695cbf — subject fix(update): resolve #104 three blockers (prefix allowlist, identity override, size budget) (#113) |
| Committed | 2026-10-17T07:41:28Z, author Koosha Paridehpour |
| Base lineage | PR base 6cf71ed4efb9b1f256b2fcd00e95748309fa6d0b is an ancestor of 7fdbe2f6c; 7fdbe2f6c is the only commit in that range |
| Content equivalence | git show 7fdbe2f6c:crates/jcode-app-core/src/update_product.rs | md5 = 9ac614be3e40ff483c03878afe015338 — identical to the same file at PR head 9f4906c21d9ee89a259bb856a8642b7080580139 |
| Scope match | 7fdbe2f6c touches only crates/jcode-app-core/src/update_product.rs (327 ins / 19 del), matching this PR's scope |
| Tests present on master | upstream_prereleases_are_not_forks, fork_prefix_is_recognized, bare_fork_prefix_is_not_valid — all found |
So the three #104 blockers (fork-prefix allowlist, identity override, size budget) are live on master, which has since advanced 2 commits past the merge to e5f12cc05.
Local worktree restored
The CONFLICTING state that triggered this investigation was a null artifact. In warm worktree jcode-fp-2-crane:
git merge --abort(exit 0, 1184 files restored)git reset --hard 9f4906c21+git clean -fdq→git status --short= 0 entries, HEAD =9f4906c21d9ee89a259bb856a8642b7080580139
No --no-verify, no force push, no destructive operation, and no other agent's worktree was touched.
Note that master's crates/jcode-app-core/src/update.rs has since been decomposed into #[path] submodules (update_dev_guard, update_display, update_metadata, update_product, update_rate_limit) to satisfy the 500-line file-size mandate. The PR head's monolithic update.rs (798 lines) is therefore not a regression to resolve — master's split is authoritative, and this PR's actual deliverable was confined to update_product.rs, which is byte-identical on master.
Closing as already-merged.
| /// testable without depending on process-global build metadata. | ||
| pub fn update_repo_for(semver: &str) -> Option<&'static str> { | ||
| if is_fork_build_for(semver) { | ||
| log_disabled(semver); |
There was a problem hiding this comment.
SUGGESTION: update_repo_for is documented as the pure form of update_repo, but it calls log_disabled, which performs I/O/logging as a side effect. This makes the function impure and causes log output (and potential logging initialization) during unit tests and other callers. Move the log_disabled call into update_repo (or a wrapper) so update_repo_for stays a pure predicate.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| /// See Issue 2 from `KooshaPari/KCode#104`. | ||
| fn current_semver() -> &'static str { | ||
| let compiled = compiled_semver(); | ||
| let runtime = jcode_build_meta::runtime_release_semver(); |
There was a problem hiding this comment.
WARNING: runtime_release_semver() is not validated for emptiness. An empty runtime override (Some("")) preserves fork identity (both sides classify as upstream when compiled upstream), so current_semver() returns "", which then propagates into URL construction and error messages. Consider rejecting empty/whitespace-only runtime overrides the same way identity-changing ones are rejected.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (2 files)
Fix these issues in Kilo Cloud Reviewed by free · Input: 37.4K · Output: 2.6K · Cached: 310.7K |
…ash commits) 5 of 6 audited forward-path PRs squash-merged into master via the 2026-10-17 batch (security, PR94 blockers, cherry-picks, stdin, println, docs in priority order). 30 files / +2,900 / -78 LOC across the batch. Master pre-batch: 3f4746e Master post-batch: 521c66e Per-PR squash SHAs: #108 -> 827ff9d (cherry-pick from 17632a2b0) #109 -> 2f29ed0 (cherry-pick from 365d0a13a) #111 -> a1e19e5 (1 add/add conflict resolved: docs/GOOGLE_GUIDED_SETUP.md) #112 -> no-op (rustls patch already in master; PR closed) #113 -> 7fdbe2f (landed at cycle start; file-level cherry-pick of update_product.rs only) #114 -> 521c66e Source artifacts (canonical): phenotype-registry/audits/kcode-fork-forward-path-2026-10-17/ This directory: docs/audits/2026-10-17-forward-path-batch/ (HTML + PDF + README) tx-agent: jcode tx-validated: manual tx-scope: docs/audits/2026-10-17-forward-path-batch/ tx-intent: persist forward-path batch deliverables in source repo tx-pr: 115
|
|
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 |



User description
Summary
Resolves all 3 issues filed in #104 against PR #94 (
fix(update): fork builds never auto-update from upstream).Issue 1: prerelease detection treats every nonempty suffix as a fork
File:
crates/jcode-app-core/src/update_product.rsReplaced the
semver_has_channel()implementation that treated ANY nonempty suffix after-as a fork marker. New implementation uses a known-prefix allowlist (k,p,fork-) per the fork-versioning scheme in~/AGENTS.md. Upstream prereleases like1.0.0-alpha.1or1.0.0-rc.1are no longer misclassified as fork builds.Tests added:
upstream_prereleases_are_not_forks— 7 upstream prerelease stringsfork_prefix_is_recognized— 3fork-prefixed versionsbare_fork_prefix_is_not_valid— emptyfork-suffix rejectedIssue 2: runtime semver override can erase fork identity (CodeAnt HIGH RISK)
File:
crates/jcode-app-core/src/update_product.rsAdded identity guard to
current_semver(). IfJCODE_RUNTIME_RELEASE_SEMVERwould change product identity (fork→upstream or upstream→fork), the override is rejected with aSECURITYwarning log and the compiled semver is used as authoritative. Closes the attack path where a single env var can reclassify a fork build as upstream.Issue 3: size-budget gate FAILING
Status: Already resolved.
update.rsis 1768 LOC (under the 1771 budget). The merge with PR #94 branch movedupdate_repo()/is_inside_git_repo()helpers toupdate_product.rs.Note: This is a follow-up to PR #94 (now closed). It does NOT auto-merge with #94.
Closes #104
CodeAnt-AI Description
Prevent fork builds from updating from upstream
What Changed
Impact
✅ Fork binaries stay on their own release channel✅ Upstream prerelease updates remain available✅ Clear explanation when a fork update is requested💡 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.