8000 [jsc] Task union / EventLoop dependency loop blocks unit tests · Issue #58 · dominikake/bun · GitHub
[go: up one dir, main page]

Skip to content

[jsc] Task union / EventLoop dependency loop blocks unit tests #58

Open

Description

@dominikake

File

src/jsc/event_loop.zig:3,113,716 + src/jsc/Task.zig:4 (union member closure) — observed while fixing #54 on zig-legacy (2c445f0454).

Pattern

dependency-loop — demanding bun.jsc.EventLoop.Task (or bun.MiniEventLoop, or anything pulling the EventLoop struct together with the Task union) fails with:

src/jsc/event_loop.zig:716:5: error: dependency loop detected
pub const Task = @import("./Task.zig").Task;

Shape of the cycle: EventLoop.tasks: Queue (event_loop.zig:3) → Queue = LinearFifo(Task) (:113) → Task union (Task.zig:4, ~100 members) → a member chain leading back into jsc.EventLoop. The main binary never trips it (it only touches EventLoop through pointers/dynamic dispatch, never demanding the struct fields and the full union together).

Upstream relevance

  • not found — needs re-check against oven-sh/bun main (Rust-rewrite era).

Repro

On branch claude/fix-zig-build-test-54 (PR #57, after zig build test itself is fixed), add to the test {} block in src/unit_test.zig:

_ = @import("bun").jsc.EventLoop.Task;

then run vendor/zig/zig build test. Bisected: Braces + myers_diff demands are green; any Task/MiniEventLoop demand loops, via both the jsc.EventLoop.* path and a direct bun.zig re-export path.

Suggested next step

Type-layering work in src/jsc/: break the by-value edge between the EventLoop struct and the Task union member closure (e.g. box the back-edge field or reroute the member import so the union can complete with event_loop.zig off-stack). Until then, MiniEventLoop unit tests stay out of the zig build test harness (see src/unit_test.zig comment) and are covered by bun bd test JS-level suites.

Harvest metadata

  • commit: 2c445f0454
  • pattern: dependency-loop
  • generated-by: manual (found while fixing #54)

Activity

  1. added
    bun-zigFork backlog (Zig continuation)
    area/jscJavaScriptCore bindings
    kind/bugObserved or highly likely bug
    priority/p2Real gap with workaround
    on Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/jscJavaScriptCore bindingsbun-zigFork backlog (Zig continuation)kind/bugObserved or highly likely bugpriority/p2Real gap with workaround

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0