Skip to content

feat(dummies): add terminal Any.String().OneOf for explicit value sets - #275

Merged
Reefact merged 4 commits into
mainfrom
claude/dummies-stringai-method-5kkq6u
Jul 21, 2026
Merged

feat(dummies): add terminal Any.String().OneOf for explicit value sets#275
Reefact merged 4 commits into
mainfrom
claude/dummies-stringai-method-5kkq6u

Conversation

@Reefact

@Reefact Reefact commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

Add Any.String().OneOf(...), a terminal string generator that draws from an explicit, fixed set of caller-supplied values — the dummy for a value whose domain is a short, closed list (a currency code, a well-known name) rather than a structural shape. It complements Any.StringMatching, filling the one string-generation gap that previously forced a hand-written array or a foreign library.

Type of change

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

Changes

  • Add AnyString.OneOf(params string[]) and an IEnumerable<string> overload, returning AnyStringOneOf — a new terminal IAny<string> generator that mirrors AnyPattern/StringMatching: the value set is the whole specification, so it exposes no shape, length or character constraints, and rejects being declared after another constraint with a ConflictingAnyConstraintException.
  • Deduplicate values (ordinal) and draw uniformly from the seedable source, so a run replays under a seed; AnyStringOneOf implements the internal ICardinalityHint<string>, so a distinct collection over it (SetOf, dictionary keys) is gated eagerly by its cardinality (ADR-0013).
  • Add the StringSpec.IsUnconstrained marker that enforces the terminal contract.
  • Add Dummies.UnitTests/AnyStringOneOfTests.cs: draw domain, dedup, variety, reproducibility, As/OrNull/SetOf composition, terminal conflicts, argument validation, and the sequence overload.
  • Document the generator in the Dummies package README.
  • Record the decision in ADR-0030 (EN + FR).

Testing

  • dotnet build FirstClassErrors.sln — 0 warnings, 0 errors (netstandard2.0 + net8.0).
  • dotnet test FirstClassErrors.sln — every project green, 0 failed (Dummies.UnitTests: 253 passed).
  • Analyzer tests pass (FirstClassErrors.Analyzers.UnitTests) — 132 passed (untouched, run as part of the solution).

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

Note: the Dummies package ships an English-only package README (there is no README.fr.md for it); ADR-0030 carries its own French translation per the ADR bilingual convention.

Architecture decisions

  • No architectural decision in this pull request
  • New decision recorded — ADR drafted as Proposed: ADR-0030

The terminal-vs-composable choice for the string OneOf mirrors ADR-0025. Drafted as Proposed, then accepted by the maintainer (@Reefact) in the originating session, so ADR-0030 is committed as Accepted.

Related issues

None.

🤖 Generated with Claude Code

https://claude.ai/code/session_011JxSJGauajxuFBot4NsHdn


Generated by Claude Code

claude and others added 4 commits July 21, 2026 17:14
Any.String() had no way to draw from a fixed, closed list of values — the
dummy for a domain that is a short enumeration (a currency code, a
well-known name) rather than a structural shape. The scalar generators
offer a composable OneOf; strings now get a terminal one.

OneOf(params string[]) returns AnyStringOneOf, a terminal IAny<string>
mirroring StringMatching (ADR-0025): the value set is the whole
specification, so it exposes no shape, length or character constraints and
rejects being declared after another constraint with a
ConflictingAnyConstraintException. Values are deduplicated and drawn
uniformly from the seedable source, so a run replays under a seed, and
AnyStringOneOf advertises ICardinalityHint<string> so a distinct
collection over it is gated eagerly by its cardinality (ADR-0013).

Adds unit tests, the package README entry, and ADR-0030 (Proposed, EN and
FR). No new dependency: the zero-dependency architecture test and the
whole solution build clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011JxSJGauajxuFBot4NsHdn
The terminal Any.String().OneOf so far took only params string[]. A set
held as a sequence — a List, a LINQ result, values loaded at test setup —
had to be materialized with ToArray at the call site.

Add an IEnumerable<string> overload that delegates to the params one, so
all validation, deduplication and the terminal contract stay in a single
place. Overload resolution is unambiguous: a string[] argument still binds
to the more specific params overload (including OneOf(null!)), so no
existing call changes. Covered by tests for the sequence path, its
argument validation, and its terminal conflict.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011JxSJGauajxuFBot4NsHdn
The maintainer accepted the decision recorded in ADR-0030 (draw arbitrary
strings from an explicit, terminal value set). Flip its status from
Proposed to Accepted in the English and French records and in the index.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011JxSJGauajxuFBot4NsHdn
@Reefact
Reefact merged commit 638bf97 into main Jul 21, 2026
15 checks passed
@Reefact
Reefact deleted the claude/dummies-stringai-method-5kkq6u branch July 21, 2026 19:38
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