Skip to content

Widgets XML Verification Script#101

Open
Lightning11wins wants to merge 51 commits into
masterfrom
widgets-xml-script3
Open

Widgets XML Verification Script#101
Lightning11wins wants to merge 51 commits into
masterfrom
widgets-xml-script3

Conversation

@Lightning11wins
Copy link
Copy Markdown
Contributor

@Lightning11wins Lightning11wins commented May 11, 2026

This python3 script detects discrepancies between the widgets.xml docs and the widget implementations in wgtr_*.c, htr_*.c, and htr_*.js files to generate a report. The report summarizes the issues detected and provides links to make it easy for developers to quickly correct them. This branch also includes a documentation file explaining how to read the reports, how to use the script, and a high-level overview of how the script works.

Note: Many of the issues detected by running this script are fixed in #100.

Example 1
ReportExample1

Example 2
ReportExample2

Note 1: As usual, these changes were made on a completely different dev branch, then the commits were cherry-picked to this branch. This prevents the PR being blocked behind 8+ other PRs, however, it was a difficult and technical process. If you notice any bizarre changes on this branch, please let me know.

Add a defined config section.
Move regexes to their own section below the config section.
Add a section for types.
Move "drift types" to above compute_drift() in preparation removing them.
Rename OBSOLETE_WIDGETS to IGNORED_WIDGETS.
Add to ignored widgets.
Add to widget aliases.
Add config options.

Add a universal rule for __pycache__ to the .gitignore file.
Rename many symbols to improve clarity.
Remove unused types.
Improve code comments.
Clean up slop.
Improve symbol regex.
Rename get_documented_widgets() to parse_docs().
Rename parse_c_impl() to parse_c().
Rename parse_js_impl() to parse_js().
Fix typos.
Update widget aliases.
Remove skipped widgets from ignored widgets list.
Add remotectl and remotemgr to ignored widgets list.
Add IGNORE_MISSING_PROPERTY_DOCS.
Reorder configs and improve clarity.
Refactor to remove some unnecessary report types.
Improve code style and layout.
Rename slug_origin() to get_origin().
Clean up code.
Update report generation to derive origins from ref paths.
Remove now unused origin data storage.
Display origins above more sources.
Move sections from Other Notes to Using Doc Reports.
Add a list of future improvements.
Refactor to improve readability maintainability.
Rename _normalize_child_type() to normalize_child_name().
Clean up unused code.
@Lightning11wins Lightning11wins self-assigned this May 11, 2026
@Lightning11wins Lightning11wins added ai-review Request AI review for PRs. documentation Changes, improvements, or fixes to documentation files. size: medium Might be hard to review, usually less than ~5000 lines. labels May 11, 2026
@Lightning11wins
Copy link
Copy Markdown
Contributor Author

@greptileai Please review of this PR.

@Lightning11wins
Copy link
Copy Markdown
Contributor Author

Greptile finally started. I think I pinged it at least 8 times (most deleted), and it's supposed to trigger automatically.

@Lightning11wins Lightning11wins added the testing Includes testing, either new tests or updates to existing tests. label May 11, 2026
@Lightning11wins
Copy link
Copy Markdown
Contributor Author

I suppose this qualifies as testing since we're testing the docs. I'll document it in #94 once that PR is unblocked.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 11, 2026

Greptile Summary

This PR adds a Python 3.11+ script (generate.py) that cross-references widgets.xml documentation against wgtr_*.c, htdrv_*.c, and htdrv_*.js implementations to produce report.json and report.md doc-drift reports, along with a usage guide and a make doc-report target.

  • generate.py: Parses XML docs and C/JS driver files via regex and ElementTree, computes per-widget missing/stale event, action, and parameter findings, and writes both a machine-readable JSON report and a human-readable Markdown report with clickable source links.
  • doc-reports-guide.md: Documents how to generate and read reports, covering confidence levels, child-widget assumptions, and the four report sections.
  • .gitignore / makefile: Adds ignore entries for generated report files and a doc-report phony target; a previously path-specific __pycache__ entry is replaced with a global one.

Confidence Score: 5/5

Safe to merge; the script is a standalone reporting tool with no impact on the Centrallix build or runtime.

The changes add a self-contained developer tooling script and its documentation. The core parse → diff → write pipeline is logically sound, the generated filenames and .gitignore entries are consistent, and the Python version floor is correctly stated. The one finding is a dead-code comparison in parse_js that can never fire and has no effect on report correctness.

No files require special attention; the dead comparison in parse_js is cosmetic and does not affect output.

Important Files Changed

Filename Overview
centrallix-doc/Widgets/doc-report/generate.py New 1179-line Python script that parses widgets.xml, wgtr/htdrv C files, and htdrv JS files to generate doc-drift reports. Logic is generally sound after previous fix rounds; one dead-code comparison in parse_js (widget_name vs eager_widget_name) will never fire.
centrallix-doc/Widgets/doc-report/doc-reports-guide.md New guide file documenting usage, output format, and design of generate.py. Filenames (report.json/report.md), Python version floor (3.11), and TOC anchors are all consistent with the script after previous fixes.
.gitignore Replaces path-specific pycache entry with a global pycache/ pattern and adds ignore entries for the two generated report files; consistent with script output paths.
centrallix-doc/Widgets/makefile Adds a doc-report phony target that invokes generate.py with the correct --repo-root path; straightforward addition.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[widgets.xml] -->|ElementTree + regex| B[parse_docs\ndocs, doc_types]
    C[wgtr/wgtdrv_*.c] -->|c_register_re| D[parse_widgets_in_wgtr\nwidget_types, families, refs]
    E[htmlgen/htdrv_*.c] -->|c_name_re\nhtrAddEvent\nhtrAddAction| F[parse_c\nc_widgets]
    G[sys/js/htdrv_*.js] -->|ifcProbeAdd\nifEvent/ifAction\n.Add calls| H[parse_js\njs_widgets]
    D -->|expand_any_child_coverage| B
    F --> I[merge_widget_lists\nwidgets]
    H --> I
    B --> J[compute_report]
    D --> J
    I --> J
    J -->|WRITE_REPORT_JSON| K[report.json]
    J -->|WRITE_REPORT_MD| L[report.md]
Loading

Reviews (6): Last reviewed commit: "Fix mistake caught by Greptile." | Re-trigger Greptile

Comment thread centrallix-doc/Widgets/doc-report/doc-reports-guide.md
Comment thread centrallix-doc/Widgets/doc-report/doc-reports-guide.md Outdated
Comment thread centrallix-doc/Widgets/doc-report/doc-reports-guide.md
Comment thread centrallix-doc/Widgets/doc-report/generate.py
Comment thread centrallix-doc/Widgets/doc-report/generate.py Outdated
@Lightning11wins
Copy link
Copy Markdown
Contributor Author

@greptileai Your comments should be resolved. Please re-review this code.

Comment thread centrallix-doc/Widgets/doc-report/generate.py
Comment thread centrallix-doc/Widgets/doc-report/generate.py
Fix detection ignoring all but the first widget in htdrv_*.c files.
Add a section to the docs documenting assumptions about child widgets.
Replace case-sensitive string check with more-flexible case-insensitive regex.
Improve regex.
Improve types.
Comment thread centrallix-doc/Widgets/doc-report/generate.py Outdated
@Lightning11wins
Copy link
Copy Markdown
Contributor Author

@greptileai I think I've resolved all of your feedback. Please conduct a thorough re-review of the entire PR and tell me if there are any other issues.

@Lightning11wins
Copy link
Copy Markdown
Contributor Author

This PR is cleared for human review.

@Lightning11wins Lightning11wins requested review from gbeeley and nboard May 12, 2026 21:49
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: medium Might be hard to review, usually less than ~5000 lines. testing Includes testing, either new tests or updates to existing tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant