Skip to content

Tier-2 Editor conformance

Tier-2 Editors apply structured edits to a .uw.md file and produce a new .uw.md that:

  • Round-trips formatting for unrelated regions (untouched bytes stay identical, ignoring trailing whitespace).
  • Honors the supersede vs replace policy from BUILTIN_EDIT_POLICIES (UW_PROTOCOL_v1.md Part V).
  • Updates _meta provenance correctly (new version, timestamp, actor, etc.).
  • Updates frontmatter last_modified on every write.

Fixtures

Each scenario lives in its own subdirectory:

fixtures/<scenario-id>/
├── before.uw.md      Input file
├── operation.json    The EditOperation to apply
└── after.uw.md       Expected output

Each scenario also includes a context.json describing the actor invoking the edit (source, agent_id, agent_version, actor) — required by the reference runner to populate _meta provenance.

Provided scenarios

ScenarioOperationWhat it tests
frontmatter-set-recommendationfrontmatter_set of recommendationFrontmatter update + last_modified bump
section-replace-propertysection_replace of property (manual source)In-place section replace per BUILTIN_EDIT_POLICIES (no supersede)
section-supersede-risk-ratingsection_replace of risk_assessment (agent source)Supersede chain: prior version flagged superseded: true, new version appended
gaps-section-updatefrontmatter_set with options.json: {maintainGaps: true}Post-write maintainer hook regenerates the gaps section under actor system/gaps-maintainer
parent-hash-stampsection_supersede with options.json: {integrity: true} and context.json carrying parentHashapplyEditAsync recomputes content_hash and stamps parent_hash against the prior block's hash; content_hash is masked as <volatile> in baseline because canonicalization includes the timestamp
stale-parent-rejectedsection_supersede with context.parentHash deliberately wrongNegative-path fixture: expected-error.json asserts applyEditAsync rejects with INT-02

Optional fixture siblings

  • context.jsonEditContext (source, agent_id, agent_version, actor, optional parentHash).
  • options.jsonApplyEditOptions ({integrity?: boolean, maintainGaps?: boolean, …}); when integrity: true the runner routes the edit through applyEditAsync.
  • expected-error.json{code, category} for negative-path fixtures. When present, the runner asserts the edit fails with that code instead of comparing against after.uw.md.

A conforming Tier-2 Editor's output for before.uw.md + operation.json MUST match after.uw.md after both files are normalized (stripping trailing whitespace, CRLF differences, and volatile fields: last_modified, _meta.timestamp, ts= fence attributes).

Run via:

bash
node scripts/run-conformance.mjs --tier=2

Released under the MIT License.