Basic commands: push, pull and archive - #3
Conversation
Implement the remaining basic data commands from issue #1: - push: copy a run from the temporary to the main data directory - pull: copy a run from the main to the temporary data directory - archive: move a run from the main data directory to the archive Each command updates the metadata record. Copies/moves refuse to overwrite existing files. Data directories are configurable via DAT_TEMP, DAT_MAIN and DAT_ARCHIVE environment variables. Add pytest coverage for push, pull and archive including the refuse-overwrite behavior.
|
Review verdict: Request changes Summary: The PR implements the requested commands and overwrite protection, but accepts unrestricted run paths. Findings:
Verdict: Request changes — the path traversal issue can cause unintended data copying or destructive moves. |
|
Review verdict: Request changes Summary: The command implementation generally matches issue #1, but the added test suite contains a guaranteed failure. Findings:
Verdict: Request changes — the added tests do not pass against the implementation. |
a..b is a valid plain run name matching the allowed-name regex and is not a path traversal, so the test suite was guaranteed to fail. Drop it from the rejected traversal cases.
|
Review verdict: Request changes Summary: The run transfer implementations are straightforward and include path validation, but command dispatch still exposes module globals and does not reliably reject unknown commands. Findings:
Verdict: Request changes — the command-line safety behavior remains incorrect. |
krystophny
left a comment
There was a problem hiding this comment.
Review verdict: Comment
Summary: The diff addresses the previously identified path-validation and command-dispatch issues. The implementation is internally consistent, but no CI checks are configured or available.
Findings:
No findings.
Verdict: Comment — no blocking defects found, but local tests could not run because elabapy is unavailable and the repository has no CI evidence.
Closes #1
Implements the missing basic data commands from issue #1 on top of the
existing
commitcommand:dat push <run>: copy a finished run from the temporary datadirectory to the main data directory and record its locations in
the metadata JSON.
dat pull <run>: copy a run from the main data directory back tothe temporary data directory and record it.
dat archive <run>: move a run from the main data directory to thearchive directory and update the metadata record.
No data is deleted or overwritten: copies and moves refuse to write
over files that already exist, so files can later be updated by first
removing them, as described in the issue. The data directories default
to the ITPcp layout (
/temp,/proj/plasma,/proj/plasma/archive)and are overridable via
DAT_TEMP,DAT_MAINandDAT_ARCHIVEenvironment variables for use with shared storage such as Nextcloud.
Tests added in
tests/test_dat.pycover push, pull and archiveincluding recording metadata and the refuse-overwrite behavior.