Skip to content

Guardrail: stop new Pro code from landing in core #3302

Closed as not planned
3 of 3 issues completed
Closed as not planned

Description

@mstomar125

Goal

Stop new Pro or sync code from landing in nodespace-core while the existing Pro code moves out, and make every migration PR prove what it removed.

The product owner's directive (2026-09-29): everything Pro or sync related, other than turning it on, lives in nodespace-sync, and core carries no Pro logic. Pro is a separate build that uses core internally and replaces the installed app, keeping the same database. ADR-081 (proposed) records the boundary.

Context

  • Pro code is still being added to core. On 2026-09-29 alone, the tenant-admission card, its Decline/Remove actions, the stakeholder-gated collaboration controls and a refreshed copy of the Pro proto all landed here. Nothing in the repo pushes back.

  • Core already has a ratchet of the right shape. scripts/check-code-references.ts counts issue-number and docs-path references. Its real-repo test (describe("real-repo ratchet") in scripts/check-code-references.test.ts) fails when a count rises above BASELINES. It runs in bun run test:scripts (bun test scripts/), and the merge gate runs that tier on every PR (TIERS.scripts in scripts/test-gate.ts).

  • Core has no CI runner, so bun run merge is the only enforcement point. Two gaps matter for Pro code:

    • bun run test:changed skips the scripts tier for frontend-only diffs (classify in scripts/gate-scope.ts), and treats .md files, README.md included, as inert. Most Pro drift is Svelte-only.
    • The push check (.husky/pre-push runs bun run scripts/test-gate.ts) runs lint only.

    So a Svelte-only Pro change first meets a ratchet in the merge gate, a few minutes into a run that holds the machine slot. Run the Pro-boundary ratchet in the push check and before the merge slot #3300 closes that gap.

  • tenant can be ratcheted raw. Measured with the patterns in Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299, every tenant line in scope is Pro code except one lease-agreement sentence in a packages/agent test fixture, which gets a single exemption (raw count 508, counted 507).

  • An exact ratchet needs two rules before migration work starts. A planned move of existing Pro code into its own file raises a count (Move the Pro variant machine and DATABASE_SETTINGS_NODE_ID out of the generic registry files #3309 / Adopt ADR-082's contribution contract: ids, when() predicates, keyed and isolated outlets #3310 takes proNamedFiles from 16 to 18). So does any test that proves Pro code is gone, because it names what it looks for. Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299 makes the first an accepted class of raise and gives the second a convention, so neither needs a policy exception later.

Scope overview

  1. A new ratchet, scripts/check-pro-boundary.ts, and its bun test (Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299).
    • It counts 11 line markers plus the number of Pro-named files, in every git-tracked or untracked-not-ignored text file under packages/ and scripts/, plus README.md.
    • Baselines are exact and only go down. A count above its baseline fails, because that is new Pro code. A count below it also fails, because the baseline is stale. The failure prints the block to paste, so freed headroom can't be spent later.
    • Exemptions are per test file and per marker, each carries a reason, and a stale one fails.
  2. CLAUDE.md rules (Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299).
    • Pro/sync features go in nodespace-sync (ADR-081), and it lists what core may contain.
    • The three accepted raise classes and the absence-test convention.
    • Pro/sync issues are filed in nodespace-sync. The issue-management skill gets the same routing step.
  3. Run the check at git push, and in the merge gate's lint section before the machine slot (Run the Pro-boundary ratchet in the push check and before the merge slot #3300).
  4. The first pay-down (Rewrite the restrictedToMembers and member_of permission comments as storage contracts #3301). Rewrite the restrictedToMembers and member_of permission comments in core_schemas.rs as the storage contracts ADR-083 §4 defines. It is comment-only, and it exercises the lower-the-baseline workflow end to end.

#3302 changes no product behaviour. The free app, the Pro build (which compiles core's desktop app from core HEAD) and user data are unaffected. Any sub-issue rolls back with a plain revert.

Sub-issues (in order)

Key Title Size Depends on
#3299 Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule M NodeSpaceAI/nodespace-docs#88 (ADR-081)
#3300 Run the Pro-boundary ratchet in the push check and before the merge slot S #3299
#3301 Rewrite the restrictedToMembers and member_of permission comments as storage contracts S #3299, NodeSpaceAI/nodespace-docs#92 (ADR-083)

#3300 and #3301 are independent of each other.

Baselines measured at af8ddb6

These numbers are for orientation. #3299 sets its baselines from the script's own output at its base commit. The scan covered 1,400 files.

Marker Lines Files Main holders Paid down by Expected end state
proCommands: pro_* identifiers 275 25 commands/pro_sync.rs, the lib.rs handler list, update_check.rs, membership-service.ts, the add-synced / workspace-members / account-settings tests #3336, #3327, #3333, #3357 (pro_env, Pro-edition test names) 0
proSyncModule: proSync, ProSync*, pro-sync 360 33 the pro-sync store and its tests, ui-extensions(.svelte).ts and its test, account-settings, app-shell #3317 (moves it first), #3327, #3333 0
proProtocol: the Pro proto, CloudSyncService, ProClient/ProTier, the Pro Worker URLs 95 15 pro_client.rs, pro_sync.rs, the vendored proto, build.rs, refresh-pro-proto.ts, the pro-sync store #3322 (GrpcClient::channel docs), #3336, #3333, #3372 (daemon router.rs docs) 0
proEvents: pro:tier-detected, quoted sync:status/sync:error 87 16 the pro-sync store and its tests, pro_sync.rs, tauri-sync-listener #3336, #3327, #3333, #3372 0
membershipService 54 6 the membership store and service plus their tests, workspace-members-card #3327, #3333 0
editionBranching 122 25 proto/src/socket.rs, daemon_setup.rs, the daemon's main.rs, grpc_client.rs, postinstall, tauri.pro.conf.json #3357 (most), #3336, #3362 (README), #3372 (doc comments) 0, except NODESPACE_FORCE_COMMUNITY in the community pre-install guard if ADR-084 §5 keeps it in core (raise class 1)
cloudBindState: bound_tenant*, sync_enabled, auth_status, and their camelCase forms 322 42 node_service/mod.rs, behaviors/mod.rs, core_schemas.rs, database_manager.rs, the ui-extensions test, labs-flags #3345, #3327, #3333, #3362 (Labs syncEnabled) 0, unless ADR-083 keeps a field under these names
cloudSyncHooks: apply_remote_embeddings, embeddings_modified_since, get_multi_membership_edges 15 6 the embedding store and service, sqlite_store/mod.rs, collection_service.rs #3345 0, or ADR-083's neutral names
cloudWording: Supabase, RLS, pgvector, nodespace-sync, "Pro daemon" 89 46 doc comments across core, the daemon and the app; the vendored proto #3301, #3372, #3336, #3345 0
tenantWording 507 (raw 508) 37 pro_sync.rs, the add-synced dialog and its test, the vendored proto, database_manager.rs, node_service/mod.rs #3336, #3327, #3333, #3345, #3372 0
proWording: the word "Pro", excluding chip and model names 314 78 spread across the app, core docs, the installer and the README #3301, then #3336 through #3372 only raise-class-1 lines: the ADR-084 entry-point copy and the installer and CLI guard messages
proNamedFiles 16 n/a #3336: nodespace_pro.proto, pro_sync.rs, pro_client.rs, refresh-pro-proto.ts. #3357: tauri.pro.conf.json. #3333: 11 pro-*, first-pro-consent-* and pro-relogin-* sources and tests #3336, #3333, #3357 (#3309 / #3310 first raises it to 18) 0

Rules every #3322–#3372 sub-issue follows

These apply to every sub-issue from the moment #3299 is on main. The filing pass adds the standard line to each #3322–#3372 sub-issue body.

Standard acceptance line. It is unconditional and goes in every #3322–#3372 sub-issue:

- [ ] Ran `bun run scripts/check-pro-boundary.ts` and pasted the printed `BASELINES` block into `scripts/check-pro-boundary.ts`; the check exits 0. Every count this change lowers is lowered, and every count it raises is listed in the PR description (marker, old → new, lines from `--changed`) under an accepted raise class.

Accepted raise classes. Never raise a baseline to land Pro code. Only the three classes below may raise one. The PR description names the class, each raised marker (old → new) and the lines.

  1. The core side of the ADR-084 upgrade flow.
  2. A fix to Pro code that has not moved to nodespace-sync yet. Prefer a net-zero edit.
  3. A planned relocation of Pro code already in core, by a Turn the UI-extension registry into ADR-082's build-time frontend extension API #3317–Remove Pro edition branching from the core app, daemon, CLI and installer #3357 sub-issue, that adds no behaviour.

A false positive gets a narrow checker fix instead: a pattern change or an EXEMPTIONS entry, with a test. Never a raise.

Absence-test convention. A test whose job is to assert that Pro code is absent must not contain the marker it looks for. It has two options:

  • build its needle from fragments, for example ["pro", "tier"].join("_"), new RegExp(["ten", "ant"].join(""), "i") or concat!("--edi", "tion");
  • in a test file where fragments are impractical, get a per-file, per-marker EXEMPTIONS entry with its reason.

Known cases:

Sub-issue Test Marker it would add
#3318 contract test proEvents
#3324 tenant_demo fixture cloudBindState
#3348 / #3349 --edition tests editionBranching
#3361 guard regex tenantWording, proWording

#3371's final zero is reachable only under this convention.

Parent acceptance criteria

  • scripts/check-pro-boundary.ts exists, bun run test:scripts enforces it, and its baselines equal the real counts on main.
  • A PR that adds a Pro marker fails at git push and in the merge gate, and the failure names the offending line.
  • A PR that removes a Pro marker fails until it lowers the baseline. The failure prints the block to paste, and pasting it changes only the numbers that moved.
  • Fragment-built needles count 0. Exemptions are per test file and per marker, carry a reason, and fail when stale.
  • CLAUDE.md states "Pro/sync features go in nodespace-sync (ADR-081)", what core may contain, the three accepted raise classes and the absence-test convention.
  • CLAUDE.md's Finding Tasks section and the issue-management skill both route Pro/sync issues to nodespace-sync.
  • The restrictedToMembers and permission comments in core_schemas.rs state ADR-083 §4's storage contracts without naming a consumer, and the baselines they paid down are lowered.
  • No product behaviour changed. The free app, the Pro build and every core test behave exactly as before.

Dependencies

Filing notes


Plan key: C1 (pro-boundary DAG).

🤖 Generated with Claude Code

Sub-issues

Sub-issues

3 of 3 Issues completed
Loading 3 sub-issues

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