Skip to content

Cleanup output#43

Merged
chee merged 1 commit into
mainfrom
tighten-up
Jul 4, 2026
Merged

Cleanup output#43
chee merged 1 commit into
mainfrom
tighten-up

Conversation

@expede

@expede expede commented Jul 3, 2026

Copy link
Copy Markdown
Member

A couple fixes:

  • Bump to latest subducted am-repo
  • Don't redundantly resync docs four times on some code paths
  • Fix benign warning output
  • Properly format true error output
  • Only print SYNCED when it actually synced (currently also says that if there was an error)
  • Haven't been able to reproduce it today, but in theory remove 60s+ hang that happened sometimes

Formatting

Before 😞

$ pushwork init
┌   pushwork init 

[lifecycle] 2026-07-03T00:17:09.949Z subduction ws connecting to wss://subduction.sync.inkandswitch.com
◇  Connecting to sync server (35ms)

◇  Reading working tree (51ms)

◐  Encoding 282 files[lifecycle] 2026-07-03T00:17:10.233Z subduction ws connecting to wss://subduction.sync.inkandswitch.com
[lifecycle] 2026-07-03T00:17:10.241Z subduction ws connecting to wss://subduction.sync.inkandswitch.com
[lifecycle] 2026-07-03T00:17:10.236Z subduction ws connecting to wss://subduction.sync.inkandswitch.com
[lifecycle] 2026-07-03T00:17:10.246Z subduction ws connecting to wss://subduction.sync.inkandswitch.com
[lifecycle] 2026-07-03T00:17:10.258Z subduction ws connecting to wss://subduction.sync.inkandswitch.com
◓  Encoding 282 files[lifecycle] 2026-07-03T00:17:10.265Z subduction ws connecting to wss://subduction.sync.inkandswitch.com
[lifecycle] 2026-07-03T00:17:10.267Z subduction ws connecting to wss://subduction.sync.inkandswitch.com
[lifecycle] 2026-07-03T00:17:10.269Z subduction ws connecting to wss://subduction.sync.inkandswitch.com
[lifecycle] 2026-07-03T00:17:10.331Z subduction ws connected to wss://subduction.sync.inkandswitch.com
◒  Encoding 282 files..[lifecycle] 2026-07-03T00:17:11.764Z subduction ws connected to wss://subduction.sync.inkandswitch.com
◒  Encoding 282 files...[lifecycle] 2026-07-03T00:17:12.073Z subduction ws connected to wss://subduction.sync.inkandswitch.com
[lifecycle] 2026-07-03T00:17:12.102Z subduction ws connected to wss://subduction.sync.inkandswitch.com
[lifecycle] 2026-07-03T00:17:12.108Z subduction ws connected to wss://subduction.sync.inkandswitch.com
◓  Encoding 282 files...[lifecycle] 2026-07-03T00:17:12.211Z subduction ws connected to wss://subduction.sync.inkandswitch.com
◑  Encoding 282 files...[lifecycle] 2026-07-03T00:17:12.350Z subduction ws connected to wss://subduction.sync.inkandswitch.com
◐  Encoding 282 files.[lifecycle] 2026-07-03T00:17:13.586Z subduction ws connected to wss://subduction.sync.inkandswitch.com
◐  Encoding 282 files.[lifecycle] 2026-07-03T00:17:13.991Z subduction ws disconnected from wss://subduction.sync.inkandswitch.com
◑  Encoding 282 files.[lifecycle] 2026-07-03T00:17:14.160Z subduction ws disconnected from wss://subduction.sync.inkandswitch.com
◒  Encoding 282 files.[lifecycle] 2026-07-03T00:17:14.249Z subduction ws disconnected from wss://subduction.sync.inkandswitch.com
◐  Encoding 282 files..[lifecycle] 2026-07-03T00:17:14.263Z subduction ws disconnected from wss://subduction.sync.inkandswitch.com
[lifecycle] 2026-07-03T00:17:14.322Z subduction ws disconnected from wss://subduction.sync.inkandswitch.com
◒  Encoding 282 files..[lifecycle] 2026-07-03T00:17:14.505Z subduction ws disconnected from wss://subduction.sync.inkandswitch.com
◑  Encoding 282 files[lifecycle] 2026-07-03T00:17:15.775Z subduction ws disconnected from wss://subduction.sync.inkandswitch.com
◒  Encoding 282 files.[lifecycle] 2026-07-03T00:17:16.810Z subduction ws connected to wss://subduction.sync.inkandswitch.com
◒  Encoding 282 files[lifecycle] 2026-07-03T00:17:18.443Z subduction ws disconnected from wss://subduction.sync.inkandswitch.com
◇  Encoding 282 files (8.5s)

