Repository navigation
Conversation
CNB is Tencent's code hosting platform. Its API is not a GitHub or Gitea dialect: the REST base is a separate host (api.cnb.cool), auth is a Bearer token, ids are strings on the wire, and issues/merge requests are separate collections. A GitHub fallback would answer every request with an HTML page and a 200, so it gets its own provider variant and client. Backend: - forge/cnb.rs: list/detail/comments/labels/state/create for issues and merge requests, changed-file list, merge, and the delivery path (find/create/get pull), plus the scan used by auto-processing - ForgeProvider::Cnb wired through mod.rs, auth.rs (host detection, api_base_for, web_origin), auto, deliver and every forge_* command - validate_cnb_token: GET /user against api.cnb.cool, with 403 read as a missing scope rather than a bad token - forge_issue_detail: CNB's issue LIST omits the body, so the panel reads the item itself when it opens (CNB only; other forges ship it on the row) Frontend: - CNB accounts section, add-account dialog, token validation - merge-request wording for CNB everywhere GitLab already had it - forge page: hide the search box on CNB's PR tab (no keyword parameter), drop least-recently-updated from its sort options (no ascending updated order), and reset a filter that the current forge cannot apply - useIssueBody: fetch an issue's description on demand, drawing nothing until the answer lands rather than flashing "No description" - i18n for all 10 locales
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds CNB (cnb.cool) as a fourth forge provider, alongside GitHub, GitLab and Gitea — in the repository panel, the delivery path, auto-processing, and Settings → Version Control.
CNB is not a GitHub/Gitea dialect, and the differences produce silently wrong answers rather than 404s, so it gets its own client (
src-tauri/src/forge/cnb.rs):api.cnb.cool), not the web origin;Authorization: Bearer <token>;number;/-/issues,/-/pulls);state: "closed"+is_merged: true— the flag, not the state, says "landed";403means a missing token scope, anderrmsgnames it.Behaviour worth reviewing
body(its pull list carries one), soforge_issue_detailfetches the item when the panel opens — one request, only for the item being read. Every other forge ships the body on the row and never takes this path (the command errors loudly if one ever does).keywordexists on issues only; on pulls it is ignored, so the box would be a control whose input is dropped. A query left over from the other tab is cleared rather than silently kept.least_recently_updatedorder for CNB. Itsorder_byhas no ascending-updated spelling.mergeable_state: "checking"maps to "unknown", not "mergeable".Ok(None)after landing — the merge succeeded even if the read-back fails.Tests
forge/cnb.rspin the wire-shape traps: string numbers, absent issue body,refs/heads/stripping, the merged flag beatingclosed, the per-collection spelling of "all", and file paths recovered from URLs (filenameis only a base name).#[ignore]d live smoke test (CNB_TEST_TOKEN=… cargo test … forge::cnb::tests::live -- --ignored) for wire-shape drift.useIssueBodydraws nothing until the read lands (rather than flashing "No description"), and a row that arrives with a body never pays for a second read.Checks
pnpm lint .✅cargo check --features test-utils✅pnpm test— 2 pre-existing failures unrelated to this change (task-schedule-dialogis date-dependent and fails at HEAD;activity-rowsis a timing flake)