Skip to content

Derive the resource identifier from a key and report the builder-error category (BMB-004, ERR-013) #62

Description

@dfkunstler

Derive the resource identifier from a caller key in make_resource, and report the builder-error category for each validation error of the back-matter builders.

The contract requirements [BMB-003], [BMB-004], and [ERR-013] (cairn-proofs/oscal-bindings-specs#46, PR #56) say this:

  1. make_resource accepts an optional key. It generates a fresh identifier only when the caller gives neither an identifier nor a key.
  2. When the caller gives a key and no identifier, the identifier is the UUID version 5 of the UTF-8 bytes of the key, in the namespace 3942257f-e1cf-5e06-9c6f-eeb97ecabe77. An empty key, or a key with an identifier, is a validation error.
  3. Each validation error of a back-matter builder is in the new builder-error category of [ERR-001]. It is not a parse error.

make_resource in src/oscal_bindings/v1/extensions/builders.py has no key input. It raises pydantic.ValidationError for invalid input, and no error type is in the builder-error category.

Tasks

  1. When the binding moves its pin to v0.8.0+oscal.1.2.3 or later, add a builder-error category to the error types. It must not be a parse error.
  2. Add a key input to make_resource. Apply [BMB-004]. Use the UUID version 5 of the Python standard library with the namespace of the requirement. Do not derive the namespace again.
  3. Report the builder-error category for an empty key, for a key with an identifier, and for each other validation error of make_hash, make_rlink, and make_resource ([ERR-013.01], [ERR-013.02]). This includes the unknown hash algorithm of make_hash raises ValueError, not ValidationError, for an unknown algorithm #53.
  4. Add the build-resource operation to the corpus runner. A case has arguments (key, and optional title and identifier) and no input. Compare the uuid of the resource with expected-uuid, or check that the builder reports expected-category. The corpus has five cases, build-resource/*.
  5. Add tests for [BMB-004.02] and [BMB-004.03] if the corpus runner does not cover them. [BMB-004.01] to [BMB-004.05] each have a corpus case or a test.

Blocked by cairn-proofs/oscal-bindings-specs#50, the release that carries [BMB-004] and [ERR-013].

Activity

  1. added a commit that references this issue on Nov 17, 2026
    f304454
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions