Skip to content

fix: improve persisted logs and peer recovery#947

Open
ovitrif wants to merge 10 commits into
masterfrom
fix/logs-spam-and-size
Open

fix: improve persisted logs and peer recovery#947
ovitrif wants to merge 10 commits into
masterfrom
fix/logs-spam-and-size

Conversation

@ovitrif
Copy link
Copy Markdown
Collaborator

@ovitrif ovitrif commented May 17, 2026

This PR:

  1. Rotates persisted logs at about 1 MB, uses timestamped bitkit_YYYY-MM-DD_HH-MM-SS file names, and keeps retained logs bounded by age and total size.
  2. Removes persisted PERF log spam while keeping thresholded slow-operation PERF logs persisted in every build.
  3. Keeps persisted logs across wallet wipe/restore instead of clearing them as a debug-only side effect.
  4. Codifies that persisted log tags, names, labels, and references must stay mechanically traceable to the caller instead of being rewritten as prose.
  5. Improves support archives by adding a node/support snapshot and trimming included persisted logs to fit the upload limit.
  6. Adds logging for Lightning peer and channel support summaries around node startup and LNURL channel connection failures.
  7. Bumps ldk-node to 0.7.0-rc.40 from feat: persist restored channel peers ldk-node#82 so announced restored channel counterparties can be recovered into the peer store.

Description

This is the Bitkit side of the support-ticket cleanup around oversized persisted logs and restored external Lightning channels.

The log changes keep persisted logs useful for support without allowing one long TRACE session to dominate the archive. They also stop wallet wipe/restore from clearing logs, matching iOS and preserving the exact history support needs after a recovery flow. The peer diagnostics make it easier to see whether channels, connected peers, and persisted peers line up when investigating a wallet that has channel state but no usable peer connection.

The ldk-node bump consumes synonymdev/ldk-node#82 and release v0.7.0-rc.40, which restores missing announced channel peers from the network graph during node startup.

Preview

N/A - logging changes.

QA Notes

Manual Tests

Self-checks
  • 1. Pixel 10 Pro dev build (to.bitkit.dev) -> launched app and inspected files/logs through run-as: new persisted logs are named bitkit_YYYY-MM-DD_HH-MM-SS.log.
  • 2. Pixel 10 Pro dev build -> inflated the active persisted log above 1 MB, triggered in-app logging, and confirmed rotation continued in bitkit_2026-05-17_18-44-47.part_002.log.
  • 3. Pixel 10 Pro dev build -> Drawer -> Support -> Report Issue: form opens from the support screen.
To Check
  • 4. Submit Report Issue and confirm archive upload includes recent persisted logs plus support_snapshot.json.
  • 5. regression: Recovery Mode -> wipe wallet -> restore wallet -> Drawer -> Support -> Report Issue: persisted logs from before the wipe are still available.
  • 6. Restored wallet with announced external LN channel -> launch Bitkit -> wait for node startup: counterparty peer is restored/reconnected without manually connecting it, and the channel becomes usable when the peer is online.
  • 7. LNURL channel flow with unreachable peer: failed peer connection is surfaced and logged before the channel request proceeds.

Automated Checks

  • ./gradlew installDevDebug on attached Pixel 10 Pro.
  • ./gradlew compileDevDebugKotlin testDevDebugUnitTest detekt
  • git diff --check
  • Source check: Logger.perf(...) persists via saver.save(message) and measured(...) no longer checks Env.isDebug.
  • Source check: WakeNodeWorker keeps measured(label = "doWork", context = TAG, ...) and AGENTS.md has the short mechanical log naming rule.
  • Source check: WipeWalletUseCase no longer calls Logger.reset(), so wallet wipe/restore no longer clears persisted logs unless the user explicitly wipes logs.
  • Source check: LogsRepo creates bitkit_logs_YYYY-MM-DD_HH-MM-SS.zip, includes support_snapshot.json, and accepts rotated .part_###.log files.
  • Upstream validation: feat: persist restored channel peers ldk-node#82 rebuilt bindings, release v0.7.0-rc.40 is published, and Bitkit depends on it.
  • GitHub checks observed: PR's detekt and lint passed.

CI Notes

  • claude-review is currently failing because Claude Code subscription is no longer available; this is unrelated to the code under test.

@ovitrif ovitrif self-assigned this May 17, 2026
@ovitrif ovitrif added this to the 2.3.0 milestone May 17, 2026
@ovitrif ovitrif marked this pull request as ready for review May 17, 2026 19:16
@ovitrif ovitrif requested review from ben-kaufman and jvsena42 May 17, 2026 19:16
@ovitrif ovitrif enabled auto-merge May 17, 2026 23:04
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.

1 participant