Skip to content

Merge develop into v4 - #479

Merged
RetricSu merged 5 commits into
v0.4.xfrom
develop
Jul 30, 2026
Merged

Merge develop into v4#479
RetricSu merged 5 commits into
v0.4.xfrom
develop

Conversation

@RetricSu

Copy link
Copy Markdown
Collaborator

No description provided.

humble-little-bear and others added 5 commits July 25, 2026 08:21
A healthy devnet emits almost no warn-level logs, so with the previous
default filter (warn,ckb-script=debug) the `offckb status` Logs panel
stayed permanently empty and looked broken. Switch the devnet ckb.toml
and ckb-miner.toml templates (and the config editor's embedded reference
templates) to info,ckb-script=debug so the per-block log stream is
visible while script debug output is preserved.

Existing chains keep their current filter; edit [logger] filter in the
devnet ckb.toml to opt in.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The devnet ckb.toml template enables the Terminal RPC module, which only
exists since CKB v0.205.0 (nervosnetwork/ckb#4989). Older binaries abort
at startup with an opaque serde "unknown variant `Terminal`" error, and
migrateLegacyDevnetRpcConfig re-added the module on every `offckb node`
start even after users removed it by hand — an unbreakable crash loop for
anyone pinned to an old CKB.

- initChainIfNeeded takes the effective CKB version: fresh chains for a
  pre-0.205.0 binary are initialized from the template with Terminal
  stripped (tcp_listen_address, which predates 0.205.0, stays), and the
  legacy-config migration no longer re-adds Terminal for such binaries.
- nodeDevnet resolves the effective version (managed binaries know it;
  a custom --binary-path is probed via getVersionFromBinary) and fails
  fast with an actionable error when the existing config enables Terminal
  but the binary is too old, instead of letting CKB dump the serde error.
- A custom binary whose version cannot be probed keeps the historical
  behavior; if it then crashes with the tell-tale "unknown variant
  `Terminal`" stderr, the startup error now points at the actual cause.
- README's status section notes the CKB >= 0.205.0 requirement for the
  TUI's system-metric panels.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix(status): bump ckb-tui to v0.1.4 and reinstall stale binaries

ckb-tui v0.1.4 fixes a divide-by-zero panic in the dashboard data-sync
thread when the connected node has no peers (nervosnetwork/ckb-tui#13) —
the normal state of a single-node devnet — which permanently froze the
Overview, Mempool, Peers, and Blockchain panels seconds after opening
offckb status.

- Bump the default ckb-tui version to v0.1.4 and pin the SHA-256
  digests of its release assets.
- Pin digests of the extracted binaries as well and verify the
  installed binary against them in ensureInstalled(): ckb-tui's
  --version output lags its release tag (both v0.1.3 and v0.1.4
  binaries report 0.1.2), so a presence-only check would keep the
  panic-affected v0.1.3 binary installed forever. A stale or foreign
  binary is now removed and reinstalled; versions without a pinned
  binary digest keep the previous presence-only behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(status): keep the previous ckb-tui binary until the reinstall succeeds

Address review feedback on #476:

- ensureInstalled no longer deletes the installed binary up front.
  installSync already stages the download/verify/extract in a temp
  directory and publishes with an atomic rename, so a failed reinstall
  now leaves the previous binary untouched instead of stranding the
  user with no executable.
- installedBinaryMatches treats missing, unreadable, or non-regular
  paths (e.g. a directory at the binary location) as a mismatch and
  flows into the reinstall path instead of throwing raw fs errors out
  of ensureInstalled.
- Tests: the install spy now publishes the binary path like a real
  installSync, so the ensureInstalled return contract is asserted;
  added regression tests for failed-reinstall preservation and for
  non-regular paths.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(status): set aside directory targets and strict-check the ckb-tui binary

Second round of CodeRabbit review on the ckb-tui v0.1.4 bump:

- A directory occupying the install path made every reinstall fail with
  EISDIR (a file rename cannot replace a directory). publishExtractedBinary
  now sets the directory aside with a plain rename — its contents are never
  deleted — publishes the verified binary, and restores the directory if
  publishing fails.
- installedBinaryMatches required a regular, readable file only on some
  paths: the pinned branch hashed whatever was there, so a FIFO at the
  install path blocked ensureInstalled indefinitely, and the unpinned
  fallback accepted unreadable regular files. It now checks isFile() and
  R_OK up front for both branches.
- The successful install test spy now publishes a real regular file (and
  assertions verify type/content), with new regression tests for directory
  publish, restore-on-failure, FIFO, and unreadable binaries.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(status): don't let post-publish cleanup mask a successful ckb-tui install

Follow-up to the re-review of 0e1dd83:

- renameIntoPlace no longer unlinks the staged source after the publish
  rename succeeds: a failure there would have reported a correctly
  published binary as a failed install. The source lives in the temp
  directory, which installSync's finally block removes regardless.
- The FIFO regression test now mocks readFileSync to throw, so a
  regression fails fast (and asserts the FIFO is never opened) instead of
  hanging the Jest worker on a synchronous blocking read.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…de (#478)

* feat: unify devnet logging with offckb logs and a quiet foreground node

Add offckb logs [node|script|miner|rpc] [-f] [--grep] [--tail], reading
the log files CKB always writes (run.log/miner.log) plus a new proxy
event log, so logs are reachable in every run mode and pipe/agent
friendly.

A foreground offckb node is quiet by default: lifecycle events, live
contract script debug output (via the node's TCP log subscription, the
same channel ckb-tui uses), send_transaction hashes, and RPC errors
still print; --verbose restores the raw stdout relay.

The RPC proxy drops per-request lines to debug, warns on JSON-RPC
errors in responses, and appends everything to data/logs/proxy.log
(viewable via offckb logs rpc).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix: address PR review findings on logs command and proxy events

- node: sanitize relayed script log entries (CSI/OSC/C0/C1) via
  cleanChildOutput so crafted debug! output cannot inject terminal
  control sequences
- log-file: honor readSync's byte count and decode with a streaming
  TextDecoder so multi-byte UTF-8 survives chunk boundaries
- proxy-events: sanitize event text at the single event() choke point
  (one event = one line), normalize the response media type before the
  application/json check (charset params), and bound proxy.log with a
  single .1 rollover at 10 MB
- log-subscription: retry only during the initial connect window and
  track/unref/clear the retry timer so close() is fully synchronous
- cli: throw commander's InvalidArgumentError from the --tail parser
  and align the --verbose help text with the actual quiet defaults
- tests: add follow-mode script/grep, truncation/rotation, UTF-8 split,
  event sanitization, rollover, charset content-type, and subscription
  retry cases; move temp-dir handling to afterEach cleanup

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (5)
  • master
  • dev
  • releases/.*
  • develop
  • next-major

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 39e2cd0f-e61c-4265-bdff-0d1a98d51e76

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@RetricSu
RetricSu merged commit 1b4230e into v0.4.x Jul 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants