fix(events): envolver VEVENT en VCALENDAR al push (Xandikos 500) + INSERT explicito en contacts (columna import_key)
El raw de un evento guardaba solo BEGIN:VEVENT...END:VEVENT; subirlo a CalDAV genera un .ics invalido que rompe Xandikos (assert isinstance(cal, Calendar) -> 500 en todo el calendario). _ensure_vcalendar lo envuelve en el push. Ademas, la columna import_key (migracion 004) rompia los INSERT posicionales de contacts: ahora son explicitos por columna y el ingest puebla import_key con la funcion del registry. Tests actualizados (4 derivadas, INSERT explicito). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -140,6 +140,7 @@ def test_ingest_vault_cuenta_entidades(client):
|
||||
assert sorted(r["derived_rebuilt"]) == [
|
||||
"derived.contact_link_quality",
|
||||
"derived.event_monthly",
|
||||
"derived.org_contacts",
|
||||
"derived.person_stats",
|
||||
]
|
||||
|
||||
@@ -237,7 +238,7 @@ def test_derivadas_sin_note_path(client):
|
||||
).json()
|
||||
assert r["status"] == "ok"
|
||||
assert r["rows"] == []
|
||||
# Y las tres derivadas existen de verdad.
|
||||
# Y las derivadas existen de verdad.
|
||||
t = client.post(
|
||||
"/api/query",
|
||||
json={
|
||||
@@ -250,6 +251,7 @@ def test_derivadas_sin_note_path(client):
|
||||
assert [row["table_name"] for row in t["rows"]] == [
|
||||
"contact_link_quality",
|
||||
"event_monthly",
|
||||
"org_contacts",
|
||||
"person_stats",
|
||||
]
|
||||
|
||||
@@ -260,7 +262,7 @@ def test_link_contacts_por_telefono(client, cfg):
|
||||
now = datetime.now(tz=timezone.utc)
|
||||
with write_conn(cfg.db_path) as conn:
|
||||
conn.execute(
|
||||
"INSERT INTO contacts VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
"INSERT INTO contacts (uid, collection, etag, fn, tels, emails, raw, note_path, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
[
|
||||
"uid-movil-1",
|
||||
"/enmanuel/contacts/addressbook/",
|
||||
@@ -274,7 +276,7 @@ def test_link_contacts_por_telefono(client, cfg):
|
||||
],
|
||||
)
|
||||
conn.execute(
|
||||
"INSERT INTO contacts VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
"INSERT INTO contacts (uid, collection, etag, fn, tels, emails, raw, note_path, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
[
|
||||
"uid-movil-2",
|
||||
"/enmanuel/contacts/addressbook/",
|
||||
@@ -576,7 +578,7 @@ def test_compose_agenda_vcard_sin_osint_con_direcciones(client, cfg, monkeypatch
|
||||
# El contacto se enlaza a la ficha por teléfono al re-ingestar el vault.
|
||||
with write_conn(cfg.db_path) as conn:
|
||||
conn.execute(
|
||||
"INSERT INTO contacts VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
"INSERT INTO contacts (uid, collection, etag, fn, tels, emails, raw, note_path, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
[
|
||||
"uid-marca",
|
||||
"/enmanuel/contacts/addressbook/",
|
||||
@@ -651,7 +653,7 @@ def test_pull_dav_incremental_por_etag(client, cfg, monkeypatch):
|
||||
("c-gone", '"e-gone"', "Se Borra"),
|
||||
]:
|
||||
conn.execute(
|
||||
"INSERT INTO contacts VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
"INSERT INTO contacts (uid, collection, etag, fn, tels, emails, raw, note_path, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
[uid, coll, etag, fn, "[]", "[]", "BEGIN:VCARD...", None, now],
|
||||
)
|
||||
|
||||
@@ -731,7 +733,7 @@ def test_write_agenda_vcards_to_dir_nombres_y_sin_osint(client, cfg, tmp_path):
|
||||
now = datetime.now(tz=timezone.utc)
|
||||
with write_conn(cfg.db_path) as conn:
|
||||
conn.execute(
|
||||
"INSERT INTO contacts VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
"INSERT INTO contacts (uid, collection, etag, fn, tels, emails, raw, note_path, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
[
|
||||
"uid con espacios/raro", # fuerza saneo del nombre del recurso
|
||||
"/enmanuel/contacts/addressbook/",
|
||||
@@ -790,7 +792,7 @@ def test_push_all_dav_bulk_flujo_mockeado(client, cfg, monkeypatch):
|
||||
with write_conn(cfg.db_path) as conn:
|
||||
for uid, fn in [("c-a", "Contacto A"), ("c-b", "Contacto B")]:
|
||||
conn.execute(
|
||||
"INSERT INTO contacts VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
"INSERT INTO contacts (uid, collection, etag, fn, tels, emails, raw, note_path, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
[uid, coll, None, fn, "[]", "[]", "BEGIN:VCARD...", None, now],
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user