pulsegrid / Help

Pulse Grid operational handover

Configuration and deployment

The selected GCP project is studio-1756082860-99acd. Existing PM Grid is Firebase App Hosting backend studio, backed by Cloud Run in us-central1, and the (default) Firestore database in nam5. Pulse Grid staging uses a separate service and pulsegrid-staging database in the same project. PulseGrid production can launch alongside the original PMGrid using service/database pulsegrid-production and runtime identity pulsegrid-production-runtime. Legacy PMGrid remains on studio and (default). Moving its existing projects still requires the migration procedure below; staging never writes to either production database.

Build with Node 24, npm ci, npm run typecheck, npm test, and npm run build. The Dockerfile packages Next.js standalone output. infra/cloudbuild.yaml builds, checks, pushes a versioned Artifact Registry image and deploys Cloud Run. The GitHub workflow checks branches and supports explicitly selected staging/production environments with Workload Identity Federation. Configure environment identities and repository variables before enabling automatic release promotion.

Deploy jobs serialize by environment. After deploying the image, Cloud Build explicitly promotes traffic to the latest revision: Cloud Run can otherwise retain a revision pinned during a rollback. The pilot restores the original traffic mode and confirms the expected revision is active. Wait for release jobs to finish before an operator rollback rehearsal.

Public Firebase app values are build arguments. GOOGLE_CLOUD_PROJECT, PULSEGRID_ORIGIN and PULSEGRID_DATABASE_ID are runtime configuration. PULSEGRID_ORIGIN must be the exact HTTPS public origin so OAuth metadata, redirect issuer and token resources agree. Configure Google sign-in and add the service hostname to Firebase Authentication authorized domains. Use the runtime service identity for Firestore and Firebase account checks. Keep Stripe API and webhook secrets in separate Pulse Grid Secret Manager entries. Existing PM Grid Gemini and Mailgun secrets are not required.

Parallel PulseGrid production

python3 infra/bootstrap-production.py prints the isolated resource plan. --apply provisions the named production database with PITR and deletion protection, daily backups retained for 30 days, server-only rules/indexes, a dedicated runtime identity, two empty live-billing secrets and a private service placeholder for CI. Runtime database permission is limited to the new database; its secret access is limited to the two production entries. The production GitHub environment supplies its own service, database, origin and CLOUD_RUN_RUNTIME_SERVICE_ACCOUNT; workflow preflight rejects staging or legacy targets for a production dispatch.

Authorize the actual service hostname in Firebase Authentication before browser sign-in. Deploy from the reviewed PulseGrid branch with an explicit workflow_dispatch selecting production; no merge to the existing App Hosting main branch is needed for this parallel release. Keep checkout closed until the live product/price, independently issued runtime key, portal configuration and webhook are validated and mounted. Never mount live secrets on staging.

Schema and existing records

The existing Firebase App Hosting backend follows main. Before merging, coordinate its rollout configuration, product origin, server identity and database with the migration; a merge is not a safe substitute for this cutover.

  1. Freeze legacy writes and create an export of the source Firestore database to an approved, access-controlled backup bucket. Record the export location and the existing service revision. Never log source content or credentials.
  2. Run npm run migrate -- <workspaceId> <projectId> without --apply. Review the planned principal mapping, task ordering and source links. Normalized legacy email keys are lossy: resolve them to actual account UIDs before applying. Do not guess a recipient.
  3. Run with --apply against the intended database. Each task reference and counter advance commit together. The process can restart without assigning another number. Keep taskNumberMappings and compare record IDs, original event/block links, assignments and audit counts against the export.
  4. Migration preserves unknown legacy closure as legacy_unknown; it does not manufacture historical verification. Missing source records remain unavailable, with links retained.
  5. Deploy server-only client rules and collection-group indexes in the target database. The new web app and MCP use the same service boundary. The old browser-write application cannot operate under these rules; switch application and rules as one planned cutover.

The CLI currently refuses unresolved principal mappings. Back up and review all changes before running it on existing customer data. The old permissions, boolean status, block content and taskLog fields are retained for additive compatibility; the Pulse Grid service uses explicit grants, revisions, structured states and append-only activity.

Billing

The confirmed launch offer is AUD 29 per personal seat per month, with a one-calendar-month free trial available during November and December 2026. PULSEGRID_LAUNCH_START=2026-11-01T00:00:00+10:00 is inclusive and PULSEGRID_LAUNCH_END=2027-01-01T00:00:00+10:00 is exclusive. Cloud Build and .env.example carry these Brisbane-time boundaries. Activations snapshot the policy and expiry; the window ending never shortens an existing trial. Calendar arithmetic uses Brisbane dates and clamps month-end dates. The baseline trial outside the window stays 14 days.

Configure a dedicated Pulse Grid Stripe price with amount 2900, currency aud, and monthly recurring interval. Staging requires a Stripe test-mode price. Checkout requires the API key, webhook secret, product ID and price ID together, verifies the provider fields, and retains an existing trial end through Stripe's trial_end, and closes new launch checkout outside the configured window. Stripe requires checkout trial ends at least 48 hours ahead; the application asks users with less remaining free time to finish that trial before subscribing, rather than charging them early. Existing subscriptions are not automatically repriced when the enrollment window closes. Later pricing and tax settings require deliberate configuration.

