Skip to content

Fix Paths, Color, Quantities, C++ prelude and Strings bugs - #486

Merged
matt-edmondson merged 8 commits into
mainfrom
claude/project-thread-e7vmg5
Oct 27, 2026
Merged

matt-edmondson merged 8 commits into
mainfrom
claude/project-thread-e7vmg5

Conversation

@matt-edmondson

@matt-edmondson matt-edmondson commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Matt · project thread

Fixes the open non-music bugs in Paths, Color, Quantities, the C++ prelude and Strings. One commit per area.

Paths

#385 is already fixed on main by c00d0cd (segment-wise GetRelativePathBySegments, tested against Path.GetRelativePath for every row in that issue); it can be closed.

Color

The color commit is tagged [minor] for the new public members.

Quantities

C++ prelude

Strings

Breaking fixes (#482, #481, #391, #310) are left for a 6.0 PR, pending Matt's call.

Testing

The full Semantics.Test suite passes locally on Linux (net10.0): 1821 tests, 0 failed. Semantics.Cpp.Test passes with g++: 45 tests. Generated sources are regenerated and committed. Windows-only tests are written but were not run here.

https://claude.ai/code/session_01RjhaUGAEJWfvbkaV4MjYkY


Generated by Claude Code

…h; skip unrepresentable entries in GetContents

IsRoot is now true exactly when Parent returns the path itself, so
walking upwards from /home/.. stops (#479). DirectoryPath.Parent
resolves rooted paths and normalizes relative ones as the typed paths
do (#478). Depth counts directories below the root of the resolved
path, or levels below the first segment of the normalized relative
path, instead of separator characters (#466). GetContents skips an
entry whose path fails validation rather than throwing for the whole
listing (#445).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjhaUGAEJWfvbkaV4MjYkY
…klab mixes

NamedColors.Green is CSS's #008000 and the new Lime is #00FF00 (#449).
CompositeOver blends source-over in gamma sRGB; ContrastRatio,
AccessibilityLevelAgainst and AdjustForContrast measure a translucent
color as it looks over the background (#393). AdjustForContrast
gamut-maps its lightness candidates by reducing chroma instead of
clipping, and falls back to mixing towards black or white, so it
reaches the target whenever black or white does (#351). MixOklab and
Gradient return in-gamut colors, and Hsl/Hsv.FromSrgb clamp their
input and treat a rounding-error spread as gray (#355).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjhaUGAEJWfvbkaV4MjYkY
@matt-edmondson matt-edmondson self-assigned this Oct 26, 2026
Comment thread Semantics.Test/Paths/DotSegmentPathTests.cs Fixed
Comment thread Semantics.Test/Paths/DotSegmentPathTests.cs Fixed
Comment thread Semantics.Test/Paths/DotSegmentPathTests.cs Fixed
Comment thread Semantics.Test/Paths/DotSegmentPathTests.cs Fixed
Comment thread Semantics.Test/Paths/DotSegmentPathTests.cs Fixed
Comment thread Semantics.Test/Paths/DotSegmentPathTests.cs Fixed
Comment thread Semantics.Test/Paths/DotSegmentPathTests.cs Fixed
Comment thread Semantics.Test/Paths/DotSegmentPathTests.cs Fixed
…s, division by zero, scaled vector lengths, bounded roots

- domains.json: AbsoluteZeroInCelsius is -273.15, WaterIonProduct is
  1e-14 and MolarVolumeSTP is in m3/mol; mu0/epsilon0 no longer claim
  to be exact (#386).
- Each physical constant is its own lazily filled field, so one that a
  storage type cannot hold throws alone, and one that would lose its
  precision throws instead of reading as zero (#392).
- Logarithmic conversions throw ArgumentOutOfRangeException for a level
  the storage type cannot hold (a linear zero with decimal or integer
  storage) and OverflowException going back, as documented (#352).
- Wavelength, Period and HalfLife keep EnsurePositive through scaling,
  narrowing and subtraction (#354).
- Every generated division throws DivideByZeroException for a zero
  divisor, including vector / scalar, cross-dimension operators and
  Normalize() of a zero vector (#480).
- Vector Length() and Distance() go through StorageMath.Hypot, scaled by
  the largest component, so int, decimal and float vectors whose squares
  overflow still have a length (#327).
- Cbrt/RootN stop for PreciseNumber instead of hanging (#457).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjhaUGAEJWfvbkaV4MjYkY
…tors (#456)

Distance / Duration, Width * Width, Weight * Height and WindVelocity3D * Duration
now compile. Each overload declares a copy of every relationship operator its
base has with itself on the left; results stay base types.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjhaUGAEJWfvbkaV4MjYkY
@matt-edmondson matt-edmondson changed the title Fix path dot segments and color contrast, gamut and named-color bugs Fix Paths, Color and Quantities bugs Oct 26, 2026
…nly explicitly (#451)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjhaUGAEJWfvbkaV4MjYkY
…ributes and the WeakString setter cached per type (#443, #444)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjhaUGAEJWfvbkaV4MjYkY
@matt-edmondson matt-edmondson changed the title Fix Paths, Color and Quantities bugs Fix Paths, Color, Quantities, C++ prelude and Strings bugs Oct 26, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjhaUGAEJWfvbkaV4MjYkY
Comment thread Semantics.Quantities/StorageLiteral.cs Fixed
Comment thread Semantics.Test/SemanticStringCreationCostTests.cs Fixed
Comment thread Semantics.Test/Quantities/GeneratorOutputInvariantTests.cs Fixed
… explicit Where

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjhaUGAEJWfvbkaV4MjYkY
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 58e56ff into main Oct 27, 2026
16 checks passed
@matt-edmondson
matt-edmondson deleted the claude/project-thread-e7vmg5 branch October 27, 2026 13:11
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.

MixOklab/Gradient/FromOklab return out-of-gamut channels, and later HSL adjustments go wrong: white round-tripped through Oklab then DarkenBy(0.5) gives yellow #FFE500 Wavelength/Period/HalfLife reach zero via w - w, w * 0 and Wavelength.From(Length.Zero): the strictly-positive guard only covers From{Unit} Logarithmic scales throw OverflowException for zero with decimal/integer storage: Gain<decimal>.Silence.ToDecibels() crashes despite docs promising negative infinity Color.AdjustForContrast returns the original failing colour for saturated foregrounds (blue on #777777 stays at 1.92:1 though black reaches 4.69:1) Vector Length()/Magnitude()/Distance() square the components before rooting: Position3D<int>.FromMeter(65536, 0, 0).Length() is 0, and a decimal vector past ~2.8e14 throws

2 participants