copy files off a card, verified by SHA256 (closes #5) #14

Open
clawbot wants to merge 1 commits from issue-5-import into next
pull from: issue-5-import
Collaborator

Adds Store.Import, the copy off a card that #5 asks for, built to the plan on that issue and the ruling at #4 (comment).

  • Each file goes to dest/YYYY-MM-DD/<file name>, from the new Object.ModTime. A file group stays in the folder of its primary member.
  • Each copy is read back and compared by SHA256. A copy that fails or differs is removed and reported.
  • ImportResult lists Copied, Skipped and Conflicts by destination path.

What the diff does not show:

  • A conflict is not an error, so a nil error does not mean every file was copied. The README says so.
  • A file is read three times: hashed, copied, then the written file is hashed. The test for a corrupted write relies on that order.
  • A cancelled import leaves any day folder it already created, empty or not.

Disclosures:

  • Judgement call: copies get mode 0600 and day folders 0750. The plan names no mode, and the linter rejects wider ones.
  • Judgement call: a file at the path that cannot be read is an error, not a conflict.
  • Judgement call: a directory or symlink at the path is a conflict, and a symlink is not followed.
  • Deviation: the README's first sentence now also says the library copies files, which the brief did not list.
  • Left alone: the README line saying dcf does not work yet. That status note is the owner's to retire.

Model: opus-5-5

Adds `Store.Import`, the copy off a card that https://git.eeqj.de/sneak/dcf/issues/5 asks for, built to the plan on that issue and the ruling at https://git.eeqj.de/sneak/dcf/issues/4#issuecomment-145367. - Each file goes to `dest/YYYY-MM-DD/<file name>`, from the new `Object.ModTime`. A file group stays in the folder of its primary member. - Each copy is read back and compared by SHA256. A copy that fails or differs is removed and reported. - `ImportResult` lists `Copied`, `Skipped` and `Conflicts` by destination path. What the diff does not show: - A conflict is not an error, so a nil error does not mean every file was copied. The README says so. - A file is read three times: hashed, copied, then the written file is hashed. The test for a corrupted write relies on that order. - A cancelled import leaves any day folder it already created, empty or not. Disclosures: - Judgement call: copies get mode `0600` and day folders `0750`. The plan names no mode, and the linter rejects wider ones. - Judgement call: a file at the path that cannot be read is an error, not a conflict. - Judgement call: a directory or symlink at the path is a conflict, and a symlink is not followed. - Deviation: the README's first sentence now also says the library copies files, which the brief did not list. - Left alone: the README line saying `dcf` does not work yet. That status note is the owner's to retire. Model: opus-5-5
clawbot added the needs-review label 2026-11-03 21:08:05 +01:00
clawbot self-assigned this 2026-11-03 21:08:05 +01:00
clawbot added 1 commit 2026-11-03 21:08:06 +01:00
Store.Import copies every member of every file group and the images
and videos under PRIVATE/M4ROOT to dest/YYYY-MM-DD/<file name>. The day
comes from the new Object.ModTime. A file group stays in the folder of
its primary member.

Each copy is read back and compared by SHA256. A file with the same
hash already there is skipped, and anything else there is a conflict
and left alone. One failed file does not stop the others. A cancelled
context stops at once and removes the partial copy.

Object.Hash now shares its reading code with the import.

Model: opus-5-5
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue-5-import:issue-5-import
git checkout issue-5-import
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/dcf#14