markharness

0040: Read the content of one chosen element with traceability show

Status

Accepted (decided 2026-10-05).

Background

The GUI is laid out as one tree rooted at the requirements, plus a detail pane for the chosen element. The tree is built from the light traceability output. The detail pane shows the content of the chosen element.

Each Node in traceability carries only an identifier and a label. Axes, descriptions, procedures, a Scenario’s phases, and the steps of a generated TestCase appear in no read output. The design doc §11 also says that view does not read Knowledge or .markharness/ directly and takes only CLI output as input. The GUI therefore has no way to obtain the content of its detail pane (Issue #95).

Design doc §12 listed a TestCase detail model as something to add “once view shows a concrete need”, and said that reading the generated file directly could stand in for it meanwhile. The detail pane is that concrete need, so the statement must be revisited. Reading the file directly also contradicts the boundary that view does not read .markharness/ directly.

Decision

1. Add a new command, traceability show

markharness traceability show --uid <UID> [--at <git-ref>] [-d, --dir <path>]

It writes exactly one JSON document, holding the content of the chosen element, to standard output. traceability stays light; only the detail carries content. --at means what it means for traceability: the working tree when omitted, the given Git ref otherwise (0033). If the tree and the detail were read at different points, the GUI would show contradictory values.

The existing use of traceability with --at and no subcommand does not change. show is a subcommand of it.

2. Fields per element

Element Fields
Requirement requirement_id, axis, description
Feature feature_id, axis, description
Behavior behavior_id, axis, description, procedures
Scenario scenario_id, description, phases (each steps item as action or use, and results), implementation_note
TestCase case_id, case_revision, phases (with use: expanded: what actually runs)

Every element also carries schema_version, record_kind, at, kind, and uid.

3. A TestCase is looked up by case_uid and returns its current revision

A TestCase’s uid is traceability’s test_cases[].case_uid. case_revision is not an input. If the GUI passes the same --at it used for the tree, the revision returned matches the tree.

4. An unknown uid is a failure

If --uid matches no element at that point, the command exits with code 2 and writes nothing to standard output. The error message names the uid and the point it was read at (working-tree or the Git ref). The GUI recovers by re-reading the tree.

5. schema_version is 1

Following 0039, it is not raised during 0.x.

6. Scope

These fields are not used for display, so they are left out for now. If the editing scope later needs them, they are decided separately.

Design doc §12’s “TestCase detail model” is treated as added by this decision.

Rationale

Alternatives considered

Consequences