Skip to content

app-module: app file-extension handlers and app stack fallback - #789

Open
Shadowtrance wants to merge 13 commits into
TactilityProject:mainfrom
Shadowtrance:app-module
Open

Shadowtrance wants to merge 13 commits into
TactilityProject:mainfrom
Shadowtrance:app-module

Conversation

@Shadowtrance

@Shadowtrance Shadowtrance commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

app-module: app file-extension handlers and app stack fallback

Summary

  • Apps can register file extensions; app_start_file() starts the matching app with the file as argv[0], and the Files app uses it before its text fallback.
  • app_manager_get_app_id(instance) resolves an instance to its manifest id, so components don't depend on the topmost app.
  • App task stacks fall back to PSRAM when the internal heap can't provide them.
  • Id-based starts hold the package lifecycle lock across the manifest lookup, compatibility check and load, closing a replacement race.
  • The package-dependency prototype is removed.

The Lua runtime itself is in the apps repo: its module is back to Lua + kernel bindings (no LVGL references) and loads at boot; the window/luavgl runner is a native app shipped inside each Lua app package.

App file extensions

  • Manifest keys: app.N.extension=lua / app.N.extension.0=lua, .1=json, ... (up to 8, alphanumeric, stored lower-case).
  • app_manager_find_extension_handler(extension, AppId*) returns the handler (lowest app id; only compatible packages are considered).
  • app_manager_find_file_handler(path, AppId*) extracts the extension from a path.
  • app_start_file(path, ...) starts the handler and passes the file as argv[0].
  • The Files app asks for a handler before its text fallback, so a .lua file opens in the Lua runner when LuaRuntime is installed.

App identity

app_manager_get_app_id(instance_id, buffer, size) resolves an instance to its manifest id. Components that need their own app's identity use it instead of app_manager_get_topmost_app_id(), which can change while a dialog is up.

App task stacks

When the internal heap can't provide the app task stack, the scheduler now tries PSRAM before failing. Devices with external-RAM task stacks enabled (CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM) can start an app even when internal RAM is fragmented; devices without PSRAM behave as before.

ABI

AppManifest and AppStartContext are unchanged. Extension metadata lives in a firmware-side table populated at install/scan. Apps built against the existing SDK keep working.

Removed

  • The app.N.binary.package shared-binary prototype and the file-backed binary model.
  • The dependency / dependency.N prototype.
  • The lazy package-module loader prototype.

Simulator profiles

Adds M5Stack PaperS3 and Waveshare 3.97 EPD; removes Cardputer and T5 4.7 EPD.

Testing

  • App-module unit tests: 97 cases, 643 assertions (extension parsing/lookup, file handler start with argv, instance id lookup, invalid indices/paths).
  • Simulator: Files → .lua opens the runner; packaged Hello and Weather run with the runner in the package; the companion's on-device install produces a working package.
  • T-Deck (esp32s3): Hello, Weather (assets, settings, HTTP) and Files → .lua; the PSRAM stack fallback triggered under internal-heap pressure and both apps still started.
  • ESP builds and the firmware matrix are left to CI.

Follow-ups

  • Rebuild the SDK so apps can use app_manager_get_app_id from the public headers instead of local declarations.
  • Republish the Lua apps (LuaRuntime 0.1.46, Hello 0.1.8, Weather 0.3.6) with the runner-in-package model.

app-module: let an app binary come from another installed package
simulator profiles
@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

App manifests can declare file extensions, dependencies, and file-backed binaries. The app manager registers extension handlers and resolves app paths across installed and scanned packages. Package operations coordinate registry updates and listener notifications. The scheduler and file manager can launch a registered handler with the selected file path. The simulator profile table replaces one entry with M5Stack PaperS3 and Waveshare 3.97 EPD profiles.

Merge Risk: Moderate · previous review ecb8f

Opening files through a registered handler app has a lifetime bug in the scheduler, and the handler can be chosen wrongly or without a compatibility check. The Files app also hides Open for such files. These affect only the new file-handler feature and should be fixed before merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "app-module: app file-extension handlers and app stack fallback" names the main change. The changeset adds extension-based handler registration, a file-launch API (app_start_file), scheduler…
Full details: Title check

Explanation

The title "app-module: app file-extension handlers and app stack fallback" names the main change. The changeset adds extension-based handler registration, a file-launch API (app_start_file), scheduler support for file-path binaries, and a Files app hook that uses handlers before text fallback. The phrase "app stack fallback" is vague, since the fallback is to the Files app's existing handling and to manifest-based install-path lookup, but the core feature is clearly described. The title is also a single sentence, is specific, and avoids file lists.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • 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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Minor comments: 1

