Skip to content

feat(parser-react): class components, HOC unwrapping, graceful degradation — Gate 1 complete#12

Merged
officialCodeWork merged 1 commit into
developmentfrom
build/phase-1/step-1.6-legacy-patterns
Jul 13, 2026
Merged

feat(parser-react): class components, HOC unwrapping, graceful degradation — Gate 1 complete#12
officialCodeWork merged 1 commit into
developmentfrom
build/phase-1/step-1.6-legacy-patterns

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

Summary

TRACKER Step 1.6 — failure mode D4, and the close of Phase 1 (Gate 1).

What's in it

  • Class componentsReact.Component / PureComponent / bare Component subclasses: render() supplies text/instances/events, the whole class body supplies lifecycle fetches (componentDidMount), this.state keys become class-state nodes, this.props.X accesses become props, and onClick={this.refresh} method references resolve as handlers.
  • HOC unwrappingconst Panel = connect(mapState)(PanelInner) records an alias; <Panel/> materializes as an instance of PanelInner. Covers connect/withRouter/memo/forwardRef/observer/inject/withTranslation/styled, curried or not, alias chains bounded at 3.
  • Graceful degradation — a class with no render() yields an incomplete-flagged node instead of silence; coderadar scan prints incomplete: N node(s) could not be fully parsed.
  • Eval check fix the HOC case exposed: instance counts now match by definitionId, not tag name — <Panel/> is an instance of PanelInner even though the JSX never says so.

Gate 1 (from docs/testing-strategy.md)

Lineage precision ≥ 0.90, recall ≥ 0.80 across fixtures C2, C3, C5, A2, A7, A8, D4; zero forbidden hits

Passed: precision 1.000, recall 0.895, all seven failure-mode fixtures green, zero poison. Scorecard: 91 pass / 0 fail / 2 xfail (the C1 instance attributions — Phase 2's headline target).

Test plan

  • 67 unit tests green (7 new: class detection, lifecycle attribution, class-state, method handlers, class props, HOC instance resolution, incomplete flag)
  • pnpm eval gate OK; schema regenerated (class-state kind), drift gate green
  • CLI incomplete-count verified on the fixture

Documentation

  • TRACKER.md — 1.6 done, Gate 1 recorded, Status → Phase 2 step 2.1

🤖 Generated with Claude Code

…ation — Gate 1 complete

Step 1.6 (TRACKER). Failure mode D4; closes Phase 1:

- Class components: React.Component/PureComponent/bare Component subclasses
  scanned — render() is the text/instance/event body, the whole class body
  yields lifecycle fetches (componentDidMount), this.state keys become
  class-state nodes, this.props.X accesses become props, and method-
  reference handlers (onClick={this.refresh}) resolve.
- HOC unwrapping: const Panel = connect(map)(PanelInner) records an alias;
  <Panel/> call sites materialize as instances OF PanelInner (alias chain
  bounded at 3). Eval components check now counts instances by definitionId,
  not tag name — the semantically correct reading the HOC case exposed.
- Graceful degradation: a class with no render() emits an incomplete-flagged
  node instead of vanishing; coderadar scan prints the incomplete count.
- Body-walking helpers genericized from FunctionLike to Node so classes and
  functions share extraction (extractRenderedText/BodyFacts/InstanceSites).
- Scorecard: 91 pass / 0 fail / 2 xfail; precision 1.000, recall 0.895.
  67 unit tests. GATE 1 PASSES.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@officialCodeWork
officialCodeWork merged commit b628c81 into development Jul 13, 2026
1 check passed
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