Skip to content

Provenance metadata in emitted definitions

Context and Problem Statement

It is useful to know that a deployed definition was generated by Bylaw, and where its source is, so nobody edits it in the portal by hand. But EPAC compares the full definition, including metadata, when deciding what to redeploy. Any provenance value that changes without the policy changing (Bylaw version, timestamp, commit hash) would redeploy every definition on every Bylaw upgrade or build, and would add noise to every diff.

Decision Drivers

  • Deterministic output (ADR-0009). Nothing may change unless the input changes.
  • No conflict with EPAC's own metadata.deployedBy.
  • Provenance should be discoverable in Azure.

Considered Options

  • Off by default, with an opt-in static marker
  • Always stamp generatedBy with the Bylaw version
  • Always stamp the source path and a content hash
  • No provenance at all

Decision Outcome

Proposed: "Off by default, with an opt-in static marker".

Deferred 2026-11-29 until there's demand. It is listed in the SPEC under "Later", with what its review needs to settle. Being opt-in, it can be added at any time without changing anyone's output.

  • By default, no provenance keys are emitted.
  • With "provenance": true in bylaw.json (or Build-Bylaw -Provenance), the compiler emits metadata.generatedBy: "bylaw". This value is static, with no version, timestamp or path, so it never changes output.
  • Optionally, metadata.source could hold the source path relative to the folder that contains bylaw.json, with / separators. It is stable unless the file moves. This is to be decided when the proposal is reviewed.
  • Never emitted: the Bylaw version, timestamps, commit hashes or deployedBy.

Consequences

  • Good, because output stays deterministic and redeploys only happen when the policy changes.
  • Bad, because the marker doesn't say which Bylaw version produced a definition. That is recoverable from source control.

Pros and Cons of the Options

Opt-in static marker

  • Good, because provenance is available without diff noise.
  • Bad, because it is off by default, so many users won't benefit.

Version stamp

  • Good, because it is precise.
  • Bad, because every upgrade changes every file and triggers redeploys across the whole estate.

Path and content hash

  • Good, because it is traceable.
  • Bad, because moving a file changes output. The hash is redundant with the content itself.

None

  • Good, because it is simplest.
  • Bad, because there is no way to tell generated definitions apart in Azure.