Modules/app-module/source/manager.cpp: 1

438-438: Minor · Functional Correctness · Poor tradeoff

Remove stale scanned lookups when an installed package is uninstalled.

After a boot scan registers package P with app A, a reinstall and an uninstall of P, with no rescan in between, leave P's scanned record in place. app_uninstall() takes the installed-package path and does not reach app_manager_install_path_uninstall(), so the scanned record is not erased. app_manager_find_scanned_app_path() still matches A's manifest and returns the scanned directory. app_paths_get_install_directory(A) uses that result as a fallback and can return ERROR_NONE for an app that is no longer installed. Before this change, the fallback did not exist, so the same lookup returned not found.

The returned path can name a directory that the uninstall removed, or a directory that no longer exists.

Keep scanned-record state in sync when an installed package replaces or is removed. Alternatively, reject scanned records that no longer match the current registration. Lookups for packages that a scan still registers must keep working.

Nitpick comments: 1

Modules/app-module/source/install.cpp: 1

254-254: Trivial · Performance & Scalability · Quick win

Store the new app_paths map in external-memory containers.

app_paths is a default-allocated std::unordered_map<std::string, std::string>. It is a member of InstallRegistry, which the function-local static install_registry() owns. Each installed app adds a retained app ID and directory string. Those allocations stay in internal RAM. The memory guideline forbids function-local statics that hold containers. It requires tt::std containers or tt::OptExternalAllocator<T> for long-lived containers.

