Skip to content

[feat] add read-only eval builtins (LET-36) - #187

Merged
vt128 merged 5 commits into
masterfrom
codex/goidiomatic-eval-let36
Nov 8, 2026
Merged

vt128 merged 5 commits into
masterfrom
codex/goidiomatic-eval-let36

Conversation

@vt128

@vt128 vt128 commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Add eval(source, vars={}) and Go-style (value, error_info) handling through try_eval(...) to the existing go_idiomatic helpers (LET-36).

Expressions receive explicit native-data snapshots: private inputs and returned data are copied, validated and frozen. Functions, host objects and cycles are rejected. Ordinary failures have bounded structured diagnostics; cancellation and cumulative caller step exhaustion remain errors. Evaluation uses the caller's Thread and does not capture locals or fork the complete runtime. Source/data quotas are admission limits, not hard process CPU/memory isolation.

Preserve the Go floor, interpreter pin, dependencies, module registry/capabilities and Machine execution methods. Preloads follow existing name precedence. Starbox Safe/Network already include this module, so the helpers become available there; inner expressions still exclude outer host callbacks and module capabilities. Companion test-only PR 1set/starbox#41 verifies the existing allowlists and execution boundaries.

The README now prioritizes signatures, parameters/defaults, loading, runnable examples, return/error handling and the complete six-field error_info schema. Its performance section explains the qualitative findings and usage tradeoffs; detailed local measurements and commands are retained in linked BENCHMARKS.md. Benchmarks compare direct compiled Starlark with the same expressions through public eval/try_eval. Fixed-source, small-I/O scaling supports amortization of preparation cost as shared computation grows; the absolute time difference is not a universal constant, and large-workload noise does not establish speedup or equivalence. Source/data sizes, hardware, OS, architecture, compiler/Go, GC and load affect results.

Validation:

  • Defensive tests cover native types, snapshots/aliases/cycles/depth, hostile/custom values, output capabilities, bounded diagnostics, cancellation/steps, owner callbacks, concurrency and independent call state. Fresh full baseline/candidate host Go1.27.3 and Docker Go1.19.13 build/race×2/vet pass at runtime commit b12f37e. New production statements cover329/330; the only missing statement is the unreachable trusted-literal compile panic. Old53host/50floor file hit blocks remain unchanged; total coverage increases.
  • Complete differential downstream cohort:84legs (80active/four archived diagnostic),42pairs;40exact consumer profiles/16012blocks;107packagepairs with105exact and two own gains,34unchanged functions with no lost blocks. Sixteen actual CLI cases pass. All108skip events/eight no-unit-test pairs are classified; no native Windows/WASM or live/private-service runtime claim is made.
  • Supplemental module-combination validation covers Box tiers/Reset, Base configuration/secret boundaries, YAML/TOML round trips, QRCode and CLI kit/loader/budget isolation on host and declared floors:24effective race-enabled top-level completions and four actual unchanged hello/qrcard demos. Seven source snapshots/module selections and binary/compiler/dependency metadata are verified. Two harness errors are retained and corrected with only failed tests rerun; no product regression was found.
  • New same-expression and scaling cohorts complete once under predeclared protocols, with independent numerical reviews and source/binary/declaration locks. Original failures, unfavorable observations and prior commit labels remain intact; no additional old-cohort sampling was used to seek green. Final qualitative-doc follow-up changes no Go/test/module bytes from53bce964, so original runtime/coverage/downstream evidence retains its correct source provenance. Normal pre-commit hooks pass.

Measured assembly/cache costs remain disclosed: configured-cache paths add64B/op on both compilers; floor Fresh adds about115B/one allocation; some loading/cache timings increase around1–5%. These are not described as zero overhead or full causal attribution. Other foundation performance candidates remain outside this change.

Final head f8a2c34 passes all23 required/24 reported checks and both Codecov contexts from app254. Review/bot inspection, checks-watch exit0 and unchanged head/base guards pass. Fourteen minor Markdown findings were individually reviewed against repository settings:13line-length findings conflict with MD013=false; one required-heading finding expects [None] without a configured template. No Go finding or service-rule change. Proceed through a final ready-state guard and normal squash merge; no auto-merge, tag, release or credential changes.

@codacy-production

codacy-production Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 14 minor

Results:
14 new issues

Category Results
BestPractice 1 minor
CodeStyle 13 minor

View in Codacy

🟢 Metrics 470 complexity · 15 duplication

Metric Results
Complexity 470
Duplication 15

View in Codacy

🟢 Coverage 99.77% diff coverage · +0.27% coverage variation

Metric Results
Coverage variation ✅ +0.27% coverage variation (-1.00%)
Diff coverage ✅ 99.77% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (bf94a75) 7915 7501 94.77%
Head commit (f8a2c34) 8359 (+444) 7944 (+443) 95.04% (+0.27%)

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 (#187) 444 443 99.77%

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.

@codecov

codecov Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.45799% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.89%. Comparing base (bf94a75) to head (f8a2c34).

Files with missing lines Patch % Lines
lib/goidiomatic/eval.go 99.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #187      +/-   ##
==========================================
+ Coverage   93.57%   93.89%   +0.32%     
==========================================
  Files          50       53       +3     
  Lines        6316     6685     +369     
==========================================
+ Hits         5910     6277     +367     
- Misses        258      259       +1     
- Partials      148      149       +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 marked this pull request as ready for review November 8, 2026 14:44
@vt128
vt128 merged commit 2556000 into master Nov 8, 2026
24 checks passed
@vt128
vt128 deleted the codex/goidiomatic-eval-let36 branch November 8, 2026 14:46
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