Skip to content

fix(starlark): toggle the app id the list published, and store a relocatable star_file - #537

Merged
ChuckBuilds merged 1 commit into
mainfrom
fix/starlark-toggle-key-and-star-path
Sep 7, 2026
Merged

fix(starlark): toggle the app id the list published, and store a relocatable star_file#537
ChuckBuilds merged 1 commit into
mainfrom
fix/starlark-toggle-key-and-star-path

Conversation

@ChuckBuilds

Copy link
Copy Markdown
Owner

The two review nitpicks from #535 that the merge did not carry. The five findings raised alongside them landed with it; these are still on main.

The toggle could not find what the list had just shown

_starlark_virtual_plugins publishes the raw manifest key as starlark:<key>. _toggle_starlark_app passed it back through _validate_and_sanitize_app_id, which lowercases and replaces every character outside [a-z0-9_]:

stored in the manifestMy-App
listed to the UI asstarlark:My-App
looked up on toggle asmy_app
answer404, for an app the page had just drawn

Keys written by _install_star_file are already sanitised, so this only surfaces for manifests written by the starlark-apps plugin itself, or edited by hand.

_validate_starlark_app_path rejects traversal without rewriting, so it is the right check here — listing and toggling now agree on one key. The traversal test keeps its assertion, retargeted at the wording that check actually returns.

The updater also switches from indexing to setdefault. The app is loaded but its on-disk entry need not exist, and _update_manifest_safe does not catch KeyError — so that case escaped as a 500 instead of writing the entry.

star_file was stored as an absolute path

Its readers join it to the app's own directory, and default to a bare filename:

star_file=app_dir/app_data.get('star_file', f'{app_id}.star')

So the key had two meanings depending on who wrote it. Path.__truediv__ discards the left side when the right is absolute, which pinned the manifest to whatever PROJECT_ROOT installed it — a moved or redeployed install could not find its own file. Storing dest.name matches the default and stays relocatable.

Read paths are untouched, so manifests already holding an absolute path keep working.

Testing

7 new tests: the published id round-trips through the toggle, a loaded app missing from the manifest no longer 500s, and star_file is stored by name, is not absolute, and resolves against the app directory.

Whole suite on this machine: no new failures against main (104 pre-existing Windows-only in both), 4013 passed against 4007.

🤖 Generated with Claude Code

…catable star_file
The two review nitpicks left over from #535. Both are still on main after
that merge; the five findings alongside them landed with it.
**The toggle could not find what the list had just shown.**
`_starlark_virtual_plugins` publishes the raw manifest key as
`starlark:<key>`, and `_toggle_starlark_app` passed it back through
`_validate_and_sanitize_app_id`, which lowercases and rewrites every
character outside `[a-z0-9_]`. An app stored as `My-App` was listed as
`starlark:My-App` and looked up as `my_app`, so toggling an app the page
had drawn a moment earlier answered 404. Keys written by
`_install_star_file` are already sanitised, so this only shows up for
manifests written by the starlark-apps plugin itself or edited by hand.
`_validate_starlark_app_path` rejects traversal without rewriting, so it
is the check to use here -- listing and toggling now agree on one key.
The updater also uses `setdefault` rather than indexing: the app is
loaded but its on-disk entry need not exist, and `_update_manifest_safe`
does not catch `KeyError`, so that escaped as a 500 rather than writing
the entry.
**`star_file` was stored absolute.** Readers join it to the app's own
directory -- `_standalone_render_starlark_app` does `app_dir /
app_data.get('star_file', f'{app_id}.star')` -- so the key's default is a
bare filename and an absolute value gave it a second meaning. Since
`Path.__truediv__` discards the left side when the right is absolute,
the manifest was pinned to whatever PROJECT_ROOT installed it, and a
moved or redeployed install could not find its own file. Storing
`dest.name` matches the default and stays relocatable. Read paths are
unchanged, so manifests already holding an absolute path keep working.
7 new tests. Whole suite: no new failures against main, 4013 passed
against 4007.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 2f6bb273-c0c3-48a4-81a8-7a9eeb81b572

📥 Commits

Reviewing files that changed from the base of the PR and between 5025863 and b7e978b.

📒 Files selected for processing (2)
  • test/web_interface/test_starlark_pixlet_routes.py
  • web_interface/blueprints/api_v3.py

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

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@ChuckBuilds
ChuckBuilds merged commit 793b988 into mainSep 7, 2026
9 checks passed
@ChuckBuilds
ChuckBuilds deleted the fix/starlark-toggle-key-and-star-path branch September 7, 2026 20:36
Sign up for freeto 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

@ChuckBuilds