• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Kikobeats / isolated-function / 36459718807
97%

Build:
DEFAULT BRANCH: master
Ran 28 Sep 2026 05:40PM UTC
Jobs 1
Files 14
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

28 Sep 2026 05:39PM UTC coverage: 96.811% (+0.4%) from 96.384%
36459718807

push

github

web-flow
feat: let a snippet call back into the host (#83)

* feat: let a snippet call back into the host

A snippet could only ever be handed values decided before it started. Work
it might need had to be done up front, for every run, whether or not the
snippet reached it.

`host` exposes methods it can call as `globalThis.__isolated_host(name, args)`,
resolved when asked for and never before:

  isolatedFunction(async () => (await __isolated_host('content')).length, {
    host: { content: () => expensiveFetch(url) }
  })

`expensiveFetch` runs because the snippet awaited it. A snippet returning
`42` without asking never triggers it.

The channel is an `ipc` stdio slot, opened only when `host` is passed, so a
run without it spawns exactly as before and has no `process.send` at all.
Verified the slot survives the three things it had to: `node -` reading the
program from stdin, `--permission` with no `--allow-*` flags (the permission
model does not gate IPC), and the `sh -c 'ulimit -t N && exec node'` wrapper.
The channel is closed before the result is written, or the child would never
exit and would be killed at its timeout.

The channel cannot be hidden from snippet code. Deleting `process.send` is
not a boundary: `process.channel.fd` stays readable and `fs.writeSync(3, …)`
reaches the host even under `--permission`, which I confirmed before
designing around it. So the host treats every message as untrusted input. A
method missing from `host`, or inherited rather than own, is refused without
being reached; a malformed message is ignored; and `maxHostCalls` bounds
distinct calls per run so a snippet cannot amplify cost. Repeats of a
resolved call are free, keyed on method and arguments.

`hostMethods` joins the shell cache key. Without it a build cached for a run
with no channel would be reused for one that needs it.

14 tests, including the two that matter for the boundary: a snippet writing
straight to fd 3 cannot invoke an unexposed method, and forged or ma... (continued)

305 of 327 branches covered (93.27%)

Branch coverage included in aggregate %.

198 of 198 new or added lines in 6 files covered. (100.0%)

1243 of 1272 relevant lines covered (97.72%)

44.05 hits per line

Jobs
ID Job ID Ran Files Coverage
1 36459718807.1 28 Sep 2026 05:40PM UTC 14
96.81
GitHub Action Run
Source Files on build 36459718807
  • Tree
  • List 14
  • Changed 4
  • Source Changed 4
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #36459718807
  • 8b4ae1a1 on github
  • Prev Build on master (#36436048720)
  • Next Build on master (#36693586950)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc