Skip to content

feat(binder): let consumers document their overridden structural errors - #193

Merged
Reefact merged 4 commits into
mainfrom
claude/issue-149-status-c0j81v
Jul 18, 2026
Merged

feat(binder): let consumers document their overridden structural errors#193
Reefact merged 4 commits into
mainfrom
claude/issue-149-status-c0j81v

Conversation

@Reefact

@Reefact Reefact commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

A consumer that overrides a binder structural-error definition (ADR-0018) owns the effective code and messages, which live in the consumer's own assembly and are absent from the RequestBinder binary. This adds public seams so the consumer documents those errors in its own generated catalog, reusing the binder's code-independent prose and a faithful example — closing the override half of #140 without any change to the generator.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Analyzer / diagnostic change
  • Tests
  • Documentation

Changes

  • RequestBindingError exposes four public seams, parameterised by a BinderErrorDefinition: DescribeArgumentRequired / DescribeArgumentInvalid (the binder's generic prose with a live example built from the definition) and SampleArgumentRequired / SampleArgumentInvalid (the example error itself, for the consumer's [DocumentedBy] factory).
  • The private parameterless documentation methods now delegate to the public overloads with the defaults, so the binder's own catalog is unchanged.
  • The two sample seams return an error without [DocumentedBy]; they are suppressed against FCE009 (dogfooded on the binder) as deliberate non-catalog helpers, with a justification.
  • Tests (StructuralErrorDescriptionTests): the samples carry the definition's custom code, messages, and structural shape (context, wrapped cause); Describe reuses the binder's title/diagnoses with the custom example; the default-definition path still yields REQUEST_ARGUMENT_*.
  • RequestBinder guide (EN + FR): a subsection showing the small [ProvidesErrorsFor] glue that delegates to the seams.

Testing

  • dotnet build FirstClassErrors.sln
  • dotnet test FirstClassErrors.sln
  • Analyzer tests pass (FirstClassErrors.Analyzers.UnitTests)

All green: 0 warnings/errors under the solution's total TreatWarningsAsErrors ratchet; 1047 tests passed, 0 failed, across all 9 test projects.

Documentation

  • Public API / error documentation updated
  • README / doc/ updated
  • French translation (doc/handwritten/for-users/README.fr.md) updated if user-facing behavior changed
  • No documentation change required

The RequestBinder guide's English and French versions were updated together. The top-level README.fr.md doesn't describe binder internals, so it wasn't touched.

Architecture decisions

  • No architectural decision in this pull request
  • New decision recorded — ADR-0019 (drafted, then Accepted at @Reefact's direction this session)
  • Supersedes an existing ADR
  • ⚠️ Conflicts with an existing ADR

ADR-0019 records documenting overridden binder errors in the consumer's own catalog via these seams, rather than the generator auto-discovering a referenced package's codes — and rules that auto-discovery out (not merely defers it): RequestBinder is the only package shipping emittable codes, its binary carries only the defaults, so auto-discovery could never surface a consumer's overrides. This closes the risk ADR-0016 and ADR-0018 deferred to #140.

Related issues

Refs #140 (closed — the override case is resolved by these seams; auto-discovery ruled out, see ADR-0019)


Generated by Claude Code

claude added 4 commits July 18, 2026 23:41
A consumer that overrides a structural-error definition owns the effective
code and messages, so it must document them in its own catalog. Expose the
binder's code-independent prose and a faithful example, parameterised by a
BinderErrorDefinition:

- DescribeArgumentRequired / DescribeArgumentInvalid — the generic
  documentation (title, rule, diagnoses) with a live example built from the
  given definition;
- SampleArgumentRequired / SampleArgumentInvalid — the example error itself,
  for the consumer's [DocumentedBy] factory.

The private parameterless documentation methods now delegate to the public
overloads with the defaults, so the binder's own catalog is unchanged. The two
sample seams return an error without [DocumentedBy] and are suppressed against
FCE009 as deliberate non-catalog helpers.

Refs: #140

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013sD2irTr5PBVpxHt2dkRzQ
Add a subsection to the RequestBinder guide (EN + FR) showing the small
[ProvidesErrorsFor] glue that surfaces overridden structural errors in a
consumer's own generated catalog, delegating to the public Describe / Sample
seams — so the documented entry matches what the binder emits at runtime.

Refs: #140

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013sD2irTr5PBVpxHt2dkRzQ
Record the decision to close the override half of #140 by having a consumer
document its overridden structural errors in its own catalog, via public binder
seams, rather than the generator auto-discovering a referenced package's codes.
Drafted Proposed (EN + FR) and indexed; auto-discovery stays an open follow-up.

Refs: #140

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013sD2irTr5PBVpxHt2dkRzQ
Per the maintainer's decision: ADR-0019 is Accepted. Tighten its stance on
auto-discovery — since RequestBinder is the only package shipping emittable
codes and its binary carries only the defaults, auto-discovery is not deferred
but unnecessary (it could never surface a consumer's overrides, and would
mislead an overriding consumer). Follow-up is now None.

Refs: #140

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013sD2irTr5PBVpxHt2dkRzQ
@Reefact
Reefact merged commit 94f92e1 into main Jul 18, 2026
13 checks passed
@Reefact
Reefact deleted the claude/issue-149-status-c0j81v branch July 18, 2026 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants