Repository navigation
feat(storage): repository traits, Postgres backend, and parity harness - #910
Conversation
…everywhere, clear semantics
…ls; record ADR revisions
… the credential is not echoed The 127.0.0.1 default is right for CI and for a host run and wrong for this sandbox, where the cargo tests run inside the builder container whose loopback is not the daemon host's. Preflight now refuses a loopback bind against a remote daemon with one line naming PARITY_BIND and PARITY_HOST, probes the dialled address with a three-second timeout before the first container starts, and runs a forced connection-failure test that fails the harness if the credential reaches the log.
…composer's search SQL
…re the redaction test to run
…ck checks; correct the record and add the language switch
🦋 Changeset detectedLatest commit: 12539d4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…enqueue FieldUpdate::Set bound a negative count as NULLInt, the sentinel reserved for Clear, so Set(-5) silently became unlimited. Bind the integer and let chk_remaining_uses_non_negative refuse it. The parity fixture enqueued through the backend even inside a transaction, so PostgresTransaction::enqueue was never exercised and the row survived a rollback. Enqueue through the client, and add a transaction that enqueues, fails on the negative invite count, and is followed by a claim that proves the row rolled back.
PARITY_PG_PASSWORD and PARITY_REDIS_PASSWORD were spliced raw into the admin URL and the Cucumber URLs, so a password containing @, :, /, ? or # truncated the userinfo. Encode for the URL and keep passing the raw value to the containers.
Coverage Report for CI Build 39352423935Coverage remained the same at 73.973%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
[Critical impact] The Postgres backend reaches stored relay data, payment balances, and user admission. Enable PostgreSQL TLS support before merging; the transaction test helper also needs a small follow-up. Findings
|
| serde_json = "1" | ||
| serde_yaml = "0.9" | ||
| sha2 = "0.11.1" | ||
| sqlx = { version = "0.9", default-features = false, features = ["runtime-tokio", "postgres", "migrate", "macros", "chrono", "json", "tls-none"] } |
There was a problem hiding this comment.
If PostgreSQL requires TLS, the new backend cannot connect. The sqlx dependency disables default features and selects tls-none, leaving no TLS provider for URLs with sslmode=require or sslmode=verify-full. Enable a TLS provider and add a connection test that requires TLS.
| for (index, nested) in ops.iter().enumerate() { | ||
| match run_op( | ||
| backend, | ||
| Client::Transaction(&transaction), | ||
| nested, | ||
| &mut HashMap::new(), |
There was a problem hiding this comment.
Transaction tests lose message IDs
run_transaction gives every nested operation a fresh refs map. An outbox.enqueue followed by outbox.mark_delivered or outbox.mark_failed in the same group therefore loses the message ID and fails before reaching the database. This limits the transaction flows the parity harness can test. Keep one map for the group, preserve committed references for later operations, and discard references from rolled-back work.
|
Both findings are being fixed on the branch; neither is dismissed. P1 (TLS). Correct, and the wider point matters: managed Postgres rejects plaintext, so P2 (per-op |
|
Post-merge record, so the two late findings are not lost behind a green rollup. The squash landed at
Both are follow-ups on the merge, not accepted risks: the branch was reviewed as a storage seam plus a Postgres backend for the parity oracle, and a backend that cannot speak TLS to the database it targets is a defect regardless of that scope. |
What this lands
The storage seam and the Postgres backend for the rewrite, ported from the measured
repository interfaces — not the LMDB store. That split is the job's own scope
decision (
spec.md§ Scope decision S1): the seam, the 37 sqlx migrations and thedifferential parity harness are one reviewable slice; the LMDB store, migration tool
and benchmark rig are named follow-ups.
nostream-storage: nine*Repositorytraits (51 methods) with noimplin thetraits file, plus the records/streaming types the port needs.
migrations, behaviour-identical, kept because the parity oracle needs a reference.
(
migrations,parity),scripts/storage-parity.sh, and fixtures.Verification
Every row below was run by the approver, not copied from the build report:
cargo test --workspace --all-featurespassed=594 failed=0 ignored=2cargo clippy --workspace --all-targets --all-features -- -D warningsunwrap_used,expect_used,todo,unimplemented,panic)cargo fmt --all --checkcargo build --workspace --all-features --release_sqlx_migrationsrows; second run is a no-op; catalogue equalsschema.json118 scenarios (118 passed),587 stepsscripts/storage-parity.shThe parity fixture routes each op through the client inside
run_transaction, and itstransaction groups cover both sides: one commits an enqueue (
{failed: false}), onerecords
{failed: true, at: 2}, and one enqueues a probe, fails on a constraint and isfollowed by a claim that shows only the committed row — so a partial write is observable
rather than assumed.
Review follow-ups
Greptile's three P2s are fixed on the branch (
de5f3ef,12539d4):postgres/metadata.rsboundFieldUpdate::SetasNULLIntwhenever the count was negative, which is the sentinel reserved forClear;Set(-5)silently became unlimited. The integer is bound as given andchk_remaining_uses_non_negativerefuses it.tests/parity.rsenqueued through the backend even insiderun_transaction, soPostgresTransaction::enqueuewas never exercised. Enqueue goes through the client now, and reverting that routing makes the new rollback assertion fail.scripts/storage-parity.shspliced both passwords raw into the admin URL and the Cucumber URLs; they are percent-encoded for the URLs, with the raw value still passed to the containers.Why it needs a human
The approver's verdict was
ESCALATEonmoney-access-identity(alsoschema-or-dependencyanddeployment-config): it implementsconfirm_invoice,charge_user, balances and admission, and adds 37 migrations, three workspacedependencies and a CI service. Nothing in the checks failed — it is an
unattended-landing refusal. Merged on the repository owner's explicit instruction.
The PR run is the first CI run on this branch; criterion 18 of the approval is
"one CI run on the PR" and it is verified by this PR's checks, not before it.