feat: add portable rule-owned migration dashboard - #29
Draft
devagrawal09 wants to merge 16 commits into
Draft
Conversation
- Organize read-only analysis rules under rules/analysis/ (imports, jsx, lifecycle, props, reactivity, store) - Add transform workflow: deterministic relocation of the five pure legacy Solid subpaths (h, html, universal, jsx-runtime, jsx-dev-runtime) with per-edit reports and end-to-end fixture/expected trees - Consolidate emit steps into one shared scripts/emit-report.ts used by both the analyze and transform workflows (guidance vs relocation report) - Extend architecture, packaging, rule, and workflow tests for the two workflow layout and the new transform rule adapter
- Fix prototype-chain module lookup: bare specifiers such as constructor, toString, hasOwnProperty, valueOf, and __proto__ resolved through Object.prototype and were rewritten into inherited-member garbage; use Object.hasOwn for the relocation map lookup - Fix `export default "solid-js/h"` being treated as a re-export source: only a string that follows the `from` keyword is a re-export's module source, so exported string values stay byte-identical - Fix locally shadowed `require` false positives: files declaring their own require binding (function, const, parameter, import, catch) now leave every bare require() call in the file untouched; ambient `declare const require` remains a valid CommonJS require - Split transform rule coverage into 10 focused fixtures (static imports, single quotes, re-exports, runtime forms, negative forms, shadowed require, prototype names, escaped specifiers, no matches, broad integration), each asserting exact relocations and exact transformed text - Extend end-to-end transform fixtures with src/negative.ts (0 relocations), src/plain.js (CommonJS require), and src/nested/deep.jsx (nested JSX) - Update the rule adapter, transform-rules harness invariant (1 adapter / 10 fixtures), architecture fixture list, and e2e report regex/count
Rule folders stay lean: legacy-subpath-relocation now contains only the rule and its test adapter, with all 10 focused fixtures under fixtures/. Update the transform-rules harness to scan the subfolder and generalize assertRuleLayout to allow an optional fixtures subdirectory (analysis rule folders remain flat).
The syntactic shadow scan for bare require() calls matched any identifier
named require next to a binding construct, which was wrong in both
directions:
- false positives (safe, missed relocations): `import { require as r }`,
`function f(a = require)`, and `const alias = require` counted as local
require bindings even though the local binding is r, a, and alias
- false negatives (unsafe, wrong edits): `const [require] = arr`,
`function f([require])`, and `const { require = 1 } = obj` were not
detected as bindings, so bare require("solid-js/...") calls that resolve
to those local functions were rewritten
The scan now matches the exact binding slot via tree-sitter fields
(import_specifier.alias, parameter.pattern/value, assignment left,
pair_pattern value, declarator name), so references next to bindings never
count and destructuring bindings always do. `declare const/function
require` remains exempt as the ambient CommonJS require.
Regression coverage: new destructured-require fixture (array and
object-pattern-default shadows stay byte-identical) and extended
runtime-forms fixture (import alias, parameter default value, and
declarator alias references no longer suppress the require relocation).
Harness counts updated to 11 fixtures; verified with 12 independent
workflow probes (6 relocate / 6 untouched, all correct).
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in, portable Solid 2 migration dashboard while preserving the analyzer's existing default terminal behavior.
--report FILE, explicit--force, and explicit--openfile://hash routingcreateEffectreview sitesSettled behavior
prefers-color-scheme; manual changes are session-only and reset on reload--force; browser launch happens only with--openSource disclosure
Generated HTML embeds bounded project source snippets and the absolute analyzed target path. Treat and share the report as project source and local machine metadata. The CLI and README disclose this, including the limitation that editor links retain the fixed generation-time path.
Validation
pnpm verifypasses in full:Additional native/browser checks:
tests/fixtureSHA-256 hashes were unchanged after report generationfile://...report.html#/rules/...clicks, back/forward, reload, unknown routes, and hash-contained filename filtersLocal-only review artifacts
.reports/rule-dashboard-plan.htmland.reports/sample-dashboard.htmlremain local and untracked; they are not part of this PR.