Repository navigation
refactor(pnpr): move libSQL connection code into pnpr-libsql - #17580
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
5504a6a to
9163ad6
Compare
Micro-Benchmark ResultsLinux |
Same-run regression checkHEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval. Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.
Same-run syscall checkEach install runs 2 more times per revision, untimed, under
Integrated-Benchmark Report (Linux)Commit: Compared against main at: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked, injected, and Cargo workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.4789304034200006,
"stddev": 0.08695649318993201,
"median": 2.48461022632,
"user": 2.3582602,
"system": 1.7729181999999999,
"min": 2.37485958032,
"max": 2.66959341432
},
{
"command": "pacquet@main",
"mean": 2.43440514442,
"stddev": 0.15109697117707874,
"median": 2.38295092632,
"user": 2.3091559000000004,
"system": 1.7646463000000001,
"min": 2.24473414332,
"max": 2.70972926932
},
{
"command": "pnpr@HEAD",
"mean": 1.3760882203199998,
"stddev": 0.10117361650106912,
"median": 1.33378938032,
"user": 1.8147031999999998,
"system": 1.4420022,
"min": 1.2912155483199999,
"max": 1.57690312432
},
{
"command": "pnpr@main",
"mean": 1.4401167894199998,
"stddev": 0.10839869217292657,
"median": 1.4055323603199998,
"user": 1.9547965999999999,
"system": 1.5053962,
"min": 1.30070354332,
"max": 1.58019268032
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.25886077956000003,
"stddev": 0.01521204225447872,
"median": 0.25484521336,
"user": 0.32471943999999997,
"system": 0.60224032,
"min": 0.23932414886000003,
"max": 0.28637541286
},
{
"command": "pacquet@main",
"mean": 0.25622070366000005,
"stddev": 0.00943950768643294,
"median": 0.25560701836,
"user": 0.30614443999999996,
"system": 0.62632732,
"min": 0.24489558086000002,
"max": 0.27831471986
},
{
"command": "pnpr@HEAD",
"mean": 0.27750785886000007,
"stddev": 0.01082965275363489,
"median": 0.27848181486,
"user": 0.32004424,
"system": 0.61613592,
"min": 0.25898921486000004,
"max": 0.29106652886
},
{
"command": "pnpr@main",
"mean": 0.25917220826000004,
"stddev": 0.010546756352110333,
"median": 0.25932663436000003,
"user": 0.30614933999999994,
"system": 0.57358522,
"min": 0.23545957386000002,
"max": 0.27321128186000004
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.009984244518181824,
"stddev": 0.0008751753164439428,
"median": 0.0099052107,
"user": 0.005677483636363634,
"system": 0.0051552168727272765,
"min": 0.007871727700000001,
"max": 0.013341857700000001
},
{
"command": "pacquet@main",
"mean": 0.009935349231598514,
"stddev": 0.0010346710394705365,
"median": 0.0098258007,
"user": 0.005807226617100374,
"system": 0.004993457546468403,
"min": 0.007605947700000001,
"max": 0.0157495647
},
{
"command": "pnpr@HEAD",
"mean": 0.009692620652218433,
"stddev": 0.0007715998324807579,
"median": 0.009658124700000001,
"user": 0.005808635221843003,
"system": 0.004660912491467579,
"min": 0.0078611277,
"max": 0.013596075700000002
},
{
"command": "pnpr@main",
"mean": 0.009947068297938151,
"stddev": 0.0007550673669185214,
"median": 0.0097331767,
"user": 0.006037644123711346,
"system": 0.00473042405498282,
"min": 0.0081195157,
"max": 0.0132437417
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.010118909453388428,
"stddev": 0.0006844705489459336,
"median": 0.010043724160000001,
"user": 0.005852677851239669,
"system": 0.005201282231404958,
"min": 0.00842547266,
"max": 0.012513846660000001
},
{
"command": "pacquet@main",
"mean": 0.009391126592000002,
"stddev": 0.0010666510824239236,
"median": 0.00910661366,
"user": 0.005343359999999999,
"system": 0.0048598604000000024,
"min": 0.007799492660000001,
"max": 0.01251656766
},
{
"command": "pnpr@HEAD",
"mean": 0.00996905456909091,
"stddev": 0.001078349044672339,
"median": 0.00973760366,
"user": 0.005930309090909093,
"system": 0.004900639272727276,
"min": 0.008168223660000001,
"max": 0.015188158660000001
},
{
"command": "pnpr@main",
"mean": 0.009716351592773117,
"stddev": 0.0007231076693915223,
"median": 0.00953404866,
"user": 0.005932704033613442,
"system": 0.004623878151260504,
"min": 0.00849887266,
"max": 0.012212036660000002
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.62504240212,
"stddev": 0.029504937128343994,
"median": 2.62819246732,
"user": 2.751837879999999,
"system": 1.72293572,
"min": 2.57392743782,
"max": 2.66697198882
},
{
"command": "pacquet@main",
"mean": 2.6245388800200002,
"stddev": 0.03643015695314347,
"median": 2.6224505353199996,
"user": 2.74304838,
"system": 1.6627799199999997,
"min": 2.57613596782,
"max": 2.69211628582
},
{
"command": "pnpr@HEAD",
"mean": 1.5414676477200004,
"stddev": 0.10344842626189234,
"median": 1.50254790432,
"user": 2.16780798,
"system": 1.58546732,
"min": 1.44480317082,
"max": 1.7276952408200001
},
{
"command": "pnpr@main",
"mean": 1.5537240671199999,
"stddev": 0.11344881190722447,
"median": 1.5119951713200002,
"user": 2.2008900799999997,
"system": 1.70269832,
"min": 1.4506923318200002,
"max": 1.7740512088200002
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.54154196304,
"stddev": 0.031835708019814994,
"median": 0.5373806133400001,
"user": 0.7743365799999999,
"system": 0.9547158,
"min": 0.49158137084000003,
"max": 0.60089588784
},
{
"command": "pacquet@main",
"mean": 0.5311480527400001,
"stddev": 0.032458610111434104,
"median": 0.52232392234,
"user": 0.78141398,
"system": 0.9985662000000002,
"min": 0.49146687284,
"max": 0.59801113784
},
{
"command": "pnpr@HEAD",
"mean": 0.34353772904,
"stddev": 0.020558723232217736,
"median": 0.34294724034,
"user": 0.32168267999999994,
"system": 0.6690748999999999,
"min": 0.30721335584000004,
"max": 0.37737603784
},
{
"command": "pnpr@main",
"mean": 0.33871633413999996,
"stddev": 0.013147330765645358,
"median": 0.33593800084000003,
"user": 0.32566428,
"system": 0.6294209000000001,
"min": 0.32154169584000003,
"max": 0.36128266084
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.79446520652,
"stddev": 0.05426900113808456,
"median": 1.78815286122,
"user": 1.184273,
"system": 1.0878181,
"min": 1.71567906122,
"max": 1.8776319462200002
},
{
"command": "pacquet@main",
"mean": 1.77356529132,
"stddev": 0.024522005587918637,
"median": 1.78513419072,
"user": 1.1539066999999998,
"system": 1.029447,
"min": 1.73750580722,
"max": 1.8025883922200001
},
{
"command": "pnpr@HEAD",
"mean": 0.36139155572000004,
"stddev": 0.01881521122742765,
"median": 0.35922990172,
"user": 0.35624750000000005,
"system": 0.6946794,
"min": 0.33939990922,
"max": 0.40097655422
},
{
"command": "pnpr@main",
"mean": 0.36792461892,
"stddev": 0.018364413209668633,
"median": 0.37157379822000003,
"user": 0.3677435,
"system": 0.6839550000000001,
"min": 0.34432146622000004,
"max": 0.39639294722
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2635687462890909,
"stddev": 0.013954656280507596,
"median": 0.25879121038,
"user": 0.23807582545454545,
"system": 0.3255730636363636,
"min": 0.24574678438,
"max": 0.28934651238000003
},
{
"command": "pacquet@main",
"mean": 0.2619880764709091,
"stddev": 0.010731431007098604,
"median": 0.26652257438,
"user": 0.25538518909090907,
"system": 0.28087251818181813,
"min": 0.23923015138,
"max": 0.27455387238
},
{
"command": "pnpr@HEAD",
"mean": 0.09210250770258067,
"stddev": 0.0026190066517042853,
"median": 0.09210266138,
"user": 0.03459031225806451,
"system": 0.022223732258064517,
"min": 0.08715703938000001,
"max": 0.09843860338000002
},
{
"command": "pnpr@main",
"mean": 0.09316707591125001,
"stddev": 0.003497789228079618,
"median": 0.09303942538000001,
"user": 0.034826029999999994,
"system": 0.023335918749999997,
"min": 0.08719053238,
"max": 0.09984824238000001
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2209705107066667,
"stddev": 0.02480437027110335,
"median": 0.21488202404,
"user": 0.23597095111111108,
"system": 0.041154368888888876,
"min": 0.18919376004000002,
"max": 0.26059178504
},
{
"command": "pacquet@main",
"mean": 0.2176983464844445,
"stddev": 0.00969249614697308,
"median": 0.22235114804,
"user": 0.23814884000000003,
"system": 0.04458803555555555,
"min": 0.19943341704,
"max": 0.22856300904000001
},
{
"command": "pnpm@HEAD",
"mean": 4.227623335151112,
"stddev": 0.1911998190252918,
"median": 4.18967435704,
"user": 6.502017617777778,
"system": 0.3739783688888889,
"min": 3.92439504304,
"max": 4.49837413704
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.08672286694666669,
"stddev": 0.005512485373264403,
"median": 0.08530187528,
"user": 0.08279664484848487,
"system": 0.051519842424242415,
"min": 0.07970044428,
"max": 0.10036722828
},
{
"command": "pacquet@main",
"mean": 0.09464548637375003,
"stddev": 0.014505453975122585,
"median": 0.09119144228,
"user": 0.09127591,
"system": 0.055927349999999994,
"min": 0.07905699828,
"max": 0.13531273128000001
}
]
}Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.10363230429379312,
"stddev": 0.007541741935582355,
"median": 0.10051400188000001,
"user": 0.04058519586206896,
"system": 0.07241282413793103,
"min": 0.09429928288000002,
"max": 0.12458207188
},
{
"command": "pacquet@main",
"mean": 0.09890181898344828,
"stddev": 0.007148118244845898,
"median": 0.09741144188,
"user": 0.038730816551724126,
"system": 0.0692600655172414,
"min": 0.09041061488,
"max": 0.11407201088
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.593792260319999,
"stddev": 0.13764312498650977,
"median": 4.52610679472,
"user": 2.37994546,
"system": 1.7144396,
"min": 4.44508859072,
"max": 4.78733557272
},
{
"command": "pacquet@main",
"mean": 4.59797812742,
"stddev": 0.14915589805046603,
"median": 4.5255368142200005,
"user": 2.36547056,
"system": 1.7041718,
"min": 4.4668026017199995,
"max": 4.91145016872
},
{
"command": "pnpr@HEAD",
"mean": 3.5777537309200005,
"stddev": 0.15896731552263024,
"median": 3.50680442122,
"user": 2.10052326,
"system": 1.556693,
"min": 3.4077552097200003,
"max": 3.8438143997200003
},
{
"command": "pnpr@main",
"mean": 3.498998620820001,
"stddev": 0.11894965430962505,
"median": 3.47256957772,
"user": 1.86993926,
"system": 1.2771370999999998,
"min": 3.3784146557200003,
"max": 3.71842010772
}
]
}Scenario: GVS linker: fresh restore, hot cache + hot storeSame install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.1278426022609524,
"stddev": 0.012286619264760266,
"median": 0.12269321188,
"user": 0.16927121333333328,
"system": 0.13796865047619047,
"min": 0.11393272888,
"max": 0.16547829888
},
{
"command": "pacquet@main",
"mean": 0.1318784131577778,
"stddev": 0.009476877477453767,
"median": 0.13200648537999998,
"user": 0.17789165777777777,
"system": 0.13957884888888888,
"min": 0.11949337288,
"max": 0.15174248988
},
{
"command": "pnpr@HEAD",
"mean": 0.14702229647999998,
"stddev": 0.010899188134722144,
"median": 0.14362029388,
"user": 0.18669727999999994,
"system": 0.14672492666666667,
"min": 0.13634723888,
"max": 0.17000627788
},
{
"command": "pnpr@main",
"mean": 0.1426748056694737,
"stddev": 0.009348772842520957,
"median": 0.14089783888000001,
"user": 0.18632751157894736,
"system": 0.13625272315789475,
"min": 0.12837353988,
"max": 0.16642434288
}
]
}Scenario: Store only: unlocked direct deps, cold cache + hot storeStore-only install (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.22467206434,
"stddev": 0.044673605109093226,
"median": 1.2197218302400001,
"user": 0.54734176,
"system": 0.24894469999999996,
"min": 1.17330282424,
"max": 1.30472047124
},
{
"command": "pacquet@main",
"mean": 1.2293748257400001,
"stddev": 0.04630197998873217,
"median": 1.21105011024,
"user": 0.5498527599999999,
"system": 0.23446029999999998,
"min": 1.18186149124,
"max": 1.31724187724
}
]
}Scenario: Cargo: repeat install, hot cache + hot storeFrozen repeat install of a Cargo workspace (
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.05263589764679245,
"stddev": 0.006402118879001358,
"median": 0.05284617476,
"user": 0.034274821132075466,
"system": 0.03487686905660377,
"min": 0.04070165876,
"max": 0.06524992976
},
{
"command": "pacquet@main",
"mean": 0.05364710553192981,
"stddev": 0.005685207981838742,
"median": 0.053786745760000004,
"user": 0.037126822456140345,
"system": 0.03333366912280702,
"min": 0.04166285676,
"max": 0.07594015276
}
]
} |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17580 +/- ##
==========================================
- Coverage 92.72% 92.72% -0.01%
==========================================
Files 2009 2011 +2
Lines 259743 260008 +265
==========================================
+ Hits 240852 241094 +242
- Misses 18891 18914 +23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
9163ad6 to
9538e13
Compare
e2a6131 to
a30f325
Compare
No runtime changes
1 job · nothing new
How to read thisRunner.Worker ← process on a path └─ curl ← process that acted └─ ○ example[.]com ← observed action Runtime behavior, recorded by Garnet. Add it to your CI ↗ |
This comment has been minimized.
This comment has been minimized.
9538e13 to
600603c
Compare
4a436c7 to
9f67666
Compare
600603c to
972162f
Compare
This comment has been minimized.
This comment has been minimized.
d6ea9a9 to
f860860
Compare
The libSQL metadata adapter needs the same connection code the auth backend has: the TLS connector, the connection pool that discards a stream whose baton was lost, and the embedded replica of a Turso primary. Move it out of `pnpr-auth` into a new `pnpr-libsql` crate so both use one copy, as pnpm/rfcs#66 asks ("Metadata reuses that connection code"). `pnpr-libsql` holds: - `LibsqlConnector` and `connector(settings)`, which refuses an auth token over plain HTTP to a host other than loopback; - `open(settings, connector)`, an embedded replica when `replicaPath` is set and the remote primary otherwise, and `open_primary`; - `ConnectionPool` and `first_row`; - `is_transaction_conflict` and `is_unique_violation`; - behind a `testing` feature, the local primary that serves libsql's sync protocol, and a plain-HTTP canned server, for tests in other crates. `LibsqlAuth` keeps its schema, retries, and records, and opens its database through `pnpr-libsql`. The auth tests that need the TLS test server from `pnpm-testing-utils` stay in `pnpr-auth`. The other connector and pool tests move with the code. A unified test build links two SQLite copies, libsql's and rusqlite's, and fails on duplicate symbols unless libsql's comes first on the link line. `pnpr-libsql` loads `pnpr-error` (and with it rusqlite) ahead of libsql, the order `pnpr-auth` and `pnpr` already link in. No behavior changes, except that the auth-token refusal no longer names the `backend.libsql` key, since metadata will reuse it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
f860860 to
6d5c9a7
Compare
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
PR Summary by QodoExtract shared libSQL connectivity into pnpr-libsql
AI Description
Diagram
High-Level Assessment
Files changed (18)
|
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
…wner `open` and `open_primary` now set the connector's token flag from the settings they open, so a connector built for no token still refuses to send the settings' token over plain HTTP to a host other than loopback. `ConnectionPool::new` takes the error a timed-out operation fails with, so a pool other than the auth backend's does not report its timeouts as `AuthDatabaseTimeout`. The auth backend passes `AuthDatabaseTimeout`. `connector` takes the config section its settings come from and names `<section>.authToken` when it refuses a token, as the auth backend's error did before the move. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Replies to the Qodo review:
Written by an agent (Claude Code, claude-opus-5-5). |
|
Code review by qodo was updated up to the latest commit f30eac2 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Summary
Third of the SQL metadata adapter stack (pnpm/tasks#244, design in pnpm/rfcs#66). Builds on #17577 and #17578, now merged.
The libSQL metadata adapter (next PR) needs the connection code the auth backend already has. pnpm/rfcs#66 says metadata reuses it. This PR moves that code out of
pnpr-authinto a newpnpr-libsqlcrate, mostly as file moves (git log --followkeeps the history):connector.rs:LibsqlConnector, plusconnector(settings, section), which refuses an auth token over plain HTTP off loopback and names<section>.authToken.pool.rs:ConnectionPool,first_row.lib.rs:open(embedded replica whenreplicaPathis set, else the remote primary),open_primary,is_transaction_conflict,is_unique_violation.testing.rs(featuretesting): the local primary that serves libsql's sync protocol, taken from the auth tests, and the canned plain-HTTP server.LibsqlAuthopens its database throughpnpr-libsqland keeps its schema, retries and records. The TLS tests that needpnpm-testing-utilsstay inpnpr-auth.Linking note, for reviewers: a unified test build links two SQLite copies, libsql's and rusqlite's. rusqlite comes in through
pnpr-error'sserverfeature. The build fails on duplicate symbols unless libsql's copy comes first on the link line.pnpr-libsqlloadspnpr-errorahead of libsql (anextern cratewith a comment).pnpr-authandpnpralready link in that order. A real fix (one SQLite) is out of scope here; draft #17591 explores it.Squash Commit Body
Checklist
already linked to it solves it.
Tests:
pnpm test:rustover everypnpr-*crate (now includingpnpr-libsql) pluspnpm-registry-mock(1812 passed: the same tests as before, relocated, plus one for the token flag thatopensets).cargo check -p pnpr --no-default-featuresbuilds.cargo deny check licensespasses with the new crate's entries.just test-pnprand the pacquet exclusion list includepnpr-libsql. No changeset: no user-visible change.Written by an agent (Claude Code, claude-opus-5-5).
🤖 Generated with Claude Code
Summary by CodeRabbit