Change app_paths to an external-memory container, such as tt::std::map<tt::std::string, tt::std::string> from <TactilityCpp/std/*.h>. Update the insert, lookup and erase sites to match the new type.

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 218da339-7965-40de-aa62-07e800667586
Commits

Reviewing files that changed from the base of the PR and between 89dbd91 and 14a86c4.

Files selected for processing: 9

  • Devices/simulator/Source/SimulatorProfile.cpp
  • Devices/simulator/Source/SimulatorProfile.h
  • Modules/app-module/include/app/package_manifest.h
  • Modules/app-module/private/app/private/install_paths.h
  • Modules/app-module/private/app/private/manifest_set.h
  • Modules/app-module/source/install.cpp
  • Modules/app-module/source/manager.cpp
  • Modules/app-module/source/package_manifest_parsing_v3.cpp
  • Modules/app-module/source/paths.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread Modules/app-module/source/install.cpp Resolved
- Store binary_package/binary on AppManifest and AppStartContext.
- Resolve the provider in app_scheduler_start() from the live registries, so
  installing or removing the provider takes effect without a reboot or a
  client reinstall. A missing provider fails with ERROR_NOT_FOUND instead of
  using a stale path.
- Look up provider packages by id in both the install registry and the
  boot-scan registry, using each record's actual path (supports providers on
  other mounts).
- Make the install registry mutex recursive so a package listener's read-only
  path lookup cannot deadlock; document the listener contract.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 42ba0cfd-495d-4e91-b1a0-e91a28aa60cb
Commits

Reviewing files that changed from the base of the PR and between 14a86c4 and 5f09552.

Files selected for processing: 10

  • Modules/app-module/include/app/manager.h
  • Modules/app-module/include/app/manifest.h
  • Modules/app-module/include/app/package_manifest.h
  • Modules/app-module/include/app/start.h
  • Modules/app-module/private/app/private/install_paths.h
  • Modules/app-module/private/app/private/manifest_set.h
  • Modules/app-module/source/install.cpp
  • Modules/app-module/source/manager.cpp
  • Modules/app-module/source/scheduler.cpp
  • Modules/app-module/source/start.cpp
Files with no reviewable changes: 1

  • Modules/app-module/include/app/package_manifest.h

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread Modules/app-module/source/install.cpp Resolved
Comment thread Modules/app-module/source/install.cpp Resolved
Comment thread Modules/app-module/source/scheduler.cpp Resolved
- Split add/remove package into no-notify variants. Install, uninstall and the
  boot scan publish their registry state, release the lock, then notify package
  listeners, so a listener lookup cannot deadlock against the registry mutex.
- Publish app_paths and scan records before notifying listeners.
- Forget a provider's boot-scan record when app_install takes over its directory,
  so a later uninstall cannot fall back to a stale scan path.
- Check the provider package's compatibility before launching its shared binary
  and return ERROR_NOT_SUPPORTED when it excludes this device.
- Simulator tests: provider missing -> install -> launch; scan -> reinstall ->
  uninstall -> launch fails; reinstall -> launch succeeds.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3f95652d-33cb-42f2-9bb6-f634720d60fc
Commits

Reviewing files that changed from the base of the PR and between 5f09552 and e3eb1a0.

Files selected for processing: 6

  • Modules/app-module/include/app/manager.h
  • Modules/app-module/private/app/private/install_paths.h
  • Modules/app-module/private/app/private/manager_internal.h
  • Modules/app-module/source/install.cpp
  • Modules/app-module/source/manager.cpp
  • Modules/app-module/source/scheduler.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Comment thread Modules/app-module/source/install.cpp Resolved
Comment thread Modules/app-module/source/manager.cpp Resolved
- Add a package lifecycle mutex shared by install, uninstall and the scan. It
  serializes takeover against a scanned uninstall, so the uninstall's manifest
  pointer cannot be freed underneath it.
- app_manager_forget_scanned_package() now takes the app ids the installed
  package provides and unregisters every other app id from the scanned record
  before freeing it. A package that drops an app no longer leaves a dangling
  ledger entry.
- Removed the nested namespace that hid the lifecycle functions from the
  installer.
- Apps register file extensions (app.N.extension / .N) and app-module can find
  the handler for an extension or a file path.
- app_start_file() starts the matching handler and passes the file as argv[0];
  the Files app uses it before the text fallback (.lua opens the Lua runner).
- An app binary may be a relative file path (app.0.binary=lua/main.lua). The
  scheduler resolves the extension handler, loads its built-in binary and passes
  the client's file, while the app instance keeps the client id (its install
  directory, assets, settings and launcher identity).
- Parse package dependencies (dependency and dependency.N).
- Remove the binary.package shared-runner prototype.
- Keep AppManifest/AppStartContext ABI-stable; binary/extension metadata lives in
  a firmware-side extras table populated at install/scan.
- App-module tests: 98 cases, 635 assertions.
@Shadowtrance Shadowtrance changed the title app-module & simulator app-module: app extension handlers and file-based apps Nov 29, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Show Open for files that have a registered handler. · View.cpp:592-595

Tactility/Source/app/files/View.cpp:592-595
Minor · Functional Correctness · Quick win

Show Open for files that have a registered handler.

viewFile now starts a registered file handler before the legacy branches. canOpen does not check handler registration. It accepts only directories, character devices, .app, .png, the listed text extensions, and executables. A file such as hello.foo with a handler for .foo fails all of these checks. As a result, showEntryMenu and showSelectionMenu omit Open for that file, although selecting the file still starts its handler.

Add the handler lookup to canOpen. Build the full path from state->getCurrentPath() and the entry name, as viewFile does, and return true when app_manager_find_file_handler succeeds. Keep the directory and character-device checks first.

Nitpick comments: 1

Modules/app-module/private/app/private/ledger.h: 1

105-106: Trivial · Maintainability & Code Quality · Quick win

Allocate persistent extras with external-RAM containers.

AppExtras and AppLedger::extras retain metadata for every registered app. The new std::string, std::vector and std::unordered_map use default allocators. This adds persistent internal-RAM demand on memory-constrained devices.

Use tt::std replacements where available. Use tt::OptExternalAllocator for the unordered-map nodes, and use external-RAM strings for its keys and values.

As per coding guidelines, “Containers that live long use the tt::std replacements” and “For other types use tt::OptExternalAllocator<T>.”

Also applies to: 111-111

Source: Coding guidelines

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 01453492-c26b-4596-8df8-72e94b57c8ab
Commits

Reviewing files that changed from the base of the PR and between 4a50f8c and ecb8f34.

Files selected for processing: 21

  • Modules/app-module/include/app/manager.h
  • Modules/app-module/include/app/manifest.h
  • Modules/app-module/include/app/package_manifest.h
  • Modules/app-module/include/app/start.h
  • Modules/app-module/private/app/private/binary_path.h
  • Modules/app-module/private/app/private/install_paths.h
  • Modules/app-module/private/app/private/ledger.h
  • Modules/app-module/private/app/private/manager_internal.h
  • Modules/app-module/private/app/private/manifest_set.h
  • Modules/app-module/private/app/private/package_manifest_parsing.h
  • Modules/app-module/source/install.cpp
  • Modules/app-module/source/manager.cpp
  • Modules/app-module/source/manifest.cpp
  • Modules/app-module/source/package_manifest_parsing.cpp
  • Modules/app-module/source/package_manifest_parsing_v3.cpp
  • Modules/app-module/source/scheduler.cpp
  • Modules/app-module/source/start.cpp
  • Modules/app-module/tests/source/manager_test.cpp
  • Modules/app-module/tests/source/package_manifest_test.cpp
  • Tactility/Private/Tactility/app/files/View.h
  • Tactility/Source/app/files/View.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread Modules/app-module/source/manager.cpp Resolved
Comment thread Modules/app-module/source/scheduler.cpp Resolved
- app_binary_file_extension() now accepts the character buffer directly, so the
  scheduler's client_binary array isn't turned into a temporary std::string whose
  storage dangles.
- Extension handler selection skips apps with a file-backed binary and apps whose
  package is incompatible with this device.
- Reject non-canonical indexed keys (extension.00, dependency.00) that ingestion
  doesn't read.
- Tests: 98 cases, 637 assertions.
- Register an app's binary/extensions only after its package record exists, in
  both the install and scan paths, so an extension handler can never be selected
  while its package compatibility is still unknown.
- Remove the package dependency prototype (dependency / dependency.N parsing and
  PackageManifest fields); apps find a provider through its extension handler.
- Tests: 96 cases, 627 assertions.
@Shadowtrance Shadowtrance changed the title app-module: app extension handlers and file-based apps app-module: app extension handlers and extension-based apps Nov 29, 2026
- Removing a package now erases its apps' binary/extension extras in the same
  ledger operation, so a handler dropped by an install-over-scan can't stay
  selectable without the package compatibility check.
- Test the removal path: the .lua handler stops resolving once its package goes.
- Tests: 96 cases, 631 assertions.
- app_scheduler_start() now takes the package lifecycle guard before resolving a
  handler and keeps it through loader load, so an install can't replace the
  selected binary with an incompatible one mid-start.
- Test: a second thread cannot take the lifecycle lock while the fake loader is
  loading, and gets it once the start returns.
- Tests: 97 cases, 637 assertions.
# Conflicts:
#	Modules/app-module/source/package_manifest_parsing_v3.cpp
- Apps register file extensions and app_start_file() starts the handler with the file
  as argv[0]; Files uses it before the text fallback.
- app_manager_get_app_id() resolves an instance to its manifest id, so components
  don't depend on the topmost app.
- module.N.lazy=true defers a package module; app_module_load_package() loads it on
  demand, after LVGL is up. The first app start also loads its package's lazy modules.
- App task stacks fall back to PSRAM when internal RAM is exhausted.
- Drop the package dependency prototype.
- Tests: 98 cases, 649 assertions.
@Shadowtrance Shadowtrance changed the title app-module: app extension handlers and extension-based apps app-module: app file-extension handlers and lazy package modules Nov 30, 2026
- Take AppPackageLifecycleGuard before resolving an id in app_start(),
  app_start_for_result(), the stream variants and app_start_file(), so an install
  can't free the manifest/location string the context points at.
- Hold the guard through app_manager_start_internal()'s compatibility check and the
  scheduler's load, closing the check-to-load replacement window.
- Tests: 98 cases, 649 assertions.
std::vector<std::string> binaries;
bool loaded = false;
};

@KenVanHoeylandt KenVanHoeylandt Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be needed. I'll explain after quoting the PR description:

The Lua runtime module uses LVGL and the window manager, which are not up during the boot scan.

The Lua runtime shouldn't need LVGL / window manager when it starts at boot, or it shouldn't start at boot. It probably shouldn't do anything if it's loaded at boot, because no Lua script is running at that time.

All native apps (and services) are built in such a way that LVGL and the window-manager modules can stop at any time without a crash, so Lua apps (and its runtime) should follow the same design principles.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lazy loading (as it is presented) has plenty of issues by itself. It's not relevant yet, but I wanted to showcase just how complex it is with Claude's analysis:

Confirmed bugs

1. Eager plus lazy in one package: lazy modules silently skipped
- app_module_loader_load_package() refuses a second load for a package id it already has: registry.packages.contains(package_id) returns ERROR_INVALID_STATE.
- Install and scan already loaded the eager modules under that package id.
- On first app start, app_module_load_package() gets INVALID_STATE, treats it as "another task won the race", and sets loaded = true. No lazy module ever loads, and the app then fails to resolve its symbols.
- Tests miss it because none has a package with both kinds.
- Fix: track loads per binary, or append to the existing package entry.

2. Partial failure gets marked as loaded
- If lazy module 2 of 3 fails and module 1 won't stop, the loader still registers the package with the stuck module.
- The next app start gets INVALID_STATE, takes it as success, and sets loaded = true. The package is half loaded for good.
- Same root cause as #1: INVALID_STATE is not proof that this module set is loaded.

3. Startup order depends on whichever app starts first
- The lazy module starts on the first start of any app in the package, including headless ones.
- A headless app started by a service or by autostart before LVGL and the window manager are up gets the same failure that lazy was added to avoid. Then the start fails, and every later start retries it.
- The PR assumes "first app start comes after the UI is up". Nothing enforces that.

Concurrency and locking

4. One global lifecycle lock now serializes every app start
- app_start*, start_internal, scheduler_start, install, uninstall and scan all take AppPackageLifecycleGuard.
- The lazy load (an ELF of about 415 KB from the SD card, plus module_start) runs inside that lock, on the caller's task.
- While it loads, every other app start blocks: dialogs, built-in in-memory apps, app_start_for_result from other apps. A slow SD card stalls the whole app system for seconds.
- If a caller ever starts an app while holding the LVGL lock, the UI freezes too, against the "no file I/O on LVGL thread" rule. Launcher and Files run starts off the LVGL thread today, but nothing enforces that.

5. module_start() runs while holding the lifecycle lock
- If the lazy module's start creates a task that calls app_start, and then waits for it, that is a deadlock.
- If it takes the LVGL lock while another task holds LVGL and is waiting in app_start, that is an AB-BA deadlock.
- The recursive mutex only helps the same task.

6. Uninstall joins app threads while holding the lifecycle lock
- uninstall_locked → stop_all_instances_of → app_scheduler_stop waits (with a timeout) for app threads to finish.
- If that app's thread is inside app_start (opening a dialog or child app), it blocks on the lifecycle lock. The join times out and the app is left in an undefined state while its files are deleted.
- Install-replace has the same pattern.

7. Location string can still dangle on paths outside the guard
- Launcher.cpp:112 and the autostart path (Launcher.cpp:237-267) call app_start_context_from_id() and app_start_with_context() as two separate steps, without holding the lifecycle guard across them.
- An install or replace between the two frees the manifest set, so context.location.path points to freed memory.
- The guard in start_internal comes too late. Only the app_start* wrappers are covered.

Cross-package and lifetime

8. Nothing tracks which apps use a provider package
- The Lua bootstrap in package A calls app_module_load_package("LuaRuntime") and then resolves its symbols.
- If LuaRuntime is uninstalled or replaced while A runs, the loader unloads the module unless its module_stop refuses. No refcount ties A's running instances to B's module, so A ends up running code that has been unloaded.
- The lock is also released between the load and the symbol lookup, so an uninstall can land in that gap.

9. Lazy modules are never unloaded until uninstall
- After first use, 415 KB stays resident until reboot or uninstall. Devices without PSRAM would want it freed.
- There is also no per-module "still used" state.

10. Symbols missing at boot
- Services and eager modules that resolve symbols at boot don't find the lazy module's symbols, and nothing reports why.
- Lazy loading only works for consumers that know to call app_module_load_package(), and there's no dependency metadata, so each consumer has to hard-code the provider's package id.

Smaller

- extras and handler selection run on scan and install, but a rescan of an already-known package doesn't refresh lazy_modules or extras.
- app_manager_find_extension_handler picks the lowest app id. Installing a new package can silently take over .lua from the current handler.
- app_manager_get_app_id(...) {    if has broken formatting (two statements on one line).

A more common approach to this problem would be to have modules declare a dependency on other modules.
However, that is not the desired approach here either, because Lua module shouldn't have a hard required presence of LVGL or window-manager.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, and that's what I've changed: the Lua runtime module is back to Lua + kernel bindings with no LVGL/window-manager references, so it loads at boot like any other package module. The window + luavgl runner is a native app shipped inside each Lua app package (the model you described originally). The lazy loader is gone entirely: no module.N.lazy, no app_module_load_package, no per-start module load, no provider bookkeeping.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This analysis is moot now — I removed the lazy loader and app_module_load_package. With the module LVGL-free and the runner in the package there is no eager/lazy mixing, no partial-load state, no start-time module load under a lock, no provider refcount, and no hard-coded provider package. The only start-side lock left is the id-lookup/compatibility/load guard that closes the install-replacement race (unrelated to modules). Packages grow by the runner (~120 KB/platform), which we've accepted.

The Lua runtime module is back to Lua + kernel bindings with no LVGL references,
so it loads at boot and the window/luavgl runner lives in the app package. Drop the
lazy flag, app_module_load_package(), the pending-module bookkeeping and the
start-time module load. Tests: 97 cases, 643 assertions.
@Shadowtrance Shadowtrance changed the title app-module: app file-extension handlers and lazy package modules app-module: app file-extension handlers and app stack fallback Dec 1, 2026

This branch has not been deployed

No deployments
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.

2 participants