The problem
Our optional-apps catalog lists the Frappe apps a site can add on top of ERPNext. Each entry had one switch, offer. When it’s true, customers see the app in their portal and can ask for it. When it’s false, nobody can install it through us.
On October 20 we wanted something in between. We wanted Frappe CRM and Helpdesk installed on erp.infinary.io, our own site, so we could use them ourselves before offering them to anyone else. The catalog had no state for “staff can install it, customers can’t see it”.
The tempting shortcut
The obvious change was a third value: offer: true | false | 'staff'.
We didn’t do that. Every customer path in the control plane reads offer, and most of them read it as a truthiness test:
FRAPPE_APPS.filter((o) => o.offer)'staff' is truthy. Any customer path we forgot to update would treat a staff-only app as offered, and list it to customers. The mistake would fail open, and we’d only find out when a customer saw an app they shouldn’t.
What we did instead
A second flag, staffInstall, next to offer, default false. A staff-only app is offer: false, staffInstall: true.
offer: falsekeeps meaning exactly what it meant: customers can’t see the app or ask for it. Every customer route refuses a staff-only app with the same422 APP_NOT_OFFEREDit gives an app we don’t offer. That covers a direct install, a request to install or remove, and inventory.- Only the two staff paths read the new flag: the staff install route, and approving a request.
- A missed check fails closed. Any code that doesn’t know about
staffInstallseesoffer: falseand hides the app.
Staff see the app in a read-only “Optional apps” panel on the instance page, labelled “Staff only”. When we’re ready to offer CRM and Helpdesk to customers, it’s a one-line change per app.
A dependency that would have frozen updates
Helpdesk 1.31.0 declares required_apps = ["telephony"]. The sidecar already installs Telephony first, in the same job, with one snapshot, one maintenance window and one rollback. Telephony itself stays offer: false, staffInstall: false: it’s only ever installed as Helpdesk’s dependency, and the staff route refuses it on its own.
While wiring that up we found a subtler gap. We have a rule that no new image may reach a site unless it carries every app the site has installed; otherwise an update would remove an app from under its data. So the install check now also requires the site’s running and approved images to carry everything the app requires. Without that, an approved image without Telephony would have stopped every later update to a site with Helpdesk.
Where it stands
The control plane change merged with 11 new tests, 702 in all, and we checked both views in the browser against a local control plane. The staff view listed Frappe HR, CRM and Helpdesk, the last two marked “Staff only”. The customer view listed only Frappe HR. Helpdesk went onto our own site the same day, and its first job promptly failed without a trace; that’s the next note.
Not done yet: removing a staff-only app has no portal path. Today that’s a manual staff operation.
What we’d tell someone else
When you add a state to a boolean that many places read, add a new field instead. The old readers keep their old meaning, and the ones you forget stay safe.