Repository navigation
feat(skills): add global visibility controls to the skills UI #71360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
ceyniustranberg
wants to merge
1
commit into
posthog-code/skills-global-visibility-backend
from
posthog-code/skills-global-visibility-frontend
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Story mock's team_id doesn't match the mocked current team, silently hiding Edit/Archive actions
Priority: should_fix | Category: testing | Lines: 70-71, 108-109
Issue description
The new
team_id: 1field hardcoded on theSKILLmock (and copied ontoSKILL_LIST_ENTRY) does not match the team the StorybookAppactually bootstraps as the current team.mswDecoratoronly overrides thellm_skillslist/resolve endpoints here; the bootstrap endpoints/api/environments/@current/and/api/projects/@current/fall through to the default handler infrontend/src/mocks/handlers.ts, which returnsMOCK_DEFAULT_TEAM(id: 997, fromfrontend/src/lib/api.mock.ts). SinceLLMSkillScene.tsxnow derivesisOwnedByCurrentTeam = isSkill(skill) && skill.team_id === currentTeamId, and1 !== 997, bothSkillDetailStackedBelow2xlBreakpointandSkillDetailSideBySideAbove2xlBreakpointwill render this PR's new 'read-only, consumed-global-skill' code path: 'Edit latest'/'Use as latest' and 'Archive' will no longer render even though these stories are meant to depict an ordinary owned skill (they exist specifically to test the action-bar/sidebar layout at different breakpoints). This silently changes what the stories exercise and is likely to break any existing visual-regression baselines for these two stories, since they'll suddenly render with fewer action buttons than before this PR.Suggested fix
Set
team_idon theSKILL/SKILL_LIST_ENTRYmocks to the same team ID the Storybook bootstrap mocks resolve to (e.g. import and useMOCK_TEAM_IDfromfrontend/src/lib/api.mock, or explicitly override the/api/environments/@current/and/api/projects/@current/handlers in this story'smswDecoratorto return a team withid: 1), soisOwnedByCurrentTeamevaluates true and the stories keep exercising the full owned-skill action bar as intended.Why we think it's a valid issue
Confirmed against the codebase. In LLMSkillScene.tsx:97, isOwnedByCurrentTeam = isSkill(skill) && skill.team_id === currentTeamId, and the Edit/Use-as-latest (line 129) and Archive (line 208) actions are gated on it; only Download (gated on isSkill, line 172) survives. The story sets SKILL.team_id = 1 (line 71, copied to SKILL_LIST_ENTRY line 109) and its mswDecorator overrides only the llm_skills list/resolve endpoints. The bootstrap endpoints /api/environments/@current/ and /api/projects/@current/ fall through to the default handler (handlers.ts:204-205) which returns MOCK_DEFAULT_TEAM, whose id is MOCK_TEAM_ID = 997 (api.mock.ts:32,48). teamLogic loads currentTeam from api/environments/@current and exposes currentTeamId = currentTeam.id = 997. Therefore 1 !== 997, isOwnedByCurrentTeam is false, and both SkillDetailStackedBelow2xlBreakpoint and SkillDetailSideBySideAbove2xlBreakpoint render the new read-only consumer path with Edit/Archive hidden — not the owned-skill action bar these breakpoint stories were built to depict. This silently changes what the stories exercise and shifts the visual-regression baselines. The mock is also internally incoherent: is_global: false (private) combined with not-owned is a state that can't occur in production, since only global skills surface across teams. Fix is trivial (use MOCK_TEAM_ID / 997). Impact is confined to Storybook/VRT with no production effect, but it degrades the only visual coverage for this scene in the very PR that introduces the ownership gating, so should_fix is appropriate.
Prompt to fix with AI (copy-paste)