4.9 KiB
4.9 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | ||
|---|---|---|---|---|---|---|---|---|
| 05-nav-availability | Decouple left-panel nav visibility from the enabled toggle | done | 4 |
|
plan.md | ../../specs/integrations/requirements/enable-disable-toggle.md |
Task 05: Decouple left-panel nav visibility from the enabled toggle
- Acceptance:
useNavAvailability()returnstruefor a configured integration that is disabled whenhideDisabledisfalse(the default), andfalsefor the same integration whenhideDisabledistrue.useNavAvailability()returnsfalsefor an unconfigured integration regardless ofenabled/hideDisabled.apps/web/hooks/use-nav-availability.test.tsandapps/web/components/integrations/integrations-menu.test.tspass with updated mocks, and cover both new cases from criteria 1-2 in a table-driven test over the five nav-gated keys.
- Verification:
cd apps && pnpm --filter @kandev/web test -- hooks/use-nav-availability components/integrations/integrations-menu - Files likely touched:
apps/web/hooks/use-nav-availability.tsapps/web/hooks/use-nav-availability.test.tsapps/web/components/integrations/integrations-menu.test.ts
- Dependencies:
01-enabled-hooks,04-hide-disabled-setting. - Parallelism: sequential.
- Inputs: spec Scenarios, plan Task 05 derivation formula,
use-jira-availability.ts's/use-linear-availability.ts's existinguseJiraAuthed/useLinearAuthedexports. - Output contract: summary, files changed, exact test command run and its output, blockers/risks, task/plan status update.
Results
useNavAvailabilitynow computes, for each of the five nav-gated keys,configured && (!hideDisabled || enabled):configuredreuses the exact pre-existing signals unchanged for azure-devops (useAzureDevOpsAvailable), github (getGitHubIntegrationStatus(...).ready), and gitlab (useGitLabAvailable) — none of these three had an "enabled" toggle before this feature, so their "configured" signal already meant exactly what this task needs.configuredfor jira/linear switched fromuseJiraAvailable/useLinearAvailable(the old combined enabled+authed signal) to the already-existing, enabled-agnosticuseJiraAuthed/useLinearAuthed.enabledcomes from the fiveuseXEnabled()hooks (three new from Task 01, two pre-existing:useJiraEnabled/useLinearEnabled).hideDisabledcomes from Task 04'suseHideDisabledIntegrationsInNav().- Confirmed
useJiraAvailable/useLinearAvailablethemselves were not touched — every other consumer (import bars, Kanban external-link buttons, task-top-bar buttons,workspaces-group.tsx's settings tree) keeps importing and using them exactly as before; only this file's imports changed.
- Rewrote
use-nav-availability.test.ts: renamed the Jira/Linear mocks tojiraAuthed/linearAuthed(matching the new import), added a controllableuseGitHubStatusmock (previously hardcoded to unconfigured) so GitHub'sconfiguredaxis is also testable, added enabled-hook mocks for all five keys (defaulttrue) and ahideDisabledmock (defaultfalse), and replaced the single Jira-only decoupling test with adescribe.eachtable over all fiveAvailabilityKeys × 4 cases each (unconfigured-hides-regardless, disabled-stays-visible-by-default, disabled-hidden-when-hideDisabled-on, enabled-stays-visible-when-hideDisabled-on). - Updated
integrations-menu.test.ts: renamed its Jira/Linear mocks the same way (useJiraAvailable→useJiraAuthed, param namesjiraAvailable/linearAvailable→jiraConfigured/linearConfigured), and added fixedenabled: true/hideDisabled: falsestub mocks for the five new hooksuseNavAvailabilitynow transitively calls — this suite never exercises the decoupling itself (that'suse-nav-availability.test.ts's job), so every existing assertion keeps passing unchanged. - Commands:
cd apps && pnpm --filter @kandev/web test -- hooks/use-nav-availability components/integrations/integrations-menu→Test Files 2 passed (2),Tests 20 passed (20)(26 after the later table-driven expansion — see below).cd apps/web && pnpm run typecheck→ one error caught and fixed (a leftover incorrectGitHubStatusstub shape in the rewritten test file — corrected to match the real type's fields), then clean.- Follow-up (post-review): expanded the single Jira-only decoupling test
into the five-key
describe.eachtable described above. Rerun:Test Files 1 passed (1),Tests 26 passed (26)forhooks/use-nav-availabilityalone.
- Files changed: the three files listed under "Files likely touched".
- Blockers/risks: none. Explicitly verified no other
useJiraAvailable/useLinearAvailableconsumer was touched (see spec Out-of-scope).