Skip to content

fix(cli): validate collects @widget routes passed through a helper (#116) - #127

Open
ROHIT-JR wants to merge 1 commit into
nitrocloudofficial:developfrom
ROHIT-JR:fix/116-validate-helper-widgets
Open

ROHIT-JR wants to merge 1 commit into
nitrocloudofficial:developfrom
ROHIT-JR:fix/116-validate-helper-widgets

Conversation

@ROHIT-JR

@ROHIT-JR ROHIT-JR commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Fixes #116.

Problem

nitrostack-py validate only found @widget routes written as string literals or WidgetOptions(route=...). The pizzaz template uses @widget(pizzaz_widget("pizza-map")), so its 3 widgets were never checked.

Change

_collect_widget_routes also collects:

  • @widget(helper("route")) (a call whose only argument is the route)
  • @widget(helper(route="route", ...))

A helper call with other positional arguments is skipped on purpose. Its first string is not necessarily the route, and a wrong guess would give false warnings. Routes found this way go through the same checks as before (valid segment, widgets/out/<route>.html exists and is not empty).

I used the source-pattern option from the issue. Collecting routes from the registered app at runtime would need the project to import and run, which validate avoids today.

Tests

  • tests/test_validate_widgets.py: helper-wrapped routes (positional, dotted, keyword) are collected, pass when the HTML exists, an unsafe route is reported, other positional arguments are not guessed.
  • Shipped templates: pizzaz reports its 3 routes, starter 1, flight-booking 6.
  • Removing pizza-list.html from a copy of the pizzaz template gives one file is missing warning.
  • tests/test_cli.py: runs the real validate command on a copy of the pizzaz template. Clean output first, then a warning for only the removed widget.

4 of the new tests and the CLI test fail without the fix. Full suite locally: 1330 passed. The failures are the code-mode template and wheel-build tests in tests/test_project_templates.py, which also fail on unmodified develop here because my venv lacks setuptools and the code-mode dependencies.

…itrocloudofficial#116)

@widget(helper("route")) and @widget(helper(route="route", ...)) are now
collected, so the pizzaz template's three widgets are checked. A helper call
with other positional arguments is skipped, since its first string is not
necessarily the route.
@manish-wekan

manish-wekan commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Check:

  1. Build this specific version of SDK, install it in isolated environment, run and create a project using it.
  2. Connect the project to nitrostudio
  3. Deploy to a temporary account on Nitrocloud,
  4. Connect that to claude/cursor/chatgpt and check widgets are rendering or not.
  5. Post Screenshots.

@ROHIT-JR

@manish-wekan

Copy link
Copy Markdown
Collaborator

Reviewed with develop (12e65b1) merged in: 1351 tests pass, the pizzaz template's 3 widgets are now found, and the new tests fail on the old code. Looks good to merge. Minor, can be a follow-up: any @widget(something("x")) with a single string argument is taken as a route, so an unrelated helper could produce a false "missing HTML" warning. Merge-order note: tests/test_cli.py grows to 1605 lines, above its 1589 baseline in #126.

~sent from claude-code

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