Firebase-managed Functions v2: retained-revision rollback and fencing old writers

We use Node.js/TypeScript functions deployed through the Firebase CLI (2nd gen, backed by Cloud Run). Some invocations spawn child processes and write shared application data. We are planning an execution-ownership/cleanup update and want to establish a safe rollout and recovery procedure before changing production.

The Cloud Run traffic migration documentation says in-flight requests continue, and a request timeout is not proof that its code or child processes have stopped. We therefore distinguish blocking new admission from isolating already-running writers.

Questions:

  1. For Firebase-managed 2nd-gen functions, is routing back to a retained Cloud Run revision a supported recovery path? What documented prerequisites or read-only checks establish that a retained revision is usable and compatible with Firebase management? How does this differ from redeploying prior source, which can produce a new image?
  2. Is there a supported, observable way to establish that old invocations and their child processes have terminated or can no longer write shared state after a rollout? Which signals are sufficient, and which are not?
  3. If platform-level evidence cannot establish this, what application-level fencing pattern is recommended? In particular, a new-version guard cannot retroactively protect writes from old code that never checks it. How should that transition be handled?

We are looking for documented behavior and recommended procedures, not a request to modify any resources. No outage is being reported. Project identifiers, resource names, logs, and credentials are intentionally omitted.

References:

Related unanswered discussions I found before posting:

My specific focus is the supported Firebase-managed rollback path together with a safe transition when old writers do not implement fencing.

Follow-up: narrowing the remaining question to legacy-writer isolation.

We have now exercised exact retained-revision traffic pinning through the Cloud Run Admin API for one Firebase-deployed 2nd-gen function, while retaining its prior revision/image. This was a configuration/readiness and unauthenticated-health check; it does not prove that all old executions stopped, establish authenticated end-to-end recovery, or guarantee indefinite artifact retention.

The unresolved transition involves Node.js handlers that can spawn engine child processes and write shared Realtime Database state, account progression, and rewards. The legacy code does not check a fencing epoch. A paused Scheduler is an admission control, not evidence that an old invocation is alive or terminated.

Could someone point to a supported, documented procedure for these specific questions?

  1. Is there an API or platform event that establishes termination of an exact old invocation and its child processes? If not, what data-preserving mechanism can deterministically prevent those already-admitted writers from writing shared state while the main application stays online? Please distinguish enforcement on existing Admin SDK connections and cached credentials from blocking new requests.
  2. If application-level fencing is required, how should the first transition be bootstrapped when the legacy writers never check that fence? Adding a guard only to the new version cannot retroactively protect old code. We are looking for a safe migration sequence, not lease deletion or assuming termination after a timeout.
  3. For that procedure, what prerequisites and retention limits apply to recovery using an exact retained revision/image, and how can recovery avoid re-enabling an unfenced old writer?

The manual-scaling documentation says disabling a service allows in-flight requests to finish and does not disable revisions addressed only by traffic tags. The container shutdown contract describes SIGTERM followed by SIGKILL after shutdown starts; we have not found a documented signal that an arbitrary configuration change initiates and completes shutdown of every relevant execution.

References:

No project identifiers, resource names, logs, or credentials are included. This is a request for documented behavior and a recommended migration procedure, not a request to modify resources.