Skip to content

fix(wacli): support legacy media database schema#52

Merged
g1e2x87 merged 1 commit into
mainfrom
fix/wacli-legacy-media-schema
Jul 22, 2026
Merged

fix(wacli): support legacy media database schema#52
g1e2x87 merged 1 commit into
mainfrom
fix/wacli-legacy-media-schema

Conversation

@g1e2x87

@g1e2x87 g1e2x87 commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

  • keep inbound-image lookup compatible with wacli stores created before schema migration 22
  • read the stable messages.local_path column before consulting the optional media-alias table
  • query message_local_media_aliases only when that table exists
  • add regression coverage for both legacy stores and alias fallback

Problem

PR #51 introduced asynchronous lookup of downloaded inbound images. Its SQL used a UNION with message_local_media_aliases. A deployed wacli store can have a valid messages.local_path while still lacking that newer table. SQLite rejects the whole query with no such table, so PRX drops the image marker even though the file was downloaded successfully.

Fix

The lookup now:

  1. queries messages.local_path, which is the stable primary source;
  2. returns immediately when that path is present;
  3. checks sqlite_master for the migration-22 alias table;
  4. queries aliases only when the optional table exists.

The database remains read-only and the existing store confinement, canonicalization, size limits, and managed-workspace import remain unchanged.

Verification

  • cargo fmt --all -- --check
  • cargo test -p openprx channels::wacli::tests --lib --quiet — 42 passed
  • cargo clippy -p openprx --all-targets -- -D warnings
  • cargo test -p openprx --lib --quiet — 5709 passed, 0 failed, 6 ignored
  • git diff --check

Security considerations

  • no database writes or migrations are performed by PRX
  • no expansion of trusted filesystem roots
  • media paths remain canonicalized and restricted to configured store_dir
  • alias fallback is gated by exact table-name/type inspection

Rollback

Revert commit 725a1566; no data or configuration migration is required.

@g1e2x87
g1e2x87 merged commit 5a3e352 into main Jul 22, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant