Align received naming single tfm

Merged
SI
4mo ago
+115-17

Aligns the .received. file name with its .verified. file name for single-target-framework projects, and clarifies the naming rules in the docs and AI guidance.

Background

UniqueForRuntime/UniqueForRuntimeAndVersion previously applied only to the verified name. On a single-TFM project that meant a mismatched pair:

WidgetTests.Render.received.txt          <- no runtime token
WidgetTests.Render.DotNet.verified.txt   <- runtime token

The two names could not be paired by name, which breaks external tooling that maps a received file to its verified file (e.g. review/accept tools). The received file now carries the same uniqueness as the verified file when a single framework is targeted.

Multi-TFM behaviour is deliberately unchanged: there the received file always keeps the runtime and version, so the parallel runs of each framework don't overwrite each other's received files.

How received and verified names can diverge

Both names are built from the same template:

{TypeName.MethodName}  {parameters}  {uniqueness}  .received/.verified.{ext}

TypeName.MethodName and extension are always identical. Divergence comes from two independent axes, and a file can diverge on either or both at once:

  • Uniqueness — the runtime token. This is the axis this PR changed.
  • Parameters — the received name keeps parameters the verified name drops. Pre-existing; unchanged here.

Baseline for the examples: class WidgetTests { Task Render() } on net11.0 / x64 → Runtime = DotNet, RuntimeAndVersion = DotNet11_0.

Axis 1 — runtime uniqueness

The shared uniqueness (target-framework / assembly-config / architecture / OS-platform, if requested) is identical on both sides. The runtime token is what differs. Verified gets DotNet for UniqueForRuntime, DotNet11_0 for UniqueForRuntimeAndVersion, nothing otherwise. Received on multi-TFM always gets DotNet11_0; on single-TFM it now matches verified.

#ProjectSettingsreceivedverifiedMatch?
A1multi-TFM(none)WidgetTests.Render.DotNet11_0.received.txtWidgetTests.Render.verified.txt✗
A2multi-TFMUniqueForRuntimeWidgetTests.Render.DotNet11_0.received.txtWidgetTests.Render.DotNet.verified.txt✗
A3multi-TFMUniqueForRuntimeAndVersionWidgetTests.Render.DotNet11_0.received.txtWidgetTests.Render.DotNet11_0.verified.txt✓
A4single-TFM(none)WidgetTests.Render.received.txtWidgetTests.Render.verified.txt✓
A5single-TFMUniqueForRuntimechanged — see belowWidgetTests.Render.DotNet.verified.txtchanged
A6single-TFMUniqueForRuntimeAndVersionchanged — see belowWidgetTests.Render.DotNet11_0.verified.txtchanged

A5 and A6 are the only rows this PR changes. A1–A4 are byte-for-byte identical before and after.

A5  single-TFM + UniqueForRuntime
  BEFORE:  received  WidgetTests.Render.received.txt          verified  WidgetTests.Render.DotNet.verified.txt   ✗ mismatch
  AFTER:   received  WidgetTests.Render.DotNet.received.txt   verified  WidgetTests.Render.DotNet.verified.txt   ✓ match

A6  single-TFM + UniqueForRuntimeAndVersion
  BEFORE:  received  WidgetTests.Render.received.txt              verified  WidgetTests.Render.DotNet11_0.verified.txt   ✗ mismatch
  AFTER:   received  WidgetTests.Render.DotNet11_0.received.txt   verified  WidgetTests.Render.DotNet11_0.verified.txt   ✓ match

A2 is the nastiest surviving mismatch, and the reason "just strip the runtime suffix from the received name" is bad advice: received is DotNet11_0, verified is DotNet — not a suffix-strip apart.

Axis 2 — parameters (unchanged by this PR)

Received always carries the full parameter set; verified may drop some or all. Using two parameters size="large", theme="dark" (single-TFM, no UniqueFor):

#SettingsreceivedverifiedMatch?
B1normal paramsWidgetTests.Render_size=large_theme=dark.received.txtWidgetTests.Render_size=large_theme=dark.verified.txt✓
B2IgnoreParameters("size")WidgetTests.Render_size=large_theme=dark.received.txtWidgetTests.Render_theme=dark.verified.txt✗
B3IgnoreParametersForVerified()WidgetTests.Render_size=large_theme=dark.received.txtWidgetTests.Render.verified.txt✗
B4IgnoreConstructorParameterskeeps ctor argsdrops ctor args✗

B2 drops the named parameter only, B3 drops all of them, B4 drops the class-constructor args. UseTextForParameters applies the same text to both sides, so it never diverges.

Both axes at once

They stack. E.g. multi-TFM + IgnoreParameters("size") (same before and after this PR):

received  WidgetTests.Render_size=large.DotNet11_0.received.txt
verified  WidgetTests.Render.verified.txt

Takeaway

Received and verified names can differ by a runtime token and/or by dropped parameters, and the divergence is not a simple reversible transform. So the safe rule — reflected in the doc and AI-guidance changes here — is: don't reconstruct the verified name from the received name; read it off the Verified: line of the exception message. The behavioural half of this PR just removes one specific mismatch (single-TFM UniqueForRuntime*, rows A5/A6) so that case pairs by name.

Changes

  • InnerVerifier.PrefixForFileConvention — new GetUniquenessReceived helper: single-TFM received uses the verified uniqueness; multi-TFM unchanged.
  • SingleTfmTests — three tests covering single-TFM UniqueForRuntime, UniqueForRuntimeAndVersion, and UseFileName + UniqueForRuntime (verified to fail without the fix).
  • docs/naming.md — new "Received and single-targeting" section; the multi-targeting section notes the UseUniqueDirectory case.
  • docs/ai-usage.md + claude.md — accept instructions point at the Verified: line rather than deriving the name; new rule covering the runtime-suffix and ignored-parameter divergences.