◒  Publishing to sync server..[lifecycle] 2026-07-03T00:17:20.221Z subduction ws disconnected from wss://subduction.sync.inkandswitch.com
◇  Publishing to sync server (1.70s)

│  Path     /home/expede/Documents/Soft/ts-odd
│  Files    282 tracked
│  Backend  subduction
│  Sync     wss://subduction.sync.inkandswitch.com

│   INITIALIZED  automerge:3XK8ADzh2q19qfJnMirTrd9ssfse

│   SYNCED 

│  root doc      automerge:3XK8ADzh2q19qfJnMirTrd9ssfse
│  sync server   f709c58c1951bb8375d99495b2b9404abb1b84677a8ba5d6789e126894414c19
│  connected in  364ms
│  root heads    2p9QSEwCypvau88sS9LgNJrigbqPSV6uni99M8fcYaE9n7iT9q
│  server heads  2p9QSEwCypvau88sS9LgNJrigbqPSV6uni99M8fcYaE9n7iT9q

└  Done

After 🚀

$ pushwork init
┌   pushwork init 

◇  Connecting to sync server (38ms)

◇  Reading working tree (32ms)

◇  Encoding 282 files (4.4s)

◇  Publishing 282 files to the sync server (1.64s)

│  Path     /home/expede/Documents/Soft/ts-odd
│  Files    282 tracked
│  Backend  subduction
│  Sync     wss://subduction.sync.inkandswitch.com

│   INITIALIZED  automerge:thJsi94eashA3iKr8HcV4qKonVW

│   SYNCED 

│  root doc      automerge:thJsi94eashA3iKr8HcV4qKonVW
│  sync server   f709c58c1951bb8375d99495b2b9404abb1b84677a8ba5d6789e126894414c19
│  root heads    4RFxmDKpRErtWVPmnKBcnNN29ZBUp4EaSSoX7X9KDDCYFjJhW
│  server heads  4RFxmDKpRErtWVPmnKBcnNN29ZBUp4EaSSoX7X9KDDCYFjJhW

└  Done

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR cleans up CLI sync output and improves resilience when the sync server is unreachable by (a) suppressing noisy automerge-repo connection logs, (b) bounding shutdown to avoid occasional long hangs, and (c) refining sync status reporting to avoid false “SYNCED” claims.

Changes:

  • Route automerge-repo logging through debug by default, with surfaced error logs in the main CLI, and suppress benign transport-level uncaught errors/rejections.
  • Add bounded teardown (safeShutdown), connection timing (waitForConnection + connectMs), resync de-duplication, and a two-way “synced/pending” verdict.
  • Add unit + integration tests covering transport error classification, sync verdicts, bounded shutdown, and unreachable-server behavior (including sharded workers).

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/unit/sync-helpers.test.ts Adds offline unit tests for new sync-reliability helpers (transport errors, verdict, resync dedup, bounded shutdown, connection timing).
test/integration/resilience.test.ts Adds a black-box guard ensuring unreachable sync server doesn’t hang, doesn’t claim SYNCED, and doesn’t leak connection logs (main + workers).
src/repo.ts Implements logging routing, bounded shutdown, transport error classification, connection timing, resync de-dup, and “synced vs pending” verdict logic.
src/pushwork.ts Uses bounded shutdown everywhere and attaches connection timing to sync snapshots; reduces redundant sync/resync paths.
src/cli.ts Suppresses benign transport-level uncaught errors/rejections and surfaces automerge-repo error logs via the CLI UI; updates sync reporting (pending/connect).
package.json Bumps Automerge/automerge-repo dependency versions to the latest subduction variants used by this PR.
pnpm-lock.yaml Updates the lockfile to match the bumped Automerge/automerge-repo versions.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/repo.ts
* Bump to latest subducted am-repo
* Don't redundantly resync docs four times on some code paths
* Fix benign warning output
* Properly format true error output
* Haven't been able to reproduce it today, but in theory remove 60s+ hang that happened sometimes
@expede expede marked this pull request as ready for review July 3, 2026 20:12
@chee chee merged commit d1f4f65 into main Jul 4, 2026
1 of 4 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.

3 participants