Skip to content

exec: handle page programs - #4295

Merged
BaseMax merged 2 commits into
mainfrom
fix-exec-native-ui
Nov 27, 2026
Merged

BaseMax merged 2 commits into
mainfrom
fix-exec-native-ui

Conversation

@BaseMax

@BaseMax BaseMax commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

salam exec failed with "no entry point" on every page program.

  • Web (default): builds and serves the page like salam serve; the interpreter does not run it.
  • --ui=native: lowers the page like run and interprets it, with SALAM_WINDOW_BACKEND=headless only.
  • Real windows, other platforms, SSR, and web with a time limit: a clear en/fa error with the command to use.

Real native windows need C callbacks into Salam code, which the interpreter cannot provide.

Behaviour change: exec on a web page now keeps running, including the VS Code Run default. The playground runner sets a time limit, so it gets the error.

Known gaps under headless exec: ui/touch_scroll layout differs from the compiled build, and ui/reactive_todo is too slow.

Summary by CodeRabbit

  • New Features
    • salam exec can serve eligible page-based programs without a main entry point in a browser.
    • Interpreter runs now use project platform settings when available, with defaults for projects that don’t specify a platform.
  • Bug Fixes
    • Runs that can’t be handled by the interpreter now report limitations and suggest alternatives, including for unsupported platforms, server-rendered pages, and timed web runs.
    • Native UI execution requires headless mode.
  • Documentation
    • Updated exec help text with page-serving behavior and option limitations.

Web pages are built and served as 'salam serve' does; the interpreter does not run them. --ui=native runs in the interpreter with the headless window backend only. Cases it cannot handle get an en/fa error.
@BaseMax
BaseMax requested a review from a team as a code owner November 27, 2026 10:53
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

Interpreter execution now detects page-only programs and applies platform-specific rules. Eligible web pages are served, while unsupported page runs are refused. Project platform setup, diagnostics, help text, and tests are also updated.

Changes: Interpreter Page Execution

Layer / File(s) Summary
Project and page setup
compiler/sal_layout/layout_native.salam, compiler/cli/cli_platform.salam, compiler/driver/driver_api.salam
HasWindowPage detects qualifying layout pages. Interpreter run routing configures project platform settings. Directory inputs use the project entry file when it contains a layout block; otherwise, they use the directory entry resolver.
Page execution and serving
compiler/driver/driver_exec_page.salam, compiler/driver/driver_api.salam, compiler/i18n.salam, runner/container/server/exec.go, compiler/cli/cli_api.salam
Page-only runs check platform and timeout constraints. Eligible web pages switch to serve. Native UI execution requires headless mode and prepares the native page. The change also adds diagnostics, help text, and a container timeout environment value.
Page execution tests
tools/bash/test-exec-page.sh, tools/bash/run-tests.sh
The new shell test checks refusal cases, headless interaction, web serving, and project configurations. Test registration is limited to Linux or Darwin hosts with curl available.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Exec
  participant exec_page_refused
  participant exec_serve_page
  participant Serve
  Exec->>exec_page_refused: Check page execution constraints
  alt Web page is eligible
    Exec->>exec_serve_page: Switch command to serve
    exec_serve_page->>Serve: Serve the input page
  end
Loading

Suggested reviewers: bdadmehr0, erfangnu

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@BaseMax
BaseMax merged commit e2be1de into main Nov 27, 2026
15 of 16 checks passed
@BaseMax
BaseMax deleted the fix-exec-native-ui branch November 27, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant