Skip to content

Snapshot Approximation public array state#77

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

Snapshot Approximation public array state#77
0xC000005 merged 1 commit intomainfrom
audit/cycle-12-approx-public-state

Conversation

@0xC000005
Copy link
Copy Markdown
Owner

Summary

  • Return snapshots from ChebyshevApproximation public array properties: Domain, NNodes, NodeArrays, TensorValues, Weights, and DiffMatrices.
  • Move ChebyshevApproximation internals to private backing fields so evaluation/build/algebra paths do not read clone-returning public properties.
  • Add internal live-state accessors for internal collaborators (AdaptiveBuild, Algebra, spline JSON load) that need direct owned state.
  • Add regression tests proving mutation of returned public arrays does not corrupt approximation metadata, values, weights, differentiation matrices, or domain validation.

Refs #73.

Why This Is A Staged Slice

Issue #73 is broader than Approximation. This PR hardens only ChebyshevApproximation because it requires a backing-field refactor rather than a one-line clone-on-get patch. Spline, Slider, wrapper records, SobolResult, and cached evaluation buffers remain follow-up work.

Verification

  • RED: ApproxPublicStateOwnershipTests initially failed 3/3 because returned arrays were live and mutations corrupted behavior.
  • dotnet test tests/ChebyshevSharp.Tests/ChebyshevSharp.Tests.csproj --configuration Release --no-restore --filter FullyQualifiedName~ApproxPublicStateOwnershipTests --verbosity minimal -> 3/3 passed.
  • Broader Approximation-related slice (Approx|FromValues|Algebra|Serialization|SobolIndices|ExtrudeSlice) -> 397/397 passed.
  • dotnet test --configuration Release --no-restore --verbosity minimal -> 1512/1512 passed.
  • First full solution build failed because benchmark/example assets were missing in the fresh worktree; after dotnet restore, dotnet build --configuration Release --no-restore --verbosity minimal passed with 0 warnings/errors.
  • dotnet format --verify-no-changes --verbosity minimal -> passed.
  • dotnet pack src/ChebyshevSharp --configuration Release --no-build --output /tmp/chebsharp-cycle12-approx-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-approx-public-state branch 2 times, most recently from 11c2f1f to 085cea5 Compare May 6, 2026 15:41
@0xC000005 0xC000005 force-pushed the audit/cycle-12-approx-public-state branch from 085cea5 to b341d1c Compare May 6, 2026 15:48
@0xC000005 0xC000005 merged commit 8de2b7d into main May 6, 2026
6 checks passed
@0xC000005 0xC000005 deleted the audit/cycle-12-approx-public-state branch May 6, 2026 15:52
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