Skip to content

Split marm-console's Knowledge.tsx into per-component files#100

Merged
Lyellr88 merged 2 commits into
MARM-mainfrom
refactor/knowledge-tsx-split
Jul 18, 2026
Merged

Split marm-console's Knowledge.tsx into per-component files#100
Lyellr88 merged 2 commits into
MARM-mainfrom
refactor/knowledge-tsx-split

Conversation

@Lyellr88

@Lyellr88 Lyellr88 commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Pure refactor, no behavior changes. Extracted via exact index-based line-slicing (all 6 moved bodies verified byte-identical to the original before any import cleanup) -- same methodology as the Memory.tsx split.

  • src/pages/Knowledge.tsx keeps only the KnowledgePage shell: 871 -> 45 lines.
  • src/components/knowledge/shared.tsx (new, 41 lines): DEFAULT_HIDDEN_PREDICATES, TYPE_COLORS, OTHER_TYPE_COLOR, typeColor, nodeRadius, mergeNeighborhoods.
  • src/components/knowledge/GraphViz.tsx (new, 291 lines): the canvas/react-force-graph-2d visualization component alone -- the largest and most self-contained piece.
  • src/components/knowledge/ExplorerTab.tsx (new, 340 lines): ProvenancePanel + ExplorerTab -- kept together since ProvenancePanel is only ever rendered by ExplorerTab, receiving all its data as props.
  • src/components/knowledge/BuildAndDuplicates.tsx (new, 172 lines): BuildConceptsDialog + DuplicatesTab -- functionally unrelated but both small and both used directly by the page shell, grouped for file-count balance rather than functional coupling.

Split shape differs from the Memory.tsx split (flat sibling tabs) since this file has real parent-child coupling (GraphViz/ProvenancePanel are children of ExplorerTab, not sibling tabs) -- documented in docs/current/knowledge-tsx-module-split.md.

Each extracted component/const referenced across file boundaries gained export (mechanical TS requirement). One real gap caught by tsc --noEmit during implementation: ExplorerTab.tsx's import list initially omitted DEFAULT_HIDDEN_PREDICATES from shared.tsx despite using it -- fixed before commit.

Validated: tsc --noEmit clean, npm run build succeeds, and a real Playwright smoke pass against the running dev server confirmed both tabs render and the Build Concepts dialog opens with a working scope selector, zero JS console errors.

Summary by CodeRabbit

  • New Features
    • Added an interactive knowledge graph explorer with search, filtering, zoom, node expansion, and provenance details.
    • Added concept-building workflows for session, project, or global scopes with live progress and results.
    • Added a Duplicate Candidates view with similarity details and loading and empty states.
  • Usability
    • Added graph controls for relationship direction, visibility filters, hover highlighting, and fit-to-view navigation.

Pure refactor, no behavior changes. Extracted via exact index-based
line-slicing (all 6 moved bodies verified byte-identical to the
original before any import cleanup) -- same methodology as the
Memory.tsx split.

- src/pages/Knowledge.tsx keeps only the KnowledgePage shell:
  871 -> 45 lines.
- src/components/knowledge/shared.tsx (new, 41 lines):
  DEFAULT_HIDDEN_PREDICATES, TYPE_COLORS, OTHER_TYPE_COLOR, typeColor,
  nodeRadius, mergeNeighborhoods.
- src/components/knowledge/GraphViz.tsx (new, 291 lines): the
  canvas/react-force-graph-2d visualization component alone -- the
  largest and most self-contained piece.
- src/components/knowledge/ExplorerTab.tsx (new, 340 lines):
  ProvenancePanel + ExplorerTab -- kept together since ProvenancePanel
  is only ever rendered by ExplorerTab, receiving all its data as
  props.
- src/components/knowledge/BuildAndDuplicates.tsx (new, 172 lines):
  BuildConceptsDialog + DuplicatesTab -- functionally unrelated but
  both small and both used directly by the page shell, grouped for
  file-count balance rather than functional coupling.

Split shape differs from the Memory.tsx split (flat sibling tabs) since
this file has real parent-child coupling (GraphViz/ProvenancePanel are
children of ExplorerTab, not sibling tabs) -- documented in
docs/current/knowledge-tsx-module-split.md.

Each extracted component/const referenced across file boundaries
gained `export` (mechanical TS requirement). One real gap caught by
tsc --noEmit during implementation: ExplorerTab.tsx's import list
initially omitted DEFAULT_HIDDEN_PREDICATES from shared.tsx despite
using it -- fixed before commit.

Validated: tsc --noEmit clean, npm run build succeeds, and a real
Playwright smoke pass against the running dev server confirmed both
tabs render and the Build Concepts dialog opens with a working scope
selector, zero JS console errors.
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Lyellr88, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 16 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 386b432b-9748-4e52-b69b-c1fd359fd8d4

📥 Commits

Reviewing files that changed from the base of the PR and between 94af92e and 6cef780.

📒 Files selected for processing (2)
  • marm-console/artifacts/marm-console/src/components/knowledge/BuildAndDuplicates.tsx
  • marm-console/artifacts/marm-console/src/components/knowledge/ExplorerTab.tsx
📝 Walkthrough

Walkthrough

Changes

Knowledge console

