`cargo sqlx prepare` produces non-deterministic files

Aperta
#4,339 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 4 giorni

Nessuno ha ancora preso questa issue.

  • #4370 di @Boulea7 — chiusa senza merge

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust, sqlite
Ambito
cli, databases

Direzione di ricerca

Start by running the provided cargo sqlx prepare command repeatedly against the SQLite fixture and compare the generated .sqlx/query-*.json files. Trace the metadata-saving path from the cargo sqlx prepare entry point, then verify that equivalent files have stable JSON key ordering across repeated runs.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
I have found these related issues/pull requests

none

Description

Every time I run cargo sqlx prepare ..., it generates equivalent content of the .sqlx/query-*.json files that I check into the repo, but the order of the keys is random. This adds an extra complexity when managing the project.

Please consider using JSON sorting for the keys when saving metadata files.

Reproduction steps

Run this type of command multiple times, and observe that each time produces different results (observed in https://github.com/maplibre/martin repo)

cargo sqlx prepare --database-url sqlite://$PWD/../tests/fixtures/mbtiles/world_cities.mbtiles -- --lib --tests
SQLx version

0.9.0

Enabled SQLx features

"sqlite", "runtime-tokio"

Database server and version

sqlite

Operating system

Linux Mint

Rust version

1.97.0 (2d8144b78 2026-07-07)

Lingua principale
Rust
Stelle
17.5k
Fork
1.7k
Merge medio
1g 17h
PR unite (30g)
7

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di transact-rs/sqlx

Tutte le issue di transact-rs/sqlx

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.