Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(settings): Privacy speaks of the project limit only while it is on

review470df0b00db9
diff --git a/src/renderer/components/settings/sections/PrivacySection.test.tsx b/src/renderer/components/settings/sections/PrivacySection.test.tsx
index ac6963333..4f120e200 100644
--- a/src/renderer/components/settings/sections/PrivacySection.test.tsx
+++ b/src/renderer/components/settings/sections/PrivacySection.test.tsx
@@ -2,7 +2,10 @@
//
// Settings → Privacy is where the user learns what the telemetry toggle sends. The open-project
// count rides /v1/check only while this toggle is on (core/check.ts), so the row must say so —
-// and say it is a number only — before the first count is ever sent (spec §9).
+// and say it is a number only — before the first count is ever sent.
+//
+// While the free-tier project limit is off the section reads exactly as it did before the limit
+// existed: the machine-hash sentence and the allowance wording appear only while it is on.
import { act } from 'react'
import { createRoot, type Root } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -56,7 +59,33 @@ async function renderSection(): Promise<string> {
const CONSENT_LABEL = 'Allow license checks while DO_NOT_TRACK is set'
const CONSENT_DESCRIPTION =
+ 'Lets nodeterm contact api.nodeterm.dev for license checks only. Telemetry and the announcement feed stay off.'
+const CONSENT_DESCRIPTION_ACTIVE =
'Lets nodeterm contact api.nodeterm.dev for Pro and your free-project allowance only. Telemetry and the announcement feed stay off.'
+/** The telemetry description as Release A shipped it — all of it while the limit is off. */
+const TELEMETRY_DESCRIPTION =
+ 'No personal data; client IP is never stored. Used to see which versions are in use and how many projects people keep open (a number only — never names, paths or hosts). A lighter anonymous install count runs regardless; fully disable with the DO_NOT_TRACK environment variable.'
+const MACHINE_HASH_SENTENCE =
+ " If you reach the free-project limit, nodeterm checks your allowance with a one-way hash of this computer's hardware id (sent whether or not this switch is on), so the allowance stays with this machine."
+const ACTIVE: ProjectLimitState = { ...INACTIVE_PROJECT_LIMIT, active: true }
+
+/** The text the settings search sees for `query`: the section renders only rows that match. */
+async function searchFor(query: string): Promise<string> {
+ const { useProjectLimit } = await import('../../../state/projectLimit')
+ const { PrivacySection } = await import('./PrivacySection')
+ const { SettingsSearchContext } = await import('../context')
+ await act(async () => {
+ await useProjectLimit.getState().hydrate()
+ })
+ act(() =>
+ root.render(
+ <SettingsSearchContext.Provider value={query}>
+ <PrivacySection isActive={false} />
+ </SettingsSearchContext.Provider>
+ )
+ )
+ return host.textContent ?? ''
+}
function consentSwitch(): HTMLButtonElement | null {
return host.querySelector(`button[role="switch"][aria-label="${CONSENT_LABEL}"]`)
@@ -68,17 +97,27 @@ describe('Privacy → telemetry row', () => {
})
it('says the count is a number only, and how to fully disable', async () => {
- expect(await renderSection()).toContain(
- 'No personal data; client IP is never stored. Used to see which versions are in use and how many projects people keep open (a number only — never names, paths or hosts). A lighter anonymous install count runs regardless; fully disable with the DO_NOT_TRACK environment variable.'
- )
+ expect(await renderSection()).toContain(TELEMETRY_DESCRIPTION)
})
- it('says a one-way hash of the hardware id is used if the free-project limit is reached', async () => {
- // Spec §6: the machine hash is a new stable identifier, so the privacy copy names it — appended
- // to the same description, after the DO_NOT_TRACK sentence.
- expect(await renderSection()).toContain(
- 'fully disable with the DO_NOT_TRACK environment variable. If you reach the free-project limit, nodeterm checks your allowance with a one-way hash of this computer\'s hardware id, so the allowance stays with this machine.'
- )
+ it('while the limit is off, the description is exactly the one before the limit existed', async () => {
+ await renderSection()
+ expect(host.querySelector('p')?.textContent).toBe(TELEMETRY_DESCRIPTION)
+ })
+
+ it('while the limit is on, names the one-way hash of the hardware id, sent whatever this switch says', async () => {
+ // The machine hash is a stable identifier a claim sends, so the privacy copy names it — appended
+ // to the same description, after the DO_NOT_TRACK sentence. It rides the claim, not the
+ // telemetry toggle, and the sentence says so because it sits under that switch.
+ limitState = ACTIVE
+ expect(await renderSection()).toContain(TELEMETRY_DESCRIPTION + MACHINE_HASH_SENTENCE)
+ })
+
+ it('follows the limit switching on without a remount', async () => {
+ await renderSection()
+ expect(host.textContent).not.toContain(MACHINE_HASH_SENTENCE.trim())
+ act(() => pushLimit!(ACTIVE))
+ expect(host.textContent).toContain(TELEMETRY_DESCRIPTION + MACHINE_HASH_SENTENCE)
})
})
@@ -94,10 +133,29 @@ describe('Privacy → license checks under DO_NOT_TRACK', () => {
const text = await renderSection()
expect(text).toContain(CONSENT_LABEL)
expect(text).toContain(CONSENT_DESCRIPTION)
+ // While the limit is off nothing on the row speaks of it.
+ expect(text).not.toMatch(/allowance|free-project/)
// Off by default: no consent until the user gives it.
expect(consentSwitch()?.getAttribute('aria-checked')).toBe('false')
})
+ it('names the free-project allowance only while the limit is on', async () => {
+ limitState = { ...ACTIVE, dnt: true }
+ const text = await renderSection()
+ expect(text).toContain(CONSENT_DESCRIPTION_ACTIVE)
+ expect(text).not.toContain(CONSENT_DESCRIPTION)
+ })
+
+ it('a search for the limit finds nothing while it is off, and the row once it is on', async () => {
+ limitState = { ...INACTIVE_PROJECT_LIMIT, dnt: true }
+ for (const q of ['allowance', 'projects']) expect(await searchFor(q)).not.toContain(CONSENT_LABEL)
+ // The neutral words still find it.
+ expect(await searchFor('license')).toContain(CONSENT_LABEL)
+
+ limitState = { ...ACTIVE, dnt: true }
+ for (const q of ['allowance', 'projects']) expect(await searchFor(q)).toContain(CONSENT_LABEL)
+ })
+
it('follows a pushed state change without a remount', async () => {
await renderSection()
expect(consentSwitch()).toBeNull()
diff --git a/src/renderer/components/settings/sections/PrivacySection.tsx b/src/renderer/components/settings/sections/PrivacySection.tsx
index 070c9c92f..656e27821 100644
--- a/src/renderer/components/settings/sections/PrivacySection.tsx
+++ b/src/renderer/components/settings/sections/PrivacySection.tsx
@@ -5,6 +5,7 @@ import { SearchableRow } from '../SearchableRow'
import { FieldRow } from '../FieldRow'
import { Switch } from '@renderer/ui/Switch'
+const CONSENT_KEYWORDS = ['privacy', 'license', 'pro', 'do not track', 'dnt', 'consent', 'network']
const ROWS = {
telemetry: {
title: 'Send anonymous usage data',
@@ -12,27 +13,52 @@ const ROWS = {
},
licenseConsent: {
title: 'Allow license checks while DO_NOT_TRACK is set',
- keywords: ['privacy', 'license', 'pro', 'do not track', 'dnt', 'consent', 'network', 'allowance', 'projects']
+ keywords: CONSENT_KEYWORDS
+ },
+ /** The same row while the free-tier project limit is on: only then is it also about the allowance. */
+ licenseConsentLimit: {
+ title: 'Allow license checks while DO_NOT_TRACK is set',
+ keywords: [...CONSENT_KEYWORDS, 'allowance', 'projects']
}
}
// The consent row exists only while DO_NOT_TRACK is set, and so does its search entry: a query for
// "license" must not open this section onto a row that is not there.
const ENTRIES = [ROWS.telemetry]
const DNT_ENTRIES = [ROWS.telemetry, ROWS.licenseConsent]
+const DNT_LIMIT_ENTRIES = [ROWS.telemetry, ROWS.licenseConsentLimit]
+
+// While the limit is off the section reads exactly as before the limit existed; the machine-hash
+// sentence and the allowance wording are shown only while it is on. The hash rides a claim, not the
+// telemetry toggle, so the sentence under that switch says so.
+const TELEMETRY_DESCRIPTION =
+ 'No personal data; client IP is never stored. Used to see which versions are in use and how many projects people keep open (a number only — never names, paths or hosts). A lighter anonymous install count runs regardless; fully disable with the DO_NOT_TRACK environment variable.'
+const MACHINE_HASH_SENTENCE =
+ " If you reach the free-project limit, nodeterm checks your allowance with a one-way hash of this computer's hardware id (sent whether or not this switch is on), so the allowance stays with this machine."
+const CONSENT_DESCRIPTION =
+ 'Lets nodeterm contact api.nodeterm.dev for license checks only. Telemetry and the announcement feed stay off.'
+const CONSENT_DESCRIPTION_LIMIT =
+ 'Lets nodeterm contact api.nodeterm.dev for Pro and your free-project allowance only. Telemetry and the announcement feed stay off.'
export function PrivacySection({ isActive }: { isActive: boolean }): React.JSX.Element {
const telemetryEnabled = useSettings((s) => s.settings.telemetryEnabled)
const licenseNetworkConsent = useSettings((s) => s.settings.licenseNetworkConsent)
const update = useSettings((s) => s.update)
- // Core's DO_NOT_TRACK fact (spec §7.4). Never true on the Server Edition, whose stub answers the
- // inactive state: that shell has no license layer to consent to.
+ // Core's DO_NOT_TRACK fact, and whether the limit is on. Both are false on the Server Edition,
+ // whose stub answers the inactive state: that shell has no license layer to consent to.
const dnt = useProjectLimit((s) => s.state.dnt)
+ const limitOn = useProjectLimit((s) => s.state.active)
+ const consentRow = limitOn ? ROWS.licenseConsentLimit : ROWS.licenseConsent
return (
- <SettingsSection id="privacy" title="Privacy" isActive={isActive} searchEntries={dnt ? DNT_ENTRIES : ENTRIES}>
+ <SettingsSection
+ id="privacy"
+ title="Privacy"
+ isActive={isActive}
+ searchEntries={dnt ? (limitOn ? DNT_LIMIT_ENTRIES : DNT_ENTRIES) : ENTRIES}
+ >
<SearchableRow {...ROWS.telemetry}>
<FieldRow
label="Send anonymous usage data (version/OS, open-project count)"
- description="No personal data; client IP is never stored. Used to see which versions are in use and how many projects people keep open (a number only — never names, paths or hosts). A lighter anonymous install count runs regardless; fully disable with the DO_NOT_TRACK environment variable. If you reach the free-project limit, nodeterm checks your allowance with a one-way hash of this computer's hardware id, so the allowance stays with this machine."
+ description={limitOn ? TELEMETRY_DESCRIPTION + MACHINE_HASH_SENTENCE : TELEMETRY_DESCRIPTION}
control={
<Switch
checked={telemetryEnabled}
@@ -43,10 +69,10 @@ export function PrivacySection({ isActive }: { isActive: boolean }): React.JSX.E
/>
</SearchableRow>
{dnt ? (
- <SearchableRow {...ROWS.licenseConsent}>
+ <SearchableRow {...consentRow}>
<FieldRow
label="Allow license checks while DO_NOT_TRACK is set"
- description="Lets nodeterm contact api.nodeterm.dev for Pro and your free-project allowance only. Telemetry and the announcement feed stay off."
+ description={limitOn ? CONSENT_DESCRIPTION_LIMIT : CONSENT_DESCRIPTION}
control={
<Switch
checked={licenseNetworkConsent === true}