Layer / File(s) Summary
Build and duplicate workflows
marm-console/artifacts/marm-console/src/components/knowledge/BuildAndDuplicates.tsx
Adds scoped concept-build controls, live job status, cache invalidation, and duplicate-candidate rendering.
Shared graph data and styling
marm-console/artifacts/marm-console/src/components/knowledge/shared.tsx
Adds graph filtering defaults, node styling helpers, and neighborhood merging.
Interactive graph visualization
marm-console/artifacts/marm-console/src/components/knowledge/GraphViz.tsx
Adds force-directed rendering, filtering, hover highlighting, layout pinning, zoom, pause, and fit controls.
Explorer and provenance flow
marm-console/artifacts/marm-console/src/components/knowledge/ExplorerTab.tsx
Adds debounced entity search, overview and neighborhood loading, graph expansion, visibility controls, and provenance details.
Knowledge page wiring
marm-console/artifacts/marm-console/src/pages/Knowledge.tsx
Delegates Explorer, Duplicate Review, and concept-building UI to the new components.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • Lyellr88/marm-memory#87: Adds backend concept-build lifecycle and duplicate-data support used by this console UI.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Lyellr88

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@marm-console/artifacts/marm-console/src/components/knowledge/BuildAndDuplicates.tsx`:
- Around line 29-38: Update the build dialog lifecycle around isRunning and the
existing dialog open/close state: treat an active job whose initial jobStatus
fetch is still loading as running so the Close action is unavailable until
status is known. Add a close-state effect that clears jobId and resets all build
form/status state when the dialog closes, while preserving state during an open
dialog and allowing a fresh build on the next opening.

In
`@marm-console/artifacts/marm-console/src/components/knowledge/ExplorerTab.tsx`:
- Around line 304-330: Update the render condition around GraphViz in
ExplorerTab so loadError is checked before graph, preventing a retained previous
graph from rendering after a failed seed or direction request. Keep the existing
graph rendering for successful loads and preserve the current loadError message
and UI.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0c367b22-fd64-48d9-92e1-2a0de852ade4

📥 Commits

Reviewing files that changed from the base of the PR and between 53b42cf and 94af92e.

📒 Files selected for processing (5)
  • marm-console/artifacts/marm-console/src/components/knowledge/BuildAndDuplicates.tsx
  • marm-console/artifacts/marm-console/src/components/knowledge/ExplorerTab.tsx
  • marm-console/artifacts/marm-console/src/components/knowledge/GraphViz.tsx
  • marm-console/artifacts/marm-console/src/components/knowledge/shared.tsx
  • marm-console/artifacts/marm-console/src/pages/Knowledge.tsx
📜 Review details
🔇 Additional comments (4)
marm-console/artifacts/marm-console/src/components/knowledge/shared.tsx (1)

1-41: LGTM!

marm-console/artifacts/marm-console/src/components/knowledge/GraphViz.tsx (1)

1-291: LGTM!

marm-console/artifacts/marm-console/src/components/knowledge/ExplorerTab.tsx (1)

1-303: LGTM!

Also applies to: 331-340

marm-console/artifacts/marm-console/src/pages/Knowledge.tsx (1)

1-45: LGTM!

Comment thread marm-console/artifacts/marm-console/src/components/knowledge/ExplorerTab.tsx Outdated
Both findings were confirmed real, pre-existing bugs in the original
Knowledge.tsx (carried over verbatim by the split). Fixing here since
this branch is the only place with easy access to the touched code
right now, same reasoning as PR #99's follow-up fixes.

- BuildAndDuplicates.tsx: isRunning now also covers the initial poll
  gap (jobId set but jobStatus not yet loaded), so the Close button
  can't appear before the job's real status is known. Added a
  close-effect that resets jobId/scope/scopeValue/confirmAll when the
  dialog closes, so reopening starts a fresh build instead of showing
  the previous job's finished state.
- ExplorerTab.tsx: loadError is now checked before the stale-graph
  branch, so a failed seed/direction request shows the error state
  instead of silently re-rendering the previous successful graph.

Verified: tsc --noEmit clean, npm run build succeeds, Playwright smoke
pass against the live dev server confirmed no JS errors and the dialog
reset behavior works end-to-end (open -> close -> reopen shows a fresh
scope selector, not the prior job's status view).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011s8tBNnQTmb1q5nRAKwhvv
@Lyellr88
Lyellr88 merged commit f4ba35c into MARM-main Jul 18, 2026
7 checks passed
@Lyellr88
Lyellr88 deleted the refactor/knowledge-tsx-split branch July 18, 2026 11:17
Lyellr88 pushed a commit that referenced this pull request Jul 18, 2026
All 5 findings were confirmed real, pre-existing bugs in the original
Memory.tsx (carried over verbatim by the split). Fixing here since
this branch is the only place with easy access to the touched code
right now, same reasoning as PRs #99/#100's follow-up fixes.

- MemoriesTab.tsx: selectedIds now drops IDs no longer in the visible
  result set whenever search/filter results change, so bulk delete
  can't act on hidden stale selections. toggleAll's 'all selected'
  check now verifies every displayed ID is selected instead of just
  comparing set sizes.
- MemoriesTab.tsx: clearing the context type field now sends null to
  the server instead of falling back to the memory's previous value.
- NotebookAndCompactionTabs.tsx: name/project/platform are the
  notebook entry's identity key, so they're now locked once editing
  an existing entry -- editing them on save previously created a
  duplicate record instead of updating the original.
- SessionsAndLogsTabs.tsx + NotebookAndCompactionTabs.tsx: session,
  log, notebook, and compaction mutations now all route their
  success/error outcomes through the single actionNotice state
  instead of independent per-mutation .error checks that could mask
  a newer result behind a stale one.
- shared.tsx: deleteNotice now derives its base message from the
  actual deletedCount (including zero) and returns 'warning' whenever
  any requested ID was missing, instead of always reporting success.

Verified: tsc --noEmit clean, npm run build succeeds, Playwright smoke
pass against the live dev server hit all 5 tabs with zero JS errors.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011s8tBNnQTmb1q5nRAKwhvv
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