You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9f6ff01
Browse filesBrowse the repository at this point in the historyBrowse files
compare` and `fileCache` were ported 2026-08-29 and are no longer listed — see
412
412
"The file cache" below. `database.exist_doc` and `add_docs`'
413
413
`customFileHandler` were ported 2026-08-30 and are no longer listed — see
414
-
"exist_doc and ingestion at add time" below.)
414
+
"exist_doc and ingestion at add time" below. The three issue #55 rows were
415
+
ported 2026-08-30 and are no longer listed — see below.)
415
416
416
417
| MATLAB feature | Bridge file | Priority |
417
418
|---|---|---|
@@ -422,9 +423,6 @@ compare` and `fileCache` were ported 2026-08-29 and are no longer listed — see
422
423
|`database.display_branches`| bridge.yaml | Low |
423
424
|`database.close_doc`| bridge.yaml | Low |
424
425
|`query.searchcellarray2searchstructure` handles only numbers and strings; MATLAB also handles cells, structs and logicals | bridge.yaml | Low |
425
-
| Deleting ingested copies from the file cache on removal — MATLAB's `do_remove_doc` deletes each `files.cached_location` from disk before dropping the rows (issue #55) | bridge_implementations.yaml | Medium |
426
-
| Retiring removed document ids — MATLAB's `deleted_docs` table and the `DID:SQLITEDB:DELETED_DOC` refusal in `do_add_doc` (issue #55) | bridge_implementations.yaml | Medium |
427
-
| Reclaiming documents orphaned by a branch deletion — MATLAB's `do_delete_branch` runs the same reclamation as `do_remove_doc`; Python's drops the branch rows and stops (issue #55) | bridge_implementations.yaml | Medium |
428
426
429
427
### Issue #55: what landed in MATLAB, and what is left here
430
428
@@ -439,35 +437,43 @@ row they reference. Python is the language that enforces that order
439
437
(`PRAGMA foreign_keys = ON`), which is why the ordering bug surfaced here first
440
438
as a document with an attached file refusing to be removed.
441
439
442
-
The other two are rows in the table above. Both are genuinely missing, not
443
-
merely unreachable:
444
-
445
-
-**Cached files.** Both ingestion paths are implemented here now — remote in
446
-
DID-python#42, local in DID-python#45 — so any location marked `ingest` is
447
-
copied to `FileDir/<uid>` and recorded in `cached_location`, exactly as in
448
-
MATLAB. `d7ac853` pointed both languages at one shared cache directory. A
449
-
removal from Python therefore leaves a file behind that the same removal from
450
-
MATLAB deletes, in a directory both of them read. This is the more pressing
451
-
of the two rows: it now applies to ordinary documents, not just remote ones.
452
-
-**Retired ids.** MATLAB records the id in a `deleted_docs` table and raises
453
-
`DID:SQLITEDB:DELETED_DOC` on a re-add. Nothing stops the same re-add here.
454
-
455
-
Neither breaks reading a database across languages. `deleted_docs` is created
456
-
on demand, is not one of MATLAB's mandatory tables, and MATLAB does not add it
457
-
to a Python-written database merely by opening one.
458
-
459
-
A third row was added when MATLAB `a0bb373` finished the issue. `do_remove_doc`
460
-
is not the only way a document comes to be referenced by no branch — deleting a
461
-
branch is the other, and MATLAB now runs the same reclamation there.
462
-
`_do_delete_branch` here still drops the `branch_docs` and `branches` rows and
463
-
stops, so a branch deleted from Python leaves behind documents no branch
464
-
references, with their field data and their ingested files.
465
-
466
-
Whoever ports it should carry the guard, not just the deletes: the reclamation
467
-
fires only when **no**`branch_docs` row for the document survives anywhere, so
468
-
a document that any other branch still holds is left alone. That is what makes
469
-
it safe under DID's branch model, where deleting documents from one branch does
470
-
not delete them from others.
440
+
The other two were ported on 2026-08-30 (DID-python#49), along with a third
441
+
that MATLAB `a0bb373` added when it finished the issue:
442
+
443
+
-**Ingested files.**`_reclaim_unreferenced_doc` collects the document's
444
+
`files.cached_location` values and unlinks them. This became pressing once
445
+
DID-python#45 closed local ingestion: any location marked `ingest` is copied
446
+
to `FileDir/<uid>` here too, and `d7ac853` pointed both languages at one
447
+
shared cache directory, so a removal used to leave a file behind that the
448
+
same removal from MATLAB deleted.
449
+
-**Retired ids.** A `deleted_docs` table, and a refusal in `_do_add_doc`.
450
+
MATLAB raises `DID:SQLITEDB:DELETED_DOC`; Python raises `ValueError`, this
451
+
class's convention for the same kind of refusal.
452
+
-**Branch deletion.**`do_remove_doc` is not the only way a document comes to
453
+
be referenced by no branch — deleting a branch is the other, and
454
+
`_do_delete_branch` now runs the same reclamation through the same helper.
455
+
456
+
Two things are worth keeping in mind about that code:
457
+
458
+
**The guard, not just the deletes.** Reclamation fires only when **no**
459
+
`branch_docs` row for the document survives anywhere, so a document any other
460
+
branch still holds is left alone. That is what makes it safe under DID's branch
461
+
model, where deleting documents from one branch does not delete them from
462
+
others.
463
+
464
+
**One deliberate ordering difference.** MATLAB deletes the files from disk
465
+
before the rows; Python collects the paths, deletes the rows, commits, and
466
+
unlinks after. MATLAB runs no transaction, so the order costs it nothing; here,
467
+
unlinking first would mean a later SQL failure rolled the rows back with the
468
+
files already gone. The three SQL deletes stay in MATLAB's order.
469
+
470
+
Porting the retirement was a deliberate **behavior change** for Python, and one
471
+
existing test asserted the old behavior (`test_remove_and_readd_doc`, now
472
+
`test_removed_doc_id_cannot_be_readded`). Note that Python never had the
473
+
stale-`doc_data` symptom the issue describes — it has reclaimed those rows
474
+
since #39, so a re-added id got fresh ones. The retirement is here so ids are
475
+
not re-used under the branch model, and so both languages agree about whether
0 commit comments