Skip to content

[fix] make collection conversion and NaN mutation safe - #94

Merged
vt128 merged 4 commits into
masterfrom
codex/safe-collections-slt21-23-20261110
Nov 12, 2026
Merged

vt128 merged 4 commits into
masterfrom
codex/safe-collections-slt21-23-20261110

Conversation

@vt128

@vt128 vt128 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Address three collection-conversion correctness problems with the existing small fixes:

  • Preserve accepted nil or indirect pointer elements as opaque Go values in no-error APIs, and stop cyclic pointer/interface unwrapping with local cycle state. Static unsupported types, host identity and method precedence retain their contracts.
  • Snapshot map keys and values together so NaN-like keys retain their values and cycle checks inspect the actual entries. MakeDict reports NaN representation conflicts instead of silently merging values.
  • Keep host-map aliases intact: on Go 1.19, Clear rejects non-reflexive keys before changing anything, and popitem reports a failed deletion instead of claiming success.

This combines the unchanged SLT-21/22/23 patches on master 59694c47; no new API, dependency or interpreter/floor change. Eight fresh host/Go 1.19 baseline-and-prefix checks pass, including race tests twice and vet. Statement coverage increases from 1276/1385 to 1320/1418 on both compilers, with no old covered hits lost and all new or rewritten statements covered. Existing tests and error contracts are retained.

Known costs remain disclosed: prior combined integration measurements retained a roughly 3.7–5.7% paired timing signal in one Call/4 KiB-print path, with cause unconfirmed and 4192 B/op / 5 allocs/op unchanged. Selected Go 1.19 Clear fixtures cost about 7–13% more time without additional allocations. Tested paired-entry Items/MakeDict/map-argument paths retain or reduce bytes and remove one allocation. These necessary safety costs are accepted under the safety-first, simple-implementation criterion; no new sampling, performance equivalence or universal zero-overhead claim is made.

Fresh full downstream verification passes: 168 configurations across the baseline and all three patch prefixes, with 126 exact profile comparisons and no lost coverage. Published dependency pins are retained; Box eval skips on its older Starlet pin are explicitly classified. A separate 20-configuration joint check with current Starlet b8e0c8f2 passes, including actual Box eval tests, plus four fresh CLI binaries/eight public examples. Source and embedded dependency metadata are bound to each cohort.

The CI-only successor 852175b keeps the complete tested git tree unchanged. After Actions was re-enabled, its exact-head Build, default CodeQL and all 14 required checks, including both Codecov contexts, succeeded. The latest delivered CLI source c2a00525 also passes eight paired main/examples configurations on production Go 1.27.4 and minimum Go 1.26.0: build, full race tests twice, vet and eight real hello/qrcard executions. Both compiler-specific CLI profiles remain 797/881 covered with no previously covered blocks lost. Default Starlet v0.2.3 and all other published pins stay fixed; only Starlight is replaced in the candidate consumer fixtures.

Historical local cohorts retain their original source labels; no benchmark is resampled. Earlier PRs #86–#88 are included by this topic and will be closed as superseded after it actually merges. Normal review/watch/fresh-head gates remain mandatory; no tags or releases are created.

@codacy-production

codacy-production Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 278 complexity · 24 duplication

Metric Results
Complexity 278
Duplication 24

View in Codacy

🟢 Coverage 100.00% diff coverage · +0.94% coverage variation

Metric Results
Coverage variation ✅ +0.94% coverage variation (-1.00%)
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (59694c4) 2216 2017 91.02%
Head commit (852175b) 2275 (+59) 2092 (+75) 91.96% (+0.94%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#94) 83 83 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@vt128 vt128 closed this Nov 11, 2026
@vt128 vt128 reopened this Nov 11, 2026
@vt128
vt128 marked this pull request as ready for review November 12, 2026 00:39
@vt128 vt128 closed this Nov 12, 2026
@vt128 vt128 reopened this Nov 12, 2026
@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.57%. Comparing base (59694c4) to head (852175b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #94      +/-   ##
==========================================
+ Coverage   92.72%   93.57%   +0.84%     
==========================================
  Files           8        8              
  Lines        1718     1758      +40     
==========================================
+ Hits         1593     1645      +52     
+ Misses        124      112      -12     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vt128
vt128 merged commit a7a2ede into master Nov 12, 2026
14 checks passed
@vt128
vt128 deleted the codex/safe-collections-slt21-23-20261110 branch November 12, 2026 01:16
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