artefactual-sdps / enduro

A tool to support ingest and automation in digital preservation workflows
https://enduro.readthedocs.io/
Apache License 2.0
4 stars 3 forks source link

Problem: Bundler code to write metadata.csv and checksum files is unused #846

Open djjuhasz opened 8 months ago

djjuhasz commented 8 months ago

Describe the bug

The bunder.Bundle() method calls b.metadata.Write() and three methods to write checksum files with MD5, SHA1, and SHA256 algorithms; but none of the four called methods write a file as intended. As a result most of the code in internal/bundler/metadata.go is unused.

To Reproduce

Steps to reproduce the behavior:

  1. Run bundle_test.go with VSCode or another code editor that highlights tested code

Most of the metadata.go code is not run by the tests, though it should be run by the "Bundles a single file" test. Note also that the current test expects no files in the metadata/ subdirectory, and would error if metadata.csv or any of the checksum files were present.

Expected behavior

Bundler.Bundle() should write four files to the bundle metadata/ directory:

  1. metadata.csv
  2. checksum.md5
  3. checksum.sha1
  4. checksum.sha256

OR the code to write the above files should be removed.

Screenshots

image

Additional context

sevein commented 8 months ago

Some additional context: the "bundler" was first developed as part of the RDSS Archivematica Channel Adapter back in mid 2017 (amclient.TransferSession) because we needed to package Archivematica transfers with additional metadata retrieved from messages coming from the RDSS message broker. It then became the bundler package in legacy Enduro with the only goal of packaging the transfer but not dealing with its submission. But as you described it's been pretty much dead code. I would also not be surprised if you think it needs some refactoring, I would certainly not use afero today if I was writing it again.