Skip to content

Conditionally Create Measure and Library Resources #183

Description

@alexanderkiel

Currently every blazectl evaluate-measure call generates two random urn:uuid: canonical URLs and unconditionally creates a new Measure and Library resource on the server. Repeated evaluations of the same measure therefore accumulate identical resources forever.

Instead, derive the canonical URLs deterministically from the resource content and create the resources conditionally:

  • The Library URL is a name-based UUID (UUIDv5) computed over the CQL library file content.
  • The Measure URL is a name-based UUID computed over the Measure resource content (which includes the Library URL, so a changed CQL file changes both URLs).
  • Both transaction bundle entries use a conditional create (ifNoneExist with url=<canonical>), so the first invocation creates the resources and every subsequent invocation with identical content reuses them.

The CQL parameters introduced in #175 are transmitted in the $evaluate-measure Parameters body and are not part of the Measure or Library resource, so the URLs stay stable across --parameter overrides — the case where deduplication matters most.

The conditional create relies on the invariant that a resource with a content-derived canonical URL has exactly that content. A third party could break the invariant by modifying the resource after blazectl created it, which would make blazectl silently evaluate the modified content. To detect that, blazectl fetches the Measure and Library resources by canonical URL after the transaction and fails if their content (ignoring the server-assigned id and meta) differs from the locally generated resources.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions