Skip to content

fix(build): stop collapsing primitive provisioning status to a shared boolean (#1044) - #1048

Merged
developer-ainative merged 1 commit into
mainfrom
fix/1044-primitive-status-collapsed
Oct 9, 2026
Merged

developer-ainative merged 1 commit into
mainfrom
fix/1044-primitive-status-collapsed

Conversation

@developer-ainative

Copy link
Copy Markdown
Contributor

Summary

Addresses the product owner's request tonight to surface real primitive-provisioning status in the UI. Investigation found the mechanism already mostly exists — the Live dashboard's Business Systems grid has a real Live/Planned badge, and the registry already stores genuine per-primitive provisioning flags written independently at provision time. The bug was that several primitives were never actually reading their own flag.

Beyond the 3 primitives #1044 named (ZeroInvoice/ZeroCommerce/OpenCapStack), found 2 more instances of the same bug class:

  • ZeroPipeline was reported as "already correctly wired" in the original issue, but was actually `pipelineLive = Boolean(opts.pipelineProvisioned) || zdb` — the `|| zdb` fallback meant ANY company with a ZeroDB project showed ZeroPipeline as Live regardless of the real flag. Confirmed live: `GET /api/build/systems?companyId=silo` returned `ZeroPipeline: true` from that fallback, not real provisioning.
  • Five primitives hardcoded to `false` (ServiceOS, ZeroVoice, Live Streaming, Social Graph, ZeroDB) despite all having genuine registry flags, behind a stale comment claiming "no per-company data yet."

Fix

Scoped wiring only — no new backend work, no schema changes, no new registry fields. Every value was already stored and already fetched; this just threads it through correctly via a named, documented `PROVISIONING_FLAG_BY_PRIMITIVE` map.

Important — visible behavior change, by design

This will make some production badges flip from Live to Planned. Companies whose ZeroDB project exists but whose individual primitive flags were never written (likely common — those are typically only set when a signed-in founder was present at provision time) will now correctly show Planned where they previously, incorrectly, showed Live. This is the honest, correct outcome the product owner asked for, but it's a visible UI change worth being aware of rather than being surprised by.

Test plan

  • `npx vitest run tests/lib/business-systems-per-primitive-provisioning.test.ts tests/lib/business-systems.test.ts tests/api/systems-per-primitive-provisioning-1044.test.ts` — 28/28 pass (TDD red confirmed first: 7/10 and 5/6 failed for the right reasons against old code)
  • Full suite — 538 passed, same pre-existing failures confirmed via fresh stash comparison
  • `npx tsc --noEmit` — clean
  • Real Playwright verification against a local dev server, driving the actual `Live.tsx` grid and `SystemStatusBadge` component: screenshot confirms ZeroInvoice renders "✓ LIVE" while ZeroCommerce/OpenCapStack/ZeroPipeline correctly render "● PLANNED" for the same constructed partial-provisioning state — genuinely distinct badges, which the old code structurally could not produce
  • Reproduced the live production bug directly for comparison (`GET .../api/build/systems?companyId=silo` — all three collapsed to `true`, `primitiveProvisioning` field absent) vs. the local fixed server (field present, values distinct)

Closes #1044

…lanned badge (#1044)

The Business systems grid collapsed ZeroInvoice, ZeroCommerce and OpenCapStack
onto a single shared boolean — "does this company have any ZeroDB project at
all" (entry.zerodbProjectId) — so three different primitives rendered an
identical Live/Planned badge no matter what had actually been provisioned.
Confirmed live against production company "silo": GET /api/build/systems
returned provisioned:true for ZeroPipeline, ZeroInvoice and ZeroCommerce alike.

The per-primitive truth already existed and was already being fetched. The
route called resolveApp(companyId), read only zerodbProjectId and
pipelineProvisioned off the entry, and discarded the rest — even though
setAppProvisioned writes zeroinvoiceProvisioned, commerceProvisioned,
capstackProvisioned, serviceosProvisioned, livestreamingProvisioned and
socialgraphProvisioned independently per primitive at provision time, each
documented in the registry as its own real signal ("Absent/false = still
simulated").

Changes:
- business-systems.ts: replace the shared zdb/pipelineLive booleans with
  PROVISIONING_FLAG_BY_PRIMITIVE, mapping each system card to the registry
  field that is actually its provisioning truth. A primitive with no flag
  (Community, Context Graph, Search & Discovery, Content Workflow,
  Intent-Casting Marketplace, Browser Agent) stays honestly Planned instead
  of borrowing another primitive's state. Opts are now a named, documented
  SystemProvisioningFlags interface.
- systems/route.ts: thread every per-primitive flag off the already-fetched
  registry entry, and surface them as a primitiveProvisioning block on the
  response so the real state is inspectable rather than inferred.

Two collapse bugs beyond the three named in the issue are fixed by the same
wiring: ZeroPipeline was ORed with the shared flag (a bare ZeroDB project made
it Live without any pipeline), and ServiceOS / ZeroVoice / Live Streaming /
Social Graph / ZeroDB were hardcoded to false despite having real flags.

The shared `provisioned` response field keeps its existing meaning (the company
has its own ZeroDB project) for Live.tsx's cloud-provisioning banner.

Verified in a real browser against a local dev server: a company with only
ZeroInvoice provisioned renders ZeroInvoice as "✓ LIVE" while ZeroCommerce,
OpenCapStack and ZeroPipeline render "● PLANNED".
@developer-ainative
developer-ainative merged commit f36ce10 into main Oct 9, 2026
1 check passed
@developer-ainative
developer-ainative deleted the fix/1044-primitive-status-collapsed branch October 9, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Business systems badge shows Live/Planned per-ZeroDB-project, not per-primitive (ZeroInvoice/ZeroCommerce/OpenCapStack share one flag)

1 participant