Skip to content

Snapshot TT public array properties#75

Merged
0xC000005 merged 1 commit intomainfrom
audit/cycle-12-tt-public-state
May 6, 2026
Merged

Snapshot TT public array properties#75
0xC000005 merged 1 commit intomainfrom
audit/cycle-12-tt-public-state

Conversation

@0xC000005
Copy link
Copy Markdown
Owner

Summary

  • Return snapshots from ChebyshevTT.Domain and ChebyshevTT.NNodes instead of exposing private invariant arrays.
  • Add regression tests proving external mutation of those returned arrays cannot corrupt TT metadata or evaluation-domain validation.

Refs #73.

Why This Is A Small Slice

Issue #73 is broader than TT. This PR intentionally hardens only the low-risk TT surface because ChebyshevTT already stores domain and node counts in private backing fields, so snapshot getters do not rewrite hot internal code paths.

Approximation, Spline, and Slider still expose mutable arrays through public auto-properties. They should be handled in follow-up work with a backing-field/snapshot design; a one-line clone-on-get change there would add hidden allocations throughout internal evaluation/build paths.

Verification

  • Red focused tests before fix: TtPublicStateOwnershipTests failed 3/3 because public arrays were live.
  • dotnet test tests/ChebyshevSharp.Tests/ChebyshevSharp.Tests.csproj --configuration Release --no-restore --filter FullyQualifiedName~TtPublicStateOwnershipTests --verbosity minimal -> 3/3 passed.
  • Related TT tests -> 53/53 passed.
  • dotnet test --configuration Release --no-restore --verbosity minimal -> 1505/1505 passed.
  • dotnet format --verify-no-changes --verbosity minimal -> passed.
  • First Release build failed in the fresh worktree because benchmark/example assets were missing; after dotnet restore, dotnet build --configuration Release --no-restore --verbosity minimal passed with 0 warnings/errors.
  • dotnet pack src/ChebyshevSharp --configuration Release --no-build --output /tmp/chebsharp-cycle12-tt-pack -> created ChebyshevSharp.0.12.0.nupkg.
  • git diff --check -> passed.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@0xC000005 0xC000005 force-pushed the audit/cycle-12-tt-public-state branch from 9f21614 to 57a168c Compare May 6, 2026 15:05
@0xC000005 0xC000005 merged commit 19e8335 into main May 6, 2026
6 checks passed
@0xC000005 0xC000005 deleted the audit/cycle-12-tt-public-state branch May 6, 2026 15:08
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.

1 participant