Skip to content

Implement Responsive Client-Side Autoscaling - #90

Open
Lightning11wins wants to merge 638 commits into
masterfrom
apos_autoscale9-slim5
Open

Implement Responsive Client-Side Autoscaling#90
Lightning11wins wants to merge 638 commits into
masterfrom
apos_autoscale9-slim5

Conversation

@Lightning11wins

@Lightning11wins Lightning11wins commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

This PR adds responsive client-side autoscaling to HTML UIs generated by Centrallix.

After extracting changes into #87, #88, #89, and removing a few minor/unnecessary changes; this PR is hopefully slightly more manageable.

Known Issues

  • Code that might break responsive layout.
    • widget/pane: resize action (test apps/kardia/modules/payroll/pay_form.app)
    • widget/image: offset & scale actions (not used anywhere)
    • widget/objcanvas: add_osrc_object()

GitHub Relationships

Dependent PRs must be reviewed and merged into master before this PR is reviewed to fix their changes appearing in the PR diff.

widget.xml Fixes

This branch

  • Documented: 58/58 widgets (100%)
  • Missing widget docs: 0
  • Stale widget docs: 1
  • Ignored widgets: 10
  • Widget docs with errors: 3 (5%)
  • Widget doc errors: 4 (~0.07/widget)
  • Ignored errors: 25

master

  • Documented: 48/61 widgets (79%)
  • Missing widget docs: 13
  • Stale widget docs: 1
  • Ignored widgets: 10
  • Widget docs with errors: 26 (54%)
  • Widget doc errors: 172 (~3.58/widget)
  • Ignored errors: 0

Greptile Summary

@greptile-apps

greptile-apps Bot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces responsive client-side autoscaling across server-side widget layout, generated HTML, and shared browser drivers, together with extensive widget documentation, sample applications, utility-library changes, and merged dependency work.

  • Adds flexible geometry, inset, container, and responsive-layout behavior across the widget tree and browser runtime.
  • Consolidates legacy text and image buttons into the button driver and expands autoscaling demonstrations and tests.
  • Updates shared formatting, session, task, string, timer, query, and documentation infrastructure.
  • One blocking regression remains in the rewritten session error formatter: unsupported printf conversions can corrupt subsequent variadic argument interpretation.

Confidence Score: 4/5

The PR is not yet safe to merge because the session error formatter can misread variadic arguments and crash while handling an error.

The new mssError implementation skips unsupported conversion tokens without consuming their arguments; existing formats that place %i before %s consequently pass an integer to the string handler, causing invalid memory access during failure reporting. All previous Greptile threads were manually resolved and do not remain outstanding.

Files Needing Attention: centrallix-lib/src/mtsession.c

Important Files Changed

Filename Overview
centrallix/wgtr/apos.c Refactors application positioning around responsive dimensions, flexibility, insets, and container geometry.
centrallix/htmlgen/ht_render.c Updates generated-page assembly and shared rendering behavior for the revised widget and utility contracts.
centrallix-os/sys/js/htdrv_page.js Revises page-wide client geometry, lifecycle, focus, loading, and responsive behavior.
centrallix-os/sys/js/htdrv_button.js Consolidates browser behavior for text, image, and combined button variants.
centrallix-lib/src/qprintf.c Reworks constrained formatting semantics and adds boolean and unsigned-long-long conversions with regression tests.
centrallix-lib/src/mtsession.c Rewrites session error formatting but mishandles unsupported printf conversions, potentially crashing error paths.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    App[Application widget tree] --> Layout[Server autoscaling and layout]
    Layout --> Render[HTML and client parameter generation]
    Render --> Assets[Shared browser widget drivers]
    Assets --> Client[Responsive interactive UI]
    Client --> Resize[Viewport and container resize]
    Resize --> Assets
Loading

Reviews (15): Last reviewed commit: "Merge branch 'master' into apos_autoscal..." | Re-trigger Greptile

Comment thread centrallix/htmlgen/htdrv_page.c Outdated
Comment thread centrallix/htmlgen/ht_render.c Outdated
Comment thread centrallix/wgtr/wgtr.c Outdated
@greptile-apps

greptile-apps Bot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor
Additional Comments (1)

