Skip to content

Tests: fiber stack pool coverage (§14) #501

Closed

Description

@ehartford

Summary

Fiber-stack pooling works on current Darwin runtime probes, but the gate suite
does not pin reuse or the configured retention cap. Add deterministic,
platform-guarded internals coverage for §14.19.

Current state (revalidated 2026-07-15)

Darwin and Windows runtime cores expose:

  • with_fiber_pool_allocs()
  • with_fiber_pool_reuses()
  • with_fiber_pool_free_count()
  • with_fiber_pool_size_limit()

A current probe running two short tasks sequentially observed allocation counts
of 0 → 1 → 1 and reuse counts of 0 → 0 → 1: the second task reused the first
task's completed stack.

The requested regression still does not exist under test/. The hooks exist
only in the Darwin and Windows cores, so a portable behavior fixture that
declares them unconditionally would break unsupported hosts. This belongs in a
platform-guarded internals test.

#403 has landed: fiber_pool_size and the free-count/limit hooks now make
the retention-cap case actionable. The old “after #403” deferral is obsolete.
There is also a dangling codegen-corpus entry for
bootstrap/test/cases/fiber_pool_reuse.w even though that file and bootstrap
tree no longer exist.

Work

  1. Add a Darwin/Windows-guarded internals case that awaits two sequential
    tasks and asserts either a reuse increment or a flat allocation count on the
    second task.
  2. Add a project/runtime configuration case with a small fiber_pool_size and
    prove completed stacks beyond the cap are released rather than retained.
  3. Use runtime counters only; do not depend on timing, addresses, or scheduler
    ordering.
  4. Replace the dangling codegen-corpus entry with the real test artifact.

Acceptance criteria

  • The test fails if completed stacks never return to the pool.
  • The test fails if a later fiber never reuses an available pooled stack.
  • The configured cap is tested through free-count and size-limit hooks.
  • Unsupported platforms skip through an explicit harness guard, not a missing
    symbol at link time.
  • Full build, fixpoint, and test gates pass.

Traceability

  • Specification §14.19, Fiber Stack Management
  • docs/requirements.md 14.19.1.39 and 14.19.1.41

Activity

  1. ehartford commented on Jul 3, 2026

    @ehartford
    ContributorAuthor

    Coverage sweep: fiber stack-pool REUSE is verified working on HEAD (allocs stay flat, reuses increment across successive awaits, via with_fiber_pool_allocs/reuses in rt/fiber_core_darwin.w). But those introspection hooks exist ONLY on darwin+windows (no linux fiber_core), so a fixture calling them as externs would break a non-Darwin gate. Pinning this needs a platform-guarded internals test, not a portable behavior fixture — flagged as a harness deliverable. §14.

  2. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): still open. Nothing under test/ exercises the fiber pool counters; the only mention is the dangling corpus entry the issue names:

    $ grep -rn fiber_pool test/
    test/codegen_corpus.txt:268:check|bootstrap/test/cases/fiber_pool_reuse.w
    

    post-release: runtime test coverage, no user-visible defect.

  3. added this to the post-v0.16.0 milestone on Oct 28, 2026
  4. ehartford commented on Nov 18, 2026

    @ehartford
    ContributorAuthor

    Landed in #3420. behav_501_fiber_stack_pool_reuse.w pins reuse by the pool's counters (first task: one stack allocated and left pooled; second: none allocated, one reused). The retention cap is pinned by the existing selfhost case bs_check_runtime_manifest_config (fiber_pool_size = 1). The hooks exist on every native core (the non-Windows targets share one), so no platform guard was needed. test/codegen_corpus.txt, the home of the dangling entry, named only files that no longer exist and nothing read it; it is deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions