Repository navigation
fix(z3linq,#17302): short (Int16) symbols never read back -- checked ToInt16 conversion - #32
Merged
Merged
Conversation
…ToInt16 conversion The read path folded Int16 into the Int32 arm of both switches (property read in ConvertZ3Expression, element read in ConvertScalarExpr): ReadIntegral (asInt64: false) returns an int, and PropertyInfo.SetValue on a short property throws ArgumentException after a successful solve -- satisfiable theorems on short members were unusable, and the failure read as a solver crash. The Int16 arm now reads wide (asInt64: true) and converts through a checked ToInt16 that names the symbol on overflow, mirroring ToDateTime. .deploy/Z3.Linq.dll rebuilt from the Release output so the fix reaches the notebooks (postmortem of #27: a source-only fix leaves the tracked artifact byte-identical and 17 notebooks keep the defect). Tests: 7 new (5 boundary round-trips incl. MinValue/MaxValue, list element round-trip on the collection path, out-of-range OverflowException naming the symbol), suite 94/94 green. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Test Results94 tests 94 ✅ 3s ⏱️ Results for commit 5ad0c7b. |
myia-ai-01
pushed a commit
to jsboige/CoursIA
that referenced
this pull request
Sep 22, 2026
…x (fork PR #32) (#17318) Bumps MyIA.AI.Notebooks/SymbolicAI/SMT/Z3.Linq 20984bfd -> 5ad0c7b: the Int16 read arm no longer folds into Int32 (PropertyInfo.SetValue ArgumentException after a successful solve); checked ToInt16 names the symbol on overflow; .deploy/Z3.Linq.dll rebuilt so the 17 notebooks binding it get the fix. Fork suite 94/94 green. Merge order: fork PR MyIntelligenceAgency/Z3.Linq#32 first. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Sep 23, 2026
jsboige
pushed a commit
that referenced
this pull request
Sep 23, 2026
…th fixes Built from the rebased head (237b05e, #32 Int16 read-back merged): the wrapper now carries the Int16 arm and the scalar bounds in one binary. A binary DLL cannot be merged, so this is a rebuild rather than a resolution. Verified on the artifact: ToInt16, AssertBounds, GetBounds, SymbolType and the fork's CollectionHandling are all present in the rebuilt assembly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
jsboige
pushed a commit
that referenced
this pull request
Sep 23, 2026
…jette toujours Interaction entre les deux correctifs, mesuree apres rebase sur 237b05e : b.S > short.MaxValue n'est plus satisfiable, puisque le symbole scalaire est desormais borne a la plage de son type -- le read verifie n'est plus atteint, donc Solve() rend null au lieu de lever OverflowException. Le test de #32 pinnait l'ancienne premisse ("the symbol is an unbounded integer to Z3"). Forme retenue : celle du precedent DateTime de cette meme PR, ou le scalaire hors bornes est UNSAT et ou la couverture du read verifie est deplacee vers le chemin collection -- les bornes n'atteignent pas les elements, dont la longueur n'est pas connue a la construction du theoreme. Regle anti-regression : on deplace la couverture, on ne la supprime pas. Le jumeau ajoute Solve_ShortInListBeyondRange_StillThrowsNamingTheSymbol passe, ce qui mesure que le chemin element jette bien toujours. dotnet test : 102 reussis, 0 echec (94 a la base 6ac5b80, +7 des tests Int16 de #32, +1 de la scission). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Grain: FIX/dotnet-lib -- lane myia-po-2026:CoursIA -- prev: CONTENU/notebook-python #17312
short (Int16) symbols never read back from a solved model (#17302, CoursIA)
Defect — both read switches folded
TypeCode.Int16into theInt32arm:ReadIntegral(..., asInt64: false)returns anInt32;PropertyInfo.SetValueon ashortproperty then throwsArgumentException("Object of type 'System.Int32' cannot be converted to type 'System.Int16'") — after a successful solve. Any theorem carrying ashortmember was unusable, and the failure read as a solver crash. Two sites: the property read inConvertZ3Expressionand the collection-element read inConvertScalarExpr.Fix — the
Int16arm reads wide (asInt64: true) and converts through a checkedToInt16(long, string)that throwsOverflowExceptionnaming the symbol on out-of-range values, mirroringToDateTime(endjin#87 pattern). The out-of-type control is a checked read, not a removed one..deploy/Z3.Linq.dllrebuilt from the Release output — postmortem of #27: a source-only fix leaves the tracked artifact byte-identical and the 17 notebooks binding#r "../Z3.Linq/.deploy/Z3.Linq.dll"keep the defect. SHA changedabd7d898…→a25ed0e8….Orthogonality (measured) — the defect precedes and is independent of the bounds port (#17301, PR #31): the CoursIA issue reports the same exception with
AssertBoundsdisabled, and this fix touches only the read path while #31 touches the write path.Validation
Solve_ShortAtEveryBoundary_RoundTrips(Theory: MinValue, MaxValue, 0, −123, 12345),Solve_ShortListRoundTripsEveryElement(collection path),Solve_ShortBeyondRange_ThrowsNamingTheSymbol(checked read)dotnet test -c Release, net8.0)Int32/Int64/DateTime/decimal/double/boolarms untouched — their tests (87) pass byte-for-byte unchangedSee jsboige/CoursIA#17302 (acceptance covered in full: satisfiable round-trips at every boundary, out-of-type control preserved as a naming checked read, no regression on existing types).
🤖 Generated with Claude Code