Pulse Grid staging has its own test product, AUD 29 monthly price, portal configuration and webhook. At the user’s direction, the existing Black Grid merchant test credential from Shadow Grid was copied securely into pulsegrid-stripe-test-key; the independent endpoint signing secret is pulsegrid-stripe-test-webhook. No live credential, Shadow Grid product, customer or licence was copied. Production requires an independently issued API credential and deliberate live settings. Mount only these two secrets on the staging runtime and set STRIPE_PRODUCT_ID, STRIPE_PRICE_ID and STRIPE_PORTAL_CONFIGURATION_ID. Keep the new webhook disabled until the matching code/configuration and signed smoke check pass; complete a provider checkout/portal/lifecycle exercise before billing acceptance. Configure webhook endpoint /api/billing/webhook for checkout completion, subscription creation/update/deletion, invoice paid and invoice failed events. Verify signatures against the raw body. The application maps the Stripe customer to one Pulse Grid user using server-created records and reconciles current subscriptions, rather than trusting incoming metadata for identity. Provider event IDs are deduplicated and retain resulting entitlement versions. With STRIPE_AUTOMATIC_TAX=true, checkout requests automatic tax, a billing address and optional tax IDs, and saves updated customer address/name for later invoices. Changing tax mode replaces an older open checkout intent instead of replaying its obsolete parameters. Verify the merchant’s registrations/settings and the selected price’s tax behavior before enabling this setting. A payment never creates a project grant. Unknown merchant customers are acknowledged without changing entitlements. Checkout stores one durable per-user intent and uses Stripe idempotency to recover retries and lost responses; existing nonterminal subscriptions, including trials, block a second subscription. Customer mappings are checked in both directions before checkout or portal access. Subscription reconciliation filters the Pulse Grid product and metadata, allowing later prices for the same product without losing existing subscriptions.

Investigate delayed events by comparing the customer’s current subscription with the local entitlement, then run reconciliation. Reconciliation should run under an operational identity and be monitored; the schedule and failure thresholds are launch settings. Do not delete trial history to make payment retries pass. Live charges and prices remain disabled until configured. Viewer sign-in is independent of billing.

Monitoring and recovery

Inspect Cloud Run request errors, authorization failure codes, version conflicts, lease contention, import results and billing event records. Correlate with source revision labels and structured activity; do not include tokens, source documents or unnecessary personal information in logs. Define alert thresholds from representative measurements before launch. Cloud Run can scale without process-local OAuth state or locks.

Run python3 infra/configure-observability.py to reconcile the staging dashboard and application failure counter. The dashboard shows request response classes, revision latency, active instances and controlled failure codes, including MCP semantic errors returned over HTTP 200. Application failure logs contain only a reason code and status. Use the durable activity records to investigate individual imports, claims and billing reconciliations. Alert thresholds and notification recipients remain launch settings.

An interrupted import or handoff is retried with the exact idempotency key and payload. Records, links, counter advances, closure and essential audit commit atomically. Reconnecting clients use get_changes or a fresh board. Old lease holders must re-read and cannot overwrite a successor. An unavailable cache cannot lose committed work because there is no authoritative cache.

For a bad application release, move traffic to the last verified Pulse Grid revision whose schema is compatible. Additive migrations support forward recovery; do not point the old browser-write PM Grid UI at new server-only rules as a rollback shortcut. For a data restore, use a new database first, verify task-number mappings and source relationships, invalidate or advance every live lease before accepting work, and revoke restored OAuth connections/tokens so old refresh state cannot be replayed. Keep existing permanent references; do not recycle numbers.

Backups, deleted-revision retention, account deletion and data residency commitments need explicit launch configuration. Shared-source revocation prevents future reads, not copies already exported. Test a restore and a service rollback on staging before production promotion. Record timings and evidence in the release record.

The operator-only scripts/verify-restore.ts rehearsal requires PULSEGRID_DATABASE_ID=pulsegrid-staging. It generates synthetic application records, creates two fresh pulsegrid-restore-* databases, performs a managed export/import, compares every restored application field, invalidates restored claims and connections, and checks the recovered relationships and number allocation through the shared service. Successful runs delete both test databases. Its dedicated bucket contains only synthetic exports and automatically deletes them after seven days; this is separate from the production backup policy. A failed run retains its synthetic databases for diagnosis. Never use production records as fixture input.

scripts/verify-deployed.ts checks fresh-account HTTP/OAuth/MCP behavior. scripts/verify-pilot-rollout.ts adds teams, external viewing, shared context, trial expiry and real traffic rollback. Both require PULSEGRID_TEST_ORIGIN and a public Firebase configuration file through PULSEGRID_TEST_FIREBASE_CONFIG. The pilot also requires explicit staging database intent and the reviewed compatible PULSEGRID_ROLLBACK_REVISION. Run it after deployments settle; it restores the active revision and removes its synthetic accounts and documents in cleanup. Review revision compatibility before future rehearsals.

