Skip to content

[doc] STAR-15 (BOX-13): withdraw Box pooling/Clone; document shared-cache hot path#21

Merged
vt128 merged 1 commit into
masterfrom
feat/star-15-reset-cache-doc
Jun 19, 2026
Merged

[doc] STAR-15 (BOX-13): withdraw Box pooling/Clone; document shared-cache hot path#21
vt128 merged 1 commit into
masterfrom
feat/star-15-reset-cache-doc

Conversation

@vt128

@vt128 vt128 commented Jun 19, 2026

Copy link
Copy Markdown
Member

STAR-15 / BOX-13

Reset rebuilds the underlying machine in place for serial reuse of one Box. A hand-rolled Box pool (or a Clone) would leak per-run state — injected globals and the Starlark step counter both live on the machine. There is no real consumer for a Box Clone, so it is withdrawn rather than implemented.

Changes (doc + test only — no behavior change)

  • Reset godoc: states it keeps the Box config for serial reuse, and that there is deliberately no Clone/pool, with the reason (per-run state leakage).
  • SetScriptCache godoc: documents the hot-path / concurrency recommendation — a single starlet.MemoryCache (concurrency-safe) shared across per-run New(...) boxes compiles each distinct script once while every Box keeps isolated per-run state.
  • TestSharedScriptCacheAcrossBoxes: a counting ByteCache proves two boxes running an identical script compile it exactly once across the shared cache — locking the documented guidance as executable.

Verified gofmt/go vet clean, go test -race -count=2 green, and the Docker golang:1.19 floor green.

…ache hot path

Reset rebuilds the machine in place for serial reuse of one Box. There is
deliberately no Clone and no Box pool: per-run state (injected globals, the
Starlark step counter) lives on the machine, so sharing or hand-pooling a Box
leaks that state between runs.

Document the recommended hot-path / concurrency pattern on Reset and
SetScriptCache: construct a fresh New(...) per run and share only the compiled
-program cache via SetScriptCache (a single starlet.MemoryCache is concurrency
-safe), keeping compilation shared while per-run state stays isolated.

Add TestSharedScriptCacheAcrossBoxes: a counting ByteCache proves two boxes
running an identical script compile it exactly once across the shared cache.
@codacy-production

codacy-production Bot commented Jun 19, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 12 complexity · 0 duplication

Metric Results
Complexity 12
Duplication 0

View in Codacy

🟢 Coverage ∅ diff coverage · +0.00% coverage variation

Metric Results
Coverage variation +0.00% coverage variation (-1.00%)
Diff coverage diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (8e7cf4e) 1073 1060 98.79%
Head commit (f615576) 1073 (+0) 1060 (+0) 98.79% (+0.00%)

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 (#21) 0 0 ∅ (not applicable)

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 Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.37%. Comparing base (8e7cf4e) to head (f615576).

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #21   +/-   ##
=======================================
  Coverage   98.37%   98.37%           
=======================================
  Files          11       11           
  Lines         799      799           
=======================================
  Hits          786      786           
  Misses          7        7           
  Partials        6        6           

☔ 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 46b6c85 into master Jun 19, 2026
11 checks passed
@vt128 vt128 deleted the feat/star-15-reset-cache-doc branch June 19, 2026 17: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