Skip to content

refactor(trial): split TryDiscovery.tsx into focused modules#771

Merged
simple-agent-manager[bot] merged 5 commits intomainfrom
sam/split-try-discovery-tsx
Apr 21, 2026
Merged

refactor(trial): split TryDiscovery.tsx into focused modules#771
simple-agent-manager[bot] merged 5 commits intomainfrom
sam/split-try-discovery-tsx

Conversation

@simple-agent-manager
Copy link
Copy Markdown
Contributor

@simple-agent-manager simple-agent-manager bot commented Apr 21, 2026

Summary

  • Split 910-line TryDiscovery.tsx monolith into 6 focused modules
  • hooks/useTrialEvents.ts — SSE lifecycle hook (161 lines)
  • lib/trial-view-model.ts — deriveView, buildFeed, types (168 lines)
  • lib/trial-utils.ts — cleanActivityText, extractRepoName, eventDedupKey (47 lines)
  • components/trial/DiscoveryCards.tsx — all card components (338 lines)
  • components/trial/DiscoveryHeader.tsx — header + connection badge (111 lines)
  • pages/TryDiscovery.tsx — page shell (188 lines, down from 910)
  • Removed FILE SIZE EXCEPTION comment since the file is now well under 500 lines

Test plan

  • All 1906 existing tests pass without modification
  • pnpm lint && pnpm typecheck && pnpm test && pnpm build all green
  • Re-exports in TryDiscovery.tsx maintain backward compatibility with test imports
  • Zero behavioral changes — pure structural refactor

Agent Preflight (Required)

  • Preflight completed before code changes

Classification

  • ui-change

External References

N/A: Pure refactor of existing code, no external APIs or libraries involved.

Codebase Impact Analysis

Affected: apps/web/src/pages/TryDiscovery.tsx — split into 5 new modules under apps/web/src/hooks/, apps/web/src/lib/, apps/web/src/components/trial/. No other packages affected. Backward-compat re-exports preserve existing test imports.

Documentation & Specs

N/A: No behavioral changes, no new features, no API changes.

Constitution & Risk Check

Principle XI (No Hardcoded Values): N/A — no new values introduced, existing configurable constants preserved in trial-ui-config.ts.
Rule 18 (File Size Limits): This PR directly addresses the rule — reduces TryDiscovery.tsx from 910 to 188 lines.

Specialist Review Evidence

Reviewer Status Outcome
ui-ux-specialist PASS Byte-for-byte behavioral identity confirmed, all accessibility attributes preserved
task-completion-validator ADDRESSED 2 MEDIUM criterion-text accuracy fixes applied

Staging Verification

Skipped — pure refactor with zero behavioral changes. No new UI surfaces, no API changes, no backend changes. The 1906 passing tests confirm functional equivalence.

🤖 Generated with Claude Code

raphaeltm and others added 5 commits April 21, 2026 05:11
Extract 910-line monolith into 6 focused files:
- hooks/useTrialEvents.ts — SSE lifecycle hook
- lib/trial-view-model.ts — deriveView, buildFeed, types
- lib/trial-utils.ts — cleanActivityText, extractRepoName, eventDedupKey
- components/trial/DiscoveryCards.tsx — all card components
- components/trial/DiscoveryHeader.tsx — header + connection badge
- pages/TryDiscovery.tsx — page shell (188 lines)

Re-exports buildFeed and eventDedupKey from TryDiscovery.tsx for
backward compatibility with existing tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@simple-agent-manager simple-agent-manager bot merged commit b1dbdde into main Apr 21, 2026
18 of 19 checks 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.

1 participant