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

DanielXMoore / Hera / 24864011686
100%
main: 100%

Build:
Build:
LAST BUILD BRANCH: type-infer
DEFAULT BRANCH: main
Ran 23 Apr 2026 11:31PM UTC
Jobs 1
Files 9
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

23 Apr 2026 11:28PM UTC coverage: 100.0%. Remained the same
24864011686

Pull #69

github

STRd6
Rename emitted rule-fn params to \$\$ctx/\$\$state to avoid user shadowing

The hybrid compiler puts the handler IIFE inside the rule function:

  function Rule(ctx, state) {                        // <- params
    ...
    const $$m = (function($skip, $loc, $0, $1) {
      state.indentLevels = [...]                     // <- free var!
    })(...)
  }

If a handler body references a free module-level variable named `state`
or `ctx` — which is the normal pattern for parsers that keep
stateful scope at module level, e.g. Civet's parser.hera uses
`state.indentLevels`, `state.operators`, `config` as module-level
scope shared across rule handlers — the IIFE closes over the rule
function's parameter instead of the intended module-level binding, and
the handler silently writes to the wrong object.

Prev hera avoided this because it emitted handlers as separate top-
level function declarations, so the `(ctx, state)` on rule functions
never shadowed anything downstream.

Fix: rename the rule function's formal parameters (and every
internally-emitted reference to them) to `$$ctx` / `$$state`, matching
the `$$`-prefixed names we already use for compiler-internal locals
(`$$r`, `$$loc`, `$$value`, `$$final`, etc).  User-supplied handler
bodies cannot realistically collide with those names.

Regression test asserts the emitted rule function's signature — we
don't own how user handlers close over variables, but we *do* own
whether the emitted shape even permits the closure to resolve right.

Discovered by running Civet's test suite against the hybrid build;
this fix moves the suite from 410 passing to 532 passing.  The
remaining Civet-side failures are from pre-existing main commits
(af39015 / ce66713 — changed `!`/`&` assertions to return `true`
instead of `undefined`) that Civet's parser.hera hasn't adopted, and
are out of scope for this branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull Request #69: Hybrid compiler: inline handlers, hoist parser closures, fix #68

329 of 329 branches covered (100.0%)

Branch coverage included in aggregate %.

352 of 352 new or added lines in 3 files covered. (100.0%)

1429 of 1429 relevant lines covered (100.0%)

98.38 hits per line

Jobs
ID Job ID Ran Files Coverage
1 24864011686.1 23 Apr 2026 11:31PM UTC 9
100.0
GitHub Action Run
Source Files on build 24864011686
  • Tree
  • List 9
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Pull Request #69
  • PR Base - main (#24167897275)
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