centrallix/htmlgen/ht_render.c
Missing thExcessiveRecursion() guard and NULL parent check in recursive helpers

ht_get_parent_w__INTERNAL and ht_get_parent_h__INTERNAL both recurse upward through the widget tree without:

  1. A thExcessiveRecursion() check — required for all deeply recursive functions to prevent stack exhaustion.
  2. A NULL guard on parent — if every ancestor has a negative width/height, the recursion will walk past the root node (Root->Parent == NULL) and dereference a null pointer.
int
ht_get_parent_w__INTERNAL(pWgtrNode widget)
    {
    if (thExcessiveRecursion())
        {
        mssError(1, "HTRND", "Resource exhaustion in ht_get_parent_w__INTERNAL");
        return 0;
        }
    const int cached_value = widget->fl_parent_w;
    if (cached_value != -1) return cached_value;
    const pWgtrNode parent = widget->Parent;
    if (!parent) return widget->fl_parent_w = 0;
    const int parentWidth = parent->width;
    return widget->fl_parent_w = (parentWidth >= 0)
        ? parentWidth - (parent->left + parent->right)
        : ht_get_parent_w__INTERNAL(parent);
    }

Apply the same fix to ht_get_parent_h__INTERNAL.

Context Used: Rule from dashboard - What: Use thExcessiveRecursion() checks in any deeply recursive functions.

Why: This prevents sta... (source)

@Lightning11wins

Copy link
Copy Markdown
Contributor Author

@greptileai Can you rereview this and let me know if you have any other comments? Did I resolve your issues?

Comment thread centrallix-os/sys/js/htdrv_page.js Outdated
@Lightning11wins

Copy link
Copy Markdown
Contributor Author

@greptileai Can you rereview this and let me know if you have any other comments? Did I resolve your issues?

Comment thread centrallix/htmlgen/htdrv_tab.c Outdated
Comment thread centrallix-os/sys/js/ht_geom_dom1html.js Outdated
Comment thread centrallix/htmlgen/htdrv_scrollpane.c Outdated
@Lightning11wins

Copy link
Copy Markdown
Contributor Author

@greptileai Can you rereview this and let me know if you have any other comments? Did I resolve your issues?

@Lightning11wins

Lightning11wins commented Mar 12, 2026

Copy link
Copy Markdown
Contributor Author

PR cleared for human review.

@Lightning11wins

Copy link
Copy Markdown
Contributor Author

Note: I'd recommend merging #97 before this PR so that I can handle the inevitable merge conflict.

Also, I'm planning to do my own rereview of this code soon.

@Lightning11wins Lightning11wins added the documentation Changes, improvements, or fixes to documentation files. label Apr 13, 2026
@Lightning11wins

Copy link
Copy Markdown
Contributor Author

I'm looking over this project again and it looks like there's a lot that I could improve by adding additonal error handling.

@Lightning11wins Lightning11wins added size: large Definitely very hard to review, probably well over 5000 lines. blocked No more work can be done until other work is completed. and removed enhancement labels Apr 27, 2026
@Lightning11wins

Copy link
Copy Markdown
Contributor Author

@greptileai Please rereview this PR.

Comment thread centrallix/htmlgen/ht_render.c Outdated
@Lightning11wins

Copy link
Copy Markdown
Contributor Author

@greptileai Please rereview this PR.

Comment thread centrallix-os/sys/js/ht_render.js Outdated
@Lightning11wins

Copy link
Copy Markdown
Contributor Author

@greptileai Please rereview this PR.

@Lightning11wins

Copy link
Copy Markdown
Contributor Author

I've concluded that I probably can't fix the table row detail issues mentioned in the initial PR comment, and help would be nice for some of the other listed issues as well.

@Lightning11wins

Copy link
Copy Markdown
Contributor Author

@greptileai Please rereview this PR anyway.

Comment thread centrallix-os/sys/js/htdrv_scrollpane.js
@Lightning11wins

Copy link
Copy Markdown
Contributor Author

@greptileai I think I've addressed your previous comments. Please rereview this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request AI review for PRs. documentation Changes, improvements, or fixes to documentation files. size: large Definitely very hard to review, probably well over 5000 lines.

Projects

None yet

1 participant