zimeon / ocfl-py

OCFL tools in Python
MIT License
20 stars 7 forks source link

Detect E066 for fixture E066_E092_old_manifest_digest_incorrect #49

Closed zimeon closed 3 years ago

zimeon commented 3 years ago

See https://github.com/OCFL/fixtures/pull/71

zimeon commented 3 years ago

Currently the code does not detect the different in v1 state between the versions v1 and v2, just the E092:

(py38) simeon@RottenApple ocfl-py> ./ocfl-validate.py fixtures/1.0/bad-objects/E066_E092_old_manifest_digest_incorrect
[E092a] OCFL Object v1 inventory manifest using digest algorithm sha512 has digest 17e41ccb166d21a5327d5a2ae1bb48192b8470e1357266c9d119c294cb1e95978569472c9de64fb6d93cbd4dd0aed0bf1e7c47fd1920de17b038a08a85eb4fa1 for file v1/content/file-1.txt which doesn't match calculated digest 07e41ccb166d21a5327d5a2ae1bb48192b8470e1357266c9d119c294cb1e95978569472c9de64fb6d93cbd4dd0aed0bf1e7c47fd1920de17b038a08a85eb4fa1 for that file (see https://ocfl.io/1.0/spec/#E092)
INFO:ocfl.object:OCFL object at fixtures/1.0/bad-objects/E066_E092_old_manifest_digest_incorrect is INVALID

Where we have in v1/inventory.json:

    "v1": {
      "created": "2021-03-31T10:21:21.740101149-05:00",
      "state": {
        "17e41ccb166d21a5327d5a2ae1bb48192b8470e1357266c9d119c294cb1e95978569472c9de64fb6d93cbd4dd0aed0bf1e7c47fd1920de17b038a08a85eb4fa1": [
          "file-1.txt"
        ],
        "9fef2458ee1a9277925614272adfe60872f4c1bf02eecce7276166957d1ab30f65cf5c8065a294bf1b13e3c3589ba936a3b5db911572e30dfcb200ef71ad33d5": [
          "file-2.txt"
        ],
        "b3b26d26c9d8cfbb884b50e798f93ac6bef275a018547b1560af3e6d38f2723785731d3ca6338682fa7ac9acb506b3c594a125ce9d3d60cd14498304cc864cf2": [
          "file-3.txt"
        ]
      },

and in v2/inventory.json:

    "v1": {
      "created": "2021-03-31T10:21:21.740101149-05:00",
      "state": {
        "07e41ccb166d21a5327d5a2ae1bb48192b8470e1357266c9d119c294cb1e95978569472c9de64fb6d93cbd4dd0aed0bf1e7c47fd1920de17b038a08a85eb4fa1": [
          "file-1.txt"
        ],
        "9fef2458ee1a9277925614272adfe60872f4c1bf02eecce7276166957d1ab30f65cf5c8065a294bf1b13e3c3589ba936a3b5db911572e30dfcb200ef71ad33d5": [
          "file-2.txt"
        ],
        "b3b26d26c9d8cfbb884b50e798f93ac6bef275a018547b1560af3e6d38f2723785731d3ca6338682fa7ac9acb506b3c594a125ce9d3d60cd14498304cc864cf2": [
          "file-3.txt"
        ]
      },

N.B. different digest for file-1.txt!!

zimeon commented 3 years ago

Now more helpful error messages including E066:

(py38) simeon@RottenApple ocfl-py> ./ocfl-validate.py fixtures/1.0/bad-objects/E066_E092_old_manifest_digest_incorrect
[E066d] OCFL Object root inventory v1 version state has digest 07e41ccb166d21a5327d5a2ae1bb48192b8470e1357266c9d119c294cb1e95978569472c9de64fb6d93cbd4dd0aed0bf1e7c47fd1920de17b038a08a85eb4fa1 (mapping to logical files file-1.txt) that does not appear in the v1 inventory (see https://ocfl.io/1.0/spec/#E066)
[E066e] OCFL Object v1 inventory v1 version state has digest 17e41ccb166d21a5327d5a2ae1bb48192b8470e1357266c9d119c294cb1e95978569472c9de64fb6d93cbd4dd0aed0bf1e7c47fd1920de17b038a08a85eb4fa1 (mapping to logical files file-1.txt) that does not appear in the root inventory (see https://ocfl.io/1.0/spec/#E066)
[E092a] OCFL Object v1 inventory manifest using digest algorithm sha512 has digest 17e41ccb166d21a5327d5a2ae1bb48192b8470e1357266c9d119c294cb1e95978569472c9de64fb6d93cbd4dd0aed0bf1e7c47fd1920de17b038a08a85eb4fa1 for file v1/content/file-1.txt which doesn't match calculated digest 07e41ccb166d21a5327d5a2ae1bb48192b8470e1357266c9d119c294cb1e95978569472c9de64fb6d93cbd4dd0aed0bf1e7c47fd1920de17b038a08a85eb4fa1 for that file (see https://ocfl.io/1.0/spec/#E092)
INFO:ocfl.object:OCFL object at fixtures/1.0/bad-objects/E066_E092_old_manifest_digest_incorrect is INVALID