Skip to content

Update FIVE_SAFES_PROFILE_VERSION to 0.8.0 - #210

Open
manics wants to merge 1 commit into
eScienceLab:developfrom
manics:five-safes-0.8.0
Open

Update FIVE_SAFES_PROFILE_VERSION to 0.8.0#210
manics wants to merge 1 commit into
eScienceLab:developfrom
manics:five-safes-0.8.0

Conversation

@manics

@manics manics commented Aug 6, 2026

Copy link
Copy Markdown

Testing https://github.com/eScienceLab/rocrate-validator/blob/develop/tests/data/crates/valid/five-safes-crate-result/ro-crate-metadata.json (https://github.com/eScienceLab/rocrate-validator/raw/ddf10285cb1df2effde1032be0939eb11870db5d/tests/data/crates/valid/five-safes-crate-result/ro-crate-metadata.json) as suggested in #102 (comment) with ghcr.io/esciencelab/ro-crate-validation-service-fivesafes-profile:2.0

BASE_URL = "http://<INTERNAL-HOST>:5000"

with open("ro-crate-metadata-5s.json", encoding="utf-8") as f:
    crate_json = f.read()
    reqbody = {"crate_json": crate_json, "profile_name": "five-safes-crate"}
    response = requests.post(
        f"{BASE_URL}/v1/ro_crates/validate_metadata",
        json=reqbody,
    )

    assert response.status_code == 200
    body = response.json()
    display(body)
    assert body["status"] == "valid"

results in these validation errors:

{'created_at': None,
 'detail': {'issues': [{'check': {'description': 'Check if the RO-Crate Metadata File Descriptor has a `conformsTo` property which points to the RO-Crate specification version',
     'identifier': 'ro-crate-1.1_5.3',
     'label': 'MUST 5.3',
     'name': 'Metadata File Descriptor entity: `conformsTo` property',
     'order': 3,
     'requirement': {'description': 'RO-Crate Metadata Descriptor MUST be defined\n    according with the requirements details defined in [RO-Crate Metadata File Descriptor](https://www.researchobject.org/ro-crate/1.1/root-data-entity.html#ro-crate-metadata-file-descriptor)',
      'identifier': 'ro-crate-1.1_5',
      'name': 'RO-Crate Metadata File Descriptor REQUIRED properties',
      'order': 5,
      'profile': {'description': 'RO-Crate Metadata Specification.',
       'identifier': 'ro-crate-1.1',
       'name': 'RO-Crate Metadata Specification 1.1',
       'uri': 'https://w3id.org/ro/crate/1.1'}},
     'severity': 'REQUIRED'},
    'message': 'The RO-Crate metadata file descriptor MUST have a `conformsTo` property with the RO-Crate specification version',
    'severity': 'REQUIRED',
    'violatingEntity': './ro-crate-metadata.json',
    'violatingProperty': 'http://purl.org/dc/terms/conformsTo',
    'violatingPropertyValue': None}],
  'meta': {'version': '0.2'},
  'passed': False,
  'validation_settings': {'abort_on_first': False,
   'enable_profile_inheritance': True,
   'profile_identifier': 'five-safes-crate-0.4',
   'requirement_severity': 'REQUIRED',
   'rocrate_validator_version': '0.11.2'}},
 'profile': 'five-safes-crate',
 'status': 'invalid'}

With this PR the above validation errors go away, but I see a strange UTF-8 error- but maybe there's something weird with my docker build?
podman build --build-arg FIVE_SAFES_PROFILE_ VERSION=five-safes-0.8.0 --build-arg PROFILES_ARCHIVE_URL=https://github.com/eScienceLab/rocrate-va lidator/archive/refs/tags/five-safes-0.8.0.tar.gz --build-arg EXTRA_PROFILES_PATH=/app/extra-profil es -t ro-crate-validation-service .

