test: add rust-hook migration test for tags - #2365
Conversation
|
@swarna1101 I have pushed some tests that possibly raise issues with the hook implementation rather than the tests themselves, could you look into it? |
the hook was using |
|
hi @juan518munoz , let me know if you get a chance to take a look at this |
|
The happy path looks good. One gap worth naming before this lands: the schema fingerprint only covers Concretely, a db stamped at v2 that never ran the hook is accepted and the re-encode is silently skipped: #[test]
fn unencoded_rows_at_the_latest_version_go_undetected() {
let mut conn = open_tags_db_at_v1();
let account_id = test_account_id();
insert_tag_row(&conn, NoteTag::with_account_target(account_id), &account_id.to_bytes());
// Claim v2 without running the hook.
conn.pragma_update(None, "user_version", 2).unwrap();
// v2 has empty SQL, so both versions fingerprint identically and there is nothing to catch.
assert_eq!(TAGS_FIXTURE_EXPECTED_SCHEMA_HASHES[0], TAGS_FIXTURE_EXPECTED_SCHEMA_HASHES[1]);
apply_tags_fixture_migrations(&mut conn).expect("accepted despite legacy rows");
assert_eq!(untransformed_source_count(&conn), 1);
}Let's fix it here rather than leave it as a known hole. |
Gave v2 a |
@igamigo @gabrielbosio , follow-up to #2318. fixture v1->v2 on real tags; v2 uses
M::up_with_hookto migrate legacy account-only source blobs toNoteTagSourcewire format, viaapply_migrations_with, checked withget_note_tags.