)]}'
{
  "commit": "23a7b7f6158547e9ab4533a64104bb508062926b",
  "tree": "6c7b04b4d6638c88cd6957919bdaae96e4a49479",
  "parents": [
    "f6b5338ff435eb16744015a705036162b906ebbd"
  ],
  "author": {
    "name": "Sam Goldman",
    "email": "samgoldman@meta.com",
    "time": "Wed Aug 26 21:35:33 2026 -0700"
  },
  "committer": {
    "name": "Sam Goldman",
    "email": "samwgoldman@gmail.com",
    "time": "Fri Aug 28 16:12:35 2026 -0700"
  },
  "message": "Use a single queue for all TSP connections\n\nSummary:\nThe TSP supports secondary (\"extra\") connections which Pylance uses to\ncommunicate to Pyrefly from a background thread. Before this change, Pyrefly\ndispatched requests received on extra connections directly in a separate thread.\nWith this change, the extra connection instead inserts the request into the\n`lsp_queue`, so all requests are handled by the same thread.\n\nBecause we use a single loop for requests from different clients, it\u0027s important\nthat responses are routed to the correct one. To make this safer, this change\nalso refactors the structure of the TSP. Before, the event loop was owned by\n`TspMainConnection` which also owns the `Sender` object, meaning all request\nhandlers had access to that sender from `self`. It seemed too risky to me that\ncode might accidentally send responses to the wrong client.\n\nTo address the risk, the event loop is now owned by `TspServer` and both the\nmain and extra connections provide a `Reply` object for each event: the server\nowns no channel, and a handler can only reach the channel it was given.\n\nThis change also enables a stacked change -- all request handlers now share a\nsingle `TransactionManager` object. The transaction manager is also used in the\nLSP and helps deal with concurrent request handling, so a recheck and read-only\nrequest can run in parallel and multiple read-only requests can build on top of\none another before a recheck commits. The stacked change uses that to optimize\nthe TSP.\n\nTest Plan:\nReplayed a captured Pylance session (pandas, 45251 TSP messages over both the\nstdio and IPC connections) against `pyrefly tsp`. All 45102 requests were\nanswered on the connection that sent them and total request time is\nunchanged.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "431a4a40fc00889f0e696b3625886d4b81068dfb",
      "old_mode": 33188,
      "old_path": "pyrefly/lib/lsp/non_wasm/queue.rs",
      "new_id": "7d5323d24c0f5640cefb80a4215549a0e9ec0374",
      "new_mode": 33188,
      "new_path": "pyrefly/lib/lsp/non_wasm/queue.rs"
    },
    {
      "type": "modify",
      "old_id": "9b40b4155f88d96818acd63ea2d4b8a843f2ad36",
      "old_mode": 33188,
      "old_path": "pyrefly/lib/lsp/non_wasm/server.rs",
      "new_id": "b42c35c4aac7380421489f9d2a2b3b13d88eb867",
      "new_mode": 33188,
      "new_path": "pyrefly/lib/lsp/non_wasm/server.rs"
    },
    {
      "type": "modify",
      "old_id": "67cb45276d60952ec0471b36345bafebeb0d44f2",
      "old_mode": 33188,
      "old_path": "pyrefly/lib/test/tsp/tsp_interaction.rs",
      "new_id": "3cc124439f2152642e47a2cb70e5f2ab564b4bad",
      "new_mode": 33188,
      "new_path": "pyrefly/lib/test/tsp/tsp_interaction.rs"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "8ff90b09bc76204ffa0c6c2b23b050a7de9f0f08",
      "new_mode": 33188,
      "new_path": "pyrefly/lib/test/tsp/tsp_interaction/request_errors.rs"
    },
    {
      "type": "modify",
      "old_id": "d96e9a42ae230c9f3d3fc588e7c17130b6bf9e65",
      "old_mode": 33188,
      "old_path": "pyrefly/lib/tsp/requests/get_computed_type.rs",
      "new_id": "2145ff48d11be2cf34e5337b36656a447061a494",
      "new_mode": 33188,
      "new_path": "pyrefly/lib/tsp/requests/get_computed_type.rs"
    },
    {
      "type": "modify",
      "old_id": "c2eaad23d969cf7c9f2800bffad966e6f77c6a4d",
      "old_mode": 33188,
      "old_path": "pyrefly/lib/tsp/requests/get_declared_type.rs",
      "new_id": "96b46c409613869007cc37fa4ec3a01357dc7854",
      "new_mode": 33188,
      "new_path": "pyrefly/lib/tsp/requests/get_declared_type.rs"
    },
    {
      "type": "modify",
      "old_id": "a229253cb7949928f9935b54ae93909e8f4821ba",
      "old_mode": 33188,
      "old_path": "pyrefly/lib/tsp/requests/get_expected_type.rs",
      "new_id": "e993ea7dde5b30e1bba949c2f37c56357272ae69",
      "new_mode": 33188,
      "new_path": "pyrefly/lib/tsp/requests/get_expected_type.rs"
    },
    {
      "type": "modify",
      "old_id": "a4e94b20ab2714b69c3262664a4ce8fa8f03eed1",
      "old_mode": 33188,
      "old_path": "pyrefly/lib/tsp/requests/get_python_search_paths.rs",
      "new_id": "c68ed34b9edf41deb3b25482c268570c80e998cc",
      "new_mode": 33188,
      "new_path": "pyrefly/lib/tsp/requests/get_python_search_paths.rs"
    },
    {
      "type": "modify",
      "old_id": "d81752ca6d9b1351c8e5932ac757d48828d0ec31",
      "old_mode": 33188,
      "old_path": "pyrefly/lib/tsp/requests/get_snapshot.rs",
      "new_id": "0b864090b4d2c92e141d1000936cdee56d8cf56c",
      "new_mode": 33188,
      "new_path": "pyrefly/lib/tsp/requests/get_snapshot.rs"
    },
    {
      "type": "modify",
      "old_id": "d130753f0cdcac935aba1be6caed77c7566dfab9",
      "old_mode": 33188,
      "old_path": "pyrefly/lib/tsp/requests/get_supported_protocol_version.rs",
      "new_id": "3a63388cf8a5f081fc4232159d516719002d032b",
      "new_mode": 33188,
      "new_path": "pyrefly/lib/tsp/requests/get_supported_protocol_version.rs"
    },
    {
      "type": "modify",
      "old_id": "a41f43530af43563ba69b84a9f70d127ff27598e",
      "old_mode": 33188,
      "old_path": "pyrefly/lib/tsp/requests/resolve_import.rs",
      "new_id": "76eb00a72a3d79c1f8b382d0e0b0446997920ea8",
      "new_mode": 33188,
      "new_path": "pyrefly/lib/tsp/requests/resolve_import.rs"
    },
    {
      "type": "modify",
      "old_id": "32013838feb19db08e1751260599ece059f90c58",
      "old_mode": 33188,
      "old_path": "pyrefly/lib/tsp/server.rs",
      "new_id": "c748b392fb68c4e5ba0dccc00f98504b846450ea",
      "new_mode": 33188,
      "new_path": "pyrefly/lib/tsp/server.rs"
    }
  ]
}
