Use head_info rather than stacks or stack_details when possible#13904
Use head_info rather than stacks or stack_details when possible#13904Caleb-T-Owens wants to merge 4 commits into
head_info rather than stacks or stack_details when possible#13904Conversation
4cbfd44 to
f7e416e
Compare
f7e416e to
7a2e646
Compare
e27c1f1 to
deaeac0
Compare
bae9c5e to
56545d8
Compare
|
@Caleb-T-Owens Smoke tests failed with That's not related to the code in this PR (see this comment) and probably a spurious error, but it's still worrying. My best guess is that it's the background sync interfering with the next command being executed. |
|
I think there is a way to turn backtraces on with Then once it's clear where this is happening, it can be fixed. |
deaeac0 to
d59496a
Compare
56545d8 to
e638185
Compare
There was a problem hiding this comment.
Pull request overview
This PR migrates the desktop app’s primary stack/stack-details projection from legacy stacks/stack_details commands to the newer head_info (RefInfo) API, introducing adapter utilities to map RefInfo into the existing “legacy” stack/branch details shapes used by the UI.
Changes:
- Replaced
stacks+stack_detailsRTK Query endpoints with a singlehead_info-backedworkspaceDetailsendpoint and updatedStackServiceconsumers accordingly. - Added
headInfoAdapters(and unit tests) to transformRefInfointoWorkspaceDetails(entity state + derived per-stack details). - Removed legacy Tauri command registration/permissions for
stacksandstack_details, and updated PostHog “high volume” command tracking tohead_info.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/but-sdk/src/test.ts | Updates SDK smoke test to use headInfo + listProjectsStateless. |
| crates/gitbutler-tauri/src/main.rs | Stops registering stacks/stack_details as invokable Tauri commands. |
| crates/gitbutler-tauri/permissions/default.toml | Removes stacks/stack_details from the default allowlist. |
| apps/desktop/src/lib/telemetry/posthog.ts | Treats head_info as the high-volume command. |
| apps/desktop/src/lib/stacks/stackService.svelte.ts | Switches stack/branch/commit selectors to read from workspaceDetails instead of legacy endpoints. |
| apps/desktop/src/lib/stacks/stackEndpoints.ts | Replaces legacy endpoints with workspaceDetails query backed by head_info + adapters. |
| apps/desktop/src/lib/stacks/headInfoAdapters.ts | New adapter layer transforming RefInfo into stack/stack-details entities. |
| apps/desktop/src/lib/stacks/headInfoAdapters.test.ts | Adds Vitest coverage for the RefInfo → WorkspaceDetails mapping. |
| apps/desktop/src/components/branchesPage/BranchesViewStack.svelte | Switches branches-page stack lookup from “all stacks” to workspaceDetails stack lookup. |
| const stacks = stackSelectors.selectAll(workspaceDetails.stacks); | ||
| const stackIds = stacks.map((stack) => stack.id).filter(isDefined); |
We still need some usage of `stacks` for the branch listing page AFAIK, but using `head_info` for the main projection is a big help since it avoids the issues with some strange inconsistency issues between `stack_details` and `stacks`.
It’s a bit strange that we are implicitly linking the tauri frontend’s head_info call with this. Currently however we do need some consistency between the two so there is just one undestanding of what is being returned as a stack. The tests needed updated since the fixture was technically in single branch / pegging mode and as such that single branch had stack ref_info attached, which I think is the expected behaviour.
e638185 to
b585ad6
Compare
|
I've come into the realisation that my mapping layer to the old datastructures introduces a potential regression. If you have a branch segment that doesn't have a reference, it fails hard. Anon segments really need to be a first class supported entity, so I'm switching the frontend over to using the new datastructures which will allow us to properly support the scenario. |
This ended up being important to do since it the datastructures don’t provide the same garutees (which they shouldn’t have been making in the first place)
c53bd00 to
df8dd77
Compare
We still need some usage of
stacksfor the branch listing page AFAIK, but usinghead_infofor the main projection is a big help since it avoids the issues with some strange inconsistency issues betweenstack_detailsandstacks.