The rollback target must retain the launch offer as well as the data schema. The pilot compares public offer policy and the existing trial expiry across revisions. Operator fixture expiry uses the scoped Python REST helper; Node's direct connection to the Firestore API times out on the development host. Cleanup reads independent synthetic branches in parallel, then deletes only selected fixture records in bounded batches. It also removes fixture-only OAuth registration metadata.

Fresh-account checks need the operator to sign synthetic Firebase custom tokens through the runtime service identity. Grant the operator Token Creator on that service account only for the acceptance run, then remove the binding. The GitHub workload identity requires no such operator binding. Local development defaults to the named staging database in .env.example; choose the production database explicitly only during the reviewed cutover.

Release gates

Run a multi-user pilot with internal teams, a free external viewer, one collaborator across workspaces and multiple personal connections. Verify email and transcript creation, shared context and revocation, lease takeover, comments, completion and transfer, trial expiry, interrupted retries, signed billing events, recovery and desktop/tablet/phone journeys. Complete fresh Claude and Codex OAuth setup using the published guide and record tested client versions. A successful build alone is not release acceptance.

Custom production hostname

Production is served at https://pulse.blackgrid.com.au; its MCP endpoint is https://pulse.blackgrid.com.au/mcp. The Cloud Run PULSEGRID_ORIGIN and GitHub production environment variable use that canonical origin. Firebase Authentication authorizes the hostname.

python3 infra/configure-domain.py prints the plan; --apply provisions an isolated global external Application Load Balancer with a serverless NEG for pulsegrid-production, a reserved IPv4 address, managed certificate for pulse.blackgrid.com.au, TLS 1.2 minimum and HTTP-to-HTTPS redirect. This uses standard Google Cloud load-balancer billing. The app and data remain on the existing serverless service. No VM is provisioned.

GoDaddy hosts the authoritative DNS for blackgrid.com.au. Add an A record named pulse, value 136.68.73.211, TTL 600 seconds. Do not add a conflicting CNAME or an unrelated AAAA record. The configured managed certificate is pulsegrid-production-cert-v2. The setup script records public resource identifiers in /tmp/pulsegrid-domain-resources.json; it deliberately leaves the app origin unchanged. Wait for public DNS and certificate status ACTIVE, verify the custom HTTPS route, then update Firebase Authentication authorized domains, PULSEGRID_ORIGIN on the service and GitHub production environment, published connection instructions and billing return/webhook URLs. Reconnect MCP clients against the new canonical origin. When repeating a cutover, keep the previous canonical origin until those checks pass. Existing production MCP clients should reconnect using the custom hostname.

The DataBlock picker uses list_data_blocks with a destination project scope, an optional title search and a bounded result limit. It queries the blockShares.destinationProjectId collection-group index, filters the destination workspace and current active grant, and returns only available revisions and permitted live-read information. Source membership alone does not reveal blocks. Provision that index on both PulseGrid databases before deploying the lookup. Actual attachment and reads recheck grants, so a revoked search result does not authorize a later write.

App installation and browser icons

Next.js file metadata supplies favicon.ico (16/32/48 px), icon.svg and the 180 px Apple touch icon. /manifest.webmanifest declares a standalone PulseGrid app with relative origin-scoped identity, 192/512 px PNG icons and a separate maskable icon. The Docker runtime copies public/ so icon, service-worker and offline assets are present in Cloud Run.

PwaProvider registers /sw.js and exposes a browser-triggered Install app action. Installation remains browser-controlled; accepted/dismissed prompts and installed display mode are handled without repeated prompts. The account panel also gives browser/iOS installation guidance. The service worker pre-caches only the static offline document and public PNG icons, uses network navigation with a reconnect fallback, and bypasses API/OAuth/MCP/discovery requests. It never caches successful navigation responses or project data. Bump its public-cache version when offline branding assets change. Existing application drafts are independent of this cache.

Google sign-in on the custom hostname

Production builds set NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=pulse.blackgrid.com.au through the production GitHub FIREBASE_AUTH_DOMAIN variable. This is separate from the server's PULSEGRID_ORIGIN. Production CI requires both values to match the canonical hostname, preventing a fallback to Firebase or Cloud Run addresses. The shared Google web OAuth client retains its original origins/redirects and additionally authorizes https://pulse.blackgrid.com.au and https://pulse.blackgrid.com.au/__/auth/handler. Firebase Authentication also authorizes the custom host.

Next.js transparently proxies /__/auth/* to the project's Firebase Hosting sign-in helpers, following Firebase's documented reverse-proxy pattern. The upstream is fixed to the Firebase project host to prevent a proxy loop after the public auth domain changes. /__/firebase/init.json returns only the explicit public Firebase web configuration, with no-store caching. The service worker bypasses the entire /__/ namespace. The project's _Default log sink excludes PulseGrid auth-helper request URLs and proxy diagnostics because callback URLs can contain OAuth parameters; other application request/error logs remain available.