Skip to content

Delete the Labs syncEnabled flag and guard the free app's single sync entry point #3361

Closed as not planned

Description

@mstomar125

Summary

Delete labsFlags.syncEnabled from core once its last readers are gone:

Then add a guard test proving that the free app's settings expose exactly one sync-related control, core's entry action, and no other Pro or sync surface.

Context

  • The flag. In packages/desktop-app/src/lib/stores/labs-flags.svelte.ts at af8ddb61:

    • the syncEnabled field and its doc are at 15-16;
    • its default is at 23;
    • its getter and setter are at 60-67.

    It is persisted under the localStorage key nodespace-labs-flags.

  • What is left after Move the Pro account, admission and synced-database settings out of core #3327, Move the Pro sync and collaboration UI out of core #3333 and Make the Share / Sync website action the sync-entry default; remove the Labs card #3359:

    • the store itself;
    • src/tests/stores/labs-flags.test.ts: its doc (2-5) and lines 34, 66, 69, 73, 77, 82 and 91;
    • the reset lines settings-pane-labs-gating.test.ts:31 and settings-sidebar-labs-gating.test.ts:17.
  • The Pro package can't read the flag.

    • ADR-082 §2.3 keeps labsFlags out of the host API.
    • ADR-082 §2.6's lint rule forbids $lib imports in the Pro frontend.
    • Under the pin gate, any stray use would surface in nodespace-sync's pin-bump change, not in a shipped Pro app.

    So this issue needs no nodespace-sync gate.

  • A stale stored value is harmless. A syncEnabled key already in localStorage is spread into flags at load, but nothing reads it. CLAUDE.md forbids migration or clean-up code for it.

  • This guard replaces nothing. Move the Pro sync and collaboration UI out of core #3333 deletes free-user-guardrail.test.ts, and ADR-082 §8 moves its "no contribution renders while the virtual module is empty" check into the fixture-extension suite. This guard covers the settings surfaces instead.

  • Guardrail: stop new Pro code from landing in core #3302's absence-test convention. A test that asserts Pro strings are absent must build its needles from fragments. Otherwise its own source raises the ratchet: a literal tenant or NodeSpace Pro in the regex adds a tenantWording and a proWording line.

Scope

  1. labs-flags.svelte.ts: delete the syncEnabled field and its doc, its default, and its getter and setter. Keep the class doc, which is still accurate.

  2. src/tests/stores/labs-flags.test.ts:

    • Rewrite the file doc (2-5) so it no longer mentions "the companion Team synchronization toggle".
    • Delete the syncEnabled assertion in the defaults test.
    • Rewrite "setting one flag does not clobber the other" to use aiChatEnabled and playbooksEnabled. It expects { aiChatEnabled: true, playbooksEnabled: true }, then { aiChatEnabled: false, playbooksEnabled: true }.
    • In the reload test, store { aiChatEnabled: true, playbooksEnabled: false } and assert playbooksEnabled is false.
    • In the corrupt-JSON test, assert playbooksEnabled is false.
    • Add a test: on a fresh profile, Object.keys(labsFlags.flags).sort() equals ['aiChatEnabled', 'playbooksEnabled'].
  3. src/tests/components/settings/settings-pane-labs-gating.test.ts and settings-sidebar-labs-gating.test.ts: delete the labsFlags.syncEnabled = false; line in each reset.

  4. New src/tests/components/settings/free-app-sync-surface.test.ts.

    • Mock the logger, @tauri-apps/plugin-dialog and $lib/utils/external-links, and register no extension.
    • Build every forbidden needle from fragments, for example: new RegExp([['ten', 'ant'].join(''), 'Add synced', 'Syncs to', 'not synced', 'NodeSpace ' + 'P' + 'ro'].join('|'), 'i').
    • Keep test names free of those words.

    It asserts:

    • Sidebar. SettingsSidebar, with aiChatEnabled and playbooksEnabled on, lists exactly the core categories, in order.
    • Labs. LabsSettings renders exactly two switches.
    • Database settings. In DatabaseSettings:
      • exactly one button's text matches /sync/i, and it is SYNC_ENTRY_LABEL;
      • no text matches the fragment-built needle;
      • clicking the button opens syncEntryDialog.

Out of scope

Steps

  1. Run the startup sequence from CLAUDE.md, with EnterWorktree({name: "issue-<N>-drop-sync-labs-flag"}):
    • bun install;
    • bun run test for a baseline;
    • gh:comment, gh:assign @me, gh:status "In Progress".
  2. Pre-check. git grep -n "syncEnabled" -- packages/desktop-app must list only labs-flags.svelte.ts, labs-flags.test.ts and the two reset lines. Any other hit means Move the Pro account, admission and synced-database settings out of core #3327, Move the Pro sync and collaboration UI out of core #3333 or Make the Share / Sync website action the sync-entry default; remove the Labs card #3359 is incomplete: stop and report it.
  3. Make the edits in Scope 1-3, then add the guard from Scope 4.
  4. Finish:
    • bun run test:changed;
    • bun run scripts/check-pro-boundary.ts, then paste the printed BASELINES;
    • bun run --cwd packages/desktop-app quality:fix (svelte-check catches any leftover reader), then commit;
    • git push origin HEAD:issue-<N>-drop-sync-labs-flag;
    • gh pr create --repo NodeSpaceAI/nodespace-core --base main --head issue-<N>-drop-sync-labs-flag.
    • After approval: bun run merge <PR#> in the background, then ExitWorktree({action: "remove", discard_changes: true}).

Standards:

  • Use bun run test, never bun test.
  • No lint suppression.
  • No clean-up code for the stale key.
  • Comments cite ADR-081 and ADR-084, never issue numbers.

Acceptance criteria

  • git grep -n "syncEnabled" -- packages/desktop-app returns nothing.
  • LabsFlags has exactly aiChatEnabled and playbooksEnabled, and a fresh profile persists only those.
  • The guard passes, and fails if any of these is re-added (mutation-check each):
    • an "Account" category;
    • a third Labs switch;
    • an "Add synced database…" button;
    • tenant copy in Database settings;
    • a second button containing "sync".
  • The guard's own source adds no ratchet marker.
  • The AI Models and Playbooks Labs gating tests pass unchanged, apart from the removed reset lines.
  • bun run scripts/check-pro-boundary.ts exits 0, and BASELINES are lowered to the printed counts. cloudBindState should fall by about 16.
  • bun run test:changed and quality:fix are clean.

Tests and verification

  • bun run --cwd packages/desktop-app test src/tests/stores/labs-flags.test.ts src/tests/components/settings
  • bun run test:changed
  • bun run --cwd packages/desktop-app quality:fix
  • bun run scripts/check-pro-boundary.ts
  • Manual check with an isolated NODESPACE_HOME:
    1. Put {"aiChatEnabled":true,"syncEnabled":true} into localStorage['nodespace-labs-flags'] through devtools.
    2. Reload.
    3. Confirm that AI Models shows, there is no Account section, and there are no errors.

Dependencies

Risks and rollback

  • A brittle category list. The guard's exact list is strict on purpose. A new core settings category has to be added to it deliberately.
  • Rollback. Revert the PR. This restores the field and its tests, and stored values are untouched.

Plan key: C9.3 (pro-boundary DAG).

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

pro-boundary

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions