Skip to content

refactor(resources): migrate log and knowledge onto the axes; collapse tab chrome - #6280

Open
waleedlatif1 wants to merge 1 commit into
improvement/resource-views-finalfrom
integrate/resource-migrations
Open

refactor(resources): migrate log and knowledge onto the axes; collapse tab chrome#6280
waleedlatif1 wants to merge 1 commit into
improvement/resource-views-finalfrom
integrate/resource-migrations

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #6279 — review that first. This PR's diff is 76 files against it.

  • Migrate the log and knowledge resources onto the axes introduced in refactor(resources): one canonical view per resource, mounted on source/grants/host #6279, so every kind but table now renders through one canonical view
  • Collapse the five Embedded*Actions components into a single ResourceTabActions driven by a RESOURCE_TAB_ACTIONS map, replacing five near-identical kind-specific components with one lookup
  • Extract knowledge's list state into use-knowledge-list-state, with all six URL keys (q, enabled, sort, dir, page, addConnector) gated on hostOwnsUrl so the embedded panel keeps them local instead of writing them to the page's URL
  • Pass showExecutionInternals explicitly into the log view rather than reading permissions internally, so the same view serves both hosts
  • Drop the dead schedule resource kind

Ratchets: Embedded* components 8 → 2, cross-tree workspace imports 38 → 37.

Type of Change

  • Refactor

Testing

Typecheck clean, all 15 repo gates pass, biome clean, full suite green (18,626 tests).

Not visually verified. The knowledge base page is the highest risk here — its header, toolbar, and table moved under ResourceRoot, and its URL params now flow through the new hook.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 5, 2026 4:09am

Request Review

@cursor

cursor Bot commented Aug 5, 2026

Copy link
Copy Markdown

PR Summary

Cursor Bugbot is generating a summary for commit 2fcbe72. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This refactor migrates knowledge and log resources to their canonical resource views while consolidating embedded tab actions and host-owned state.

  • Moves shared resource primitives out of the workspace route tree.
  • Keeps knowledge query state URL-backed on pages and local inside panels.
  • Passes log-internals visibility explicitly from each host.
  • Removes the obsolete schedule resource kind and collapses kind-specific action components.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/hooks/use-knowledge-list-state.ts Centralizes six knowledge-list state keys and correctly selects URL-backed or local state according to host ownership.
apps/sim/components/resources/knowledge-view/knowledge-view.tsx Introduces the canonical knowledge resource presentation while retaining grant-gated interaction behavior.
apps/sim/components/resources/log-view/log-view.tsx Introduces the canonical log presentation and explicitly gates traces, snapshots, and execution payloads through the caller-provided visibility flag.
apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/resource-content.tsx Mounts canonical resource views in the panel and consolidates supported tab actions into a typed dispatch map.
apps/sim/resources/kinds.ts Removes the obsolete schedule resource kind and updates the canonical resource type model.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Page[Workspace page host] --> Axes[Source + grants + host]
  Panel[Mothership panel host] --> Axes
  Axes --> Knowledge[Canonical KnowledgeView]
  Axes --> Log[Canonical LogView]
  Page --> URL[URL-owned list and tab state]
  Panel --> Local[Local list and tab state]
  Actions[RESOURCE_TAB_ACTIONS map] --> Panel
Loading

Reviews (2): Last reviewed commit: "refactor(resources): migrate log and kno..." | Re-trigger Greptile

…e tab chrome

Continues the resource-view layer. Three kinds now have a canonical view
(file, log, knowledge) and only `table` remains — deliberately, because the
mothership mounts its editing shell, which is a product decision rather than
unfinished work.

**log** — `log-details/` splits into `components/resources/log-view/` (the view)
and a 198-line shell that keeps resize, keyboard nav and close chrome. Four
leaked contexts resolved: `useParams` → `source.workspaceId`, `useRouter` →
an `onNavigate` prop, `useQueryState(tab)` → view-owned state gated by
`hostOwnsUrl(host)`, `usePermissionConfig` → a required `showExecutionInternals`
prop (deliberately not folded into `grants`: it gates *seeing* trace internals,
not write or run, and an optional field would default permissive — the wrong
failure mode for a permission-group restriction). A fifth leak the plan missed —
`file-download.tsx` holding its own `useRouter` — was caught by the gate.

**knowledge** — `base.tsx` (1733 lines) splits into a 909-line canonical view
and a 974-line shell. The read surface (document list, filters, sort,
pagination, unavailable state) is the view; upload, connectors, tag editing,
rename, delete and bulk operations stay in the shell, exactly as the tables
editing grid kept its write path. All six nuqs keys now route through
`useKnowledgeListState(host)`, whose every write sits behind `hostOwnsUrl`.

**tab chrome** — the five `Embedded*Actions` collapse into one kind-keyed
`ResourceTabActions`. They differed only in icon, copy and destination, which is
a config table. `knowledge` and `table` destinations now resolve through
`workspaceSource().hrefFor()` instead of hand-built strings.

**schedule** is removed as a resource kind: its page was deleted upstream, its
`resourceHref` case pointed at a route that no longer exists, and
`MothershipResourceType` never carried it, so it was unreachable.

Behavior change, intended and limited to embedded surfaces: the mothership panel
no longer writes the log `?tab` key or the six knowledge keys into the host
page's address bar. That is the bug the `host` axis exists to fix. Both route
pages keep their deep-linkable params unchanged.

`Resource` and `InlineRenameInput` moved to `components/` — mandatory, since a
canonical unit may not import the workspace route tree. The workspace barrel
re-exports both, so its consumers are byte-unchanged.

Ratchets: shadow-named components 8 → 2 (the 2 left are deliberate —
`EmbeddedWorkflow`, because a workflow is a live collaborative session rather
than a document with an address, and `EmbeddedFolder`, because a folder is
structure inside a resource); cross-tree imports 38 → 37. None raised.

Verification: apps/sim + 22 packages typecheck, biome clean, 18626 tests pass,
and all 15 repo gates pass including both strict variants. Not visually verified.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile-apps

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 11f8735. Configure here.

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