{'created_at': None,
 'detail': {'issues': [{'check': {'description': 'Check if the file descriptor is UTF-8 encoded',
     'identifier': 'ro-crate-1.2_3.1',
     'label': 'REQUIRED 3.1',
     'name': 'File Descriptor UTF-8 encoding',
     'order': 1,
     'requirement': {'description': 'The file descriptor MUST be UTF-8 encoded',
      'identifier': 'ro-crate-1.2_3',
      'name': 'File Descriptor UTF-8 encoding',
      'order': 3,
      'profile': {'description': 'RO-Crate Metadata Specification.',
       'identifier': 'ro-crate-1.2',
       'name': 'RO-Crate Metadata Specification 1.2',
       'uri': 'https://w3id.org/ro/crate/1.2'}},
     'severity': 'REQUIRED'},
    'message': 'RO-Crate file descriptor "ro-crate-metadata.json" is not UTF-8 encoded',
    'severity': 'REQUIRED',
    'violatingEntity': None,
    'violatingProperty': None,
    'violatingPropertyValue': None}],
  'meta': {'version': '0.2'},
  'passed': False,
  'validation_settings': {'abort_on_first': False,
   'enable_profile_inheritance': True,
   'profile_identifier': 'five-safes-crate-0.4',
   'requirement_severity': 'REQUIRED',
   'rocrate_validator_version': '0.11.2'}},
 'profile': 'five-safes-crate',
 'status': 'invalid'}

@elichad

elichad commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR @manics ! The new error indicates that the RO-Crate metadata file you're testing isn't in UTF-8 encoding format - did the encoding get changed somehow when you downloaded the test files? (haven't tested the docker build locally but I know the original file is UTF-8 encoded)

@manics

manics commented Aug 6, 2026

Copy link
Copy Markdown
Author

I'm pretty sure the encoding is correct, and it works fine if I run the validator directly
https://gist.github.com/manics/c88952351d3d74138842c2870ce19d57
which is why I'm wondering if there's something weird with my podman/docker build

@elichad

elichad commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Strange. I've just replicated this error on my side too:

  • Updated images to ghcr.io/esciencelab/ro-crate-validation-service:2.0 in docker-compose.yml
  • Ran docker compose up --build
  • Ran jq -Rs '{crate_json: ., profile_name: "ro-crate-1.2"}' path/to/ro-crate-metadata.json | curl -X POST http://localhost:5001/v1/ro_crates/validate_metadata -H 'Content -Type: application/json' -d @- (and used the ro-crate-metadata.json directly from my local copy of the rocrate-validator repo)

Output:

{
    "created_at": null,
    "detail": {
        "issues": [
            {
                "check": {
                    "description": "Check if the file descriptor is UTF-8 encoded",
                    "identifier": "ro-crate-1.2_3.1",
                    "label": "REQUIRED 3.1",
                    "name": "File Descriptor UTF-8 encoding",
                    "order": 1,
                    "requirement": {
                        "description": "The file descriptor MUST be UTF-8 encoded",
                        "identifier": "ro-crate-1.2_3",
                        "name": "File Descriptor UTF-8 encoding",
                        "order": 3,
                        "profile": {
                            "description": "RO-Crate Metadata Specification.",
                            "identifier": "ro-crate-1.2",
                            "name": "RO-Crate Metadata Specification 1.2",
                            "uri": "https://w3id.org/ro/crate/1.2"
                        }
                    },
                    "severity": "REQUIRED"
                },
                "message": "RO-Crate file descriptor \"ro-crate-metadata.json\" is not UTF-8 encoded",
                "severity": "REQUIRED",
                "violatingEntity": null,
                "violatingProperty": null,
                "violatingPropertyValue": null
            }
        ],
        "meta": {
            "version": "0.2"
        },
        "passed": false,
        "validation_settings": {
            "abort_on_first": false,
            "enable_profile_inheritance": true,
            "profile_identifier": "ro-crate-1.2",
            "requirement_severity": "REQUIRED",
            "rocrate_validator_version": "0.11.2"
        }
    },
    "profile": "ro-crate-1.2",
    "status": "invalid"
}

@alexhambley

alexhambley commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Hi @manics (and @elichad!), the UTF-8 error is a false positive from an upstream bug in roc-validator 0.11.2 /11.3. I've made an issue here.

The issue is that:

  • validate_metadata runs the validator in metadata-only mode, where there is no file on disk.
  • In this case, the upstream validator constructs an ROCrateLocalFolder handle whose root directory points at the service process's working dir (/app). This is just a pointer.
  • The ro-crate 1.2 profile added a File Descriptor UTF-8 encoding check which, unlike the check above it, doesn't skip in metadata-only mode. For example, in the FileDescriptorExistence class you have:
if context.settings.metadata_only:
            logger.debug(...)
            return True
  • It tries to read ro-crate-metadata.json from disk which produces a FileNotFoundError (as I said, there's no such file under /app), and an except Exception reports that as "not UTF-8 encoded".
  • The 1.1 profile has no UTF-8 check, hence no issue before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants