Skip to content

fix: preserve concrete type identity in selected map keys - #71

Merged
picatz merged 2 commits into
mainfrom
fix/selected-map-key-identity
Oct 9, 2026
Merged

picatz merged 2 commits into
mainfrom
fix/selected-map-key-identity

Conversation

@picatz

@picatz picatz commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Preserve concrete interface key types in direct and helper map write/delete matching: int(1), int64(1), and defined types are distinct; aliases retain Go identity.
  • Resolve wrapped helper key parameters across nesting without rewriting SSA or changing value-summary substitution.
  • Normalize supported scalar conversions, with a representability fast path for ordinary integers.
  • Keep map-range behavior, alias policy, finite summary reduction, and nested event composition unchanged.

Precision boundary

Native int, uint, and uintptr values outside the range common to 32- and 64-bit targets remain unknown because this SSA layer does not provide target sizes. Three same-large-native-key controls are explicitly conservative: baseline 0 findings, candidate 1, semantic expectation 0. Fractional/out-of-range float-to-int and integer-to-string conversions remain weak.

The targeted 77-case behavioral matrix corrects 43 baseline fixture results: 22 missed flows and 21 overreports. The three native-width controls are separate. These synthetic counts are not a prevalence estimate or global soundness claim.

Validation

All gates pass on frozen head cbd9cc8a236e9997b8bfbbec2088f521d214f1e9:

  • All eight hosted checks: full builds/tests on patched Go 1.26.9 and 1.27.2; both existing scoped race jobs; vet, formatting, Staticcheck, and govulncheck.
  • All 15 pinned corpus snapshots unchanged; scoreboard byte-identical at 8 TP, 5 known FN, 0 FP.
  • 77 behavioral cases, 21 scalar cases, and three labeled native-width controls; repeated full diagnostics/evidence and attribution checks.
  • Exact diagnostic/evidence parity on 17 unchanged valid-SSA helper fixtures; existing finite/reference, cursor-boundary and map-range coverage passes.
  • Independent review passed 45 behavioral and 21 scalar cases. The final integer-fit delta received a separate source review and passed 11,099 comparisons against the preceding normalization function.
  • All 362 final source blobs verified against the remote tree; complete premerge source/evidence archive retained.

Allocation measurements

Complete helper-key queries exclude SSA construction. Three allocation repetitions agree:

  • String: 600 B/12 allocations → 552 B/7
  • Int64 and interface-int64: 546 B/8 → 552 B/7
  • Wrapped parameter: 504 B/8 → 552 B/7
  • Nested wrapped parameter: 1176 B/14 → 1584 B/16
  • Numeric wrapping: 477 B/6 → 648 B/11

The last three include newly corrected result/parameter behavior. Initial unoptimized int64 matching used 1160 B/29; the reviewed fast path removes that overhead. Existing bounded string-helper shapes save 48 B/5 allocations per query. No shared-host timing claim is made.

Inherited nested conditional clear/delete, nested write-then-delete, uncertain-map alias, and helper range limitations remain outside this correction.

picatz added 2 commits October 9, 2026 01:05
Keep interface key types through helper parameter wrappers and compare normalized scalar keys consistently for direct and helper writes/deletes. Preserve range and summary composition behavior, with explicit conservative native-width boundaries.
Use a BitLen representability check before exact fixed-width truncation, retaining the existing signed-minimum, overflow, native-width and floating-conversion fallbacks. Differential validation covers 11,099 normalization inputs.
@picatz
picatz marked this pull request as ready for review October 9, 2026 05:29
@picatz
picatz merged commit bf30bd9 into main Oct 9, 2026
8 checks passed
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