fix(core): inline TrackRow SELECT in postgres list/get methods#187
Conversation
sqlx 0.9's `query_as` argument is `impl SqlSafeStr`, which only accepts a `'static` literal. The previous version stored the projection in `const SELECT_TRACK_ROW: &str` and composed it via `format!()` at runtime — the resulting `String` failed to coerce when waveflow-server consumed waveflow-core with the `postgres` feature enabled. The workspace check on the desktop side (`cargo check --workspace --all-targets`) didn't catch this because it doesn't activate the `postgres` cargo feature on waveflow-core — that code path is only compiled when waveflow-server's git dep pulls it in. Fix: inline the full NULL-cast projection at each call site in `list_for_library` and `get_for_library`. `insert_for_library`, `update_for_library` and `delete_for_library` already used literal strings (they had INSERT/UPDATE/DELETE-specific shapes anyway) and didn't need changes. Validated: - cargo check --features postgres --all-targets (on the core crate) - cargo clippy --features postgres --all-targets -- -D warnings - workspace test suite still passes Signed-off-by: InstaZDLL <github.105mh@8shield.net>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughAperçuLe repository PostgreSQL pour les pistes inligne les projections SQL dans les méthodes ModificationsMigration vers projections SQL inlinées
Effort d'examen estimé🎯 3 (Modéré) | ⏱️ ~20 minutes PRs potentiellement liées
Poème
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
Latent build break in
PostgresTrackRepository(introduced in #186): sqlx 0.9'squery_astakesimpl SqlSafeStr, which only accepts a'staticliteral. The previous version stored the shared projection inconst SELECT_TRACK_ROW: &strand composed it viaformat!()at runtime — the resultingStringfailed to coerce whenwaveflow-serverconsumedwaveflow-corewithfeatures = ["postgres"].The desktop workspace check (
cargo check --workspace --all-targets) didn't catch this because it doesn't activate thepostgresCargo feature onwaveflow-core— that code path is only compiled whenwaveflow-server's git dep pulls it in.Fix
Inline the full NULL-cast projection at each call site in
list_for_libraryandget_for_library.insert_for_library,update_for_library, anddelete_for_libraryalready used literal strings (theirINSERT/UPDATE/DELETE-specific shapes are method-local anyway) — no change needed.Duplication is bounded; a future schema change would have touched each branch the same way anyway.
Follow-up
Worth adding
cargo check --features postgres --all-targets(or--all-features) to the workspace check loop / CI so this feature-gated path gets compiled outside ofwaveflow-server's build.Test plan
cargo check --manifest-path src-tauri/crates/core/Cargo.toml --features postgres --all-targetscargo clippy --manifest-path src-tauri/crates/core/Cargo.toml --features postgres --all-targets -- -D warningscargo test --workspace(45 passed, unchanged)Summary by CodeRabbit