Skip to content

fix: resolve positional functions in includes with scope context - #578

Merged
sini merged 2 commits into
denful:mainfrom
sini:fix/575-dynamic-forward
May 31, 2026
Merged

sini merged 2 commits into
denful:mainfrom
sini:fix/575-dynamic-forward

Conversation

@sini

@sini sini commented May 30, 2026

Copy link
Copy Markdown
Collaborator

Closes #575

Summary

Positional functions (ctx: ...) in includes were silently dropped by the pipeline. The compile router sent them to compile-static (because __args == {}), which stripped __fn as a structural key — the function was never called.

Root cause

The compile shape router at compile.nix dispatched to compile-parametric only when __args != {}. Positional functions have __args = {} (no named args from lib.functionArgs), so they fell through to compile-static where __fn is a structural key and gets stripped. The function body was discarded.

Changes

  • compile.nix: Route aspects with __fn to compile-parametric regardless of __args emptiness.
  • aspect.nix: In prepareParametricFn, detect positional functions (empty args + bare lambda) and call them directly with ctxFromHandlers(scopeHandlers) instead of fx.bind.fn which would pass {}.
  • host-propagation.nix: Updated ctx-transformation.test-host expected output — positional ctx: functions in includes now correctly receive scope context and produce output instead of being silently dropped.
  • dynamic-forward.nix: Regression test reproducing BUG: Dynamic home/host forwarding no longer work #575 — nixpkgs overlay forwarding via positional context function.

Test plan

  • 834/834 CI tests pass (833 existing + 1 new, 1 updated expected)
  • Formatting clean

@sini
sini requested a review from vic as a code owner May 30, 2026 18:09
@github-actions github-actions Bot added the allow-ci allow all CI integration tests label May 30, 2026
@sini
sini force-pushed the fix/575-dynamic-forward branch 2 times, most recently from a37de42 to 9dc94f0 Compare May 30, 2026 20:45
…ful#575)

Positional functions (ctx: ...) in includes were silently dropped: the
compile router sent them to compile-static (because __args == {}),
which stripped __fn as a structural key. The function was never called.

Route aspects with __fn to compile-parametric regardless of __args.
In prepareParametricFn, detect positional functions and call them
directly with ctxFromHandlers(scopeHandlers) instead of fx.bind.fn
which would pass {}.
@sini
sini force-pushed the fix/575-dynamic-forward branch from 9dc94f0 to 4f517e7 Compare May 31, 2026 13:48
@theutz
theutz enabled auto-merge (squash) May 31, 2026 23:33
@theutz
theutz requested a review from drupol May 31, 2026 23:37
@sini
sini requested a review from theutz May 31, 2026 23:39
@sini
sini disabled auto-merge May 31, 2026 23:40
@theutz
theutz enabled auto-merge (squash) May 31, 2026 23:41
@sini
sini merged commit 294d584 into denful:main May 31, 2026
33 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

allow-ci allow all CI integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Dynamic home/host forwarding no longer work

2 participants