Skip to content

fix(worker): preserve outcomes across result reporting failures - #708

Merged
jumski merged 3 commits into
mainfrom
701-worker-results
Oct 23, 2026
Merged

jumski merged 3 commits into
mainfrom
701-worker-results

Conversation

@jumski

@jumski jumski commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #701. Includes a patch changeset for @pgflow/core and @pgflow/edge-worker; the existing fixed group keeps publishable packages in sync.

handler outcome
├── success → completeTask once
└── failure → failTask once, unless the shutdown signal is aborted

telemetry or settlement error → worker error boundary, not another handler outcome
SQL output → preserve 0 / false / ""; null and undefined → JSON null

A successful handler still gets one completion attempt during shutdown. Settlement errors escape without replay: the RPC may already have committed. Bounded same-result replay remains outside this change (#706 after #704); in-memory results do not survive process death.

Evidence

  • Before: Completion rejection entered the handler-failure path; throwing outcome loggers could skip settlement. The new real-PostgreSQL storage tests failed all five output cases with the old implementation.
    After: All 14 executor regression tests and all five storage cases pass. Tests check handler invocation counts, settlement calls, the existing worker error boundary, and stored JSON versus SQL NULL.
  • Affected unit/type/lint/export checks pass. Full worker integration: 70 passed. Edge E2E: 13 passed. Portable Supabase/Node/Bun E2E: 14 passed. Client E2E: 47 passed. CLI installer and Node/Bun smoke checks pass.
  • Independent Sol reviews: Standards 0 findings; Spec 0 findings. The reviewed and committed source tree is unchanged.
  • Local full pgTAP had six timing failures; full core pgTAP passes in CI, including the current changeset commit. No SQL schema, performance thresholds, or test expectations changed to hide failures.
  • Open CI gate: CI run 39948915258 at ad67fd95618a0ae385e061e2e634043441f1e77d fails build-and-test, edge-worker-e2e, and cli-e2e during Supabase startup: image pulls return toomanyrequests: Data limit exceeded from public ECR, before tests start. Changeset validation, core pgTAP, worker integration, portable runtime E2E, client E2E, Bun smoke, Windows smoke, and type infrastructure checks pass.
  • The earlier run also found CI Sqruff drift: CI installs latest (0.43.0) while the local checked version is 0.39.0. Running the repository SQL lint target with 0.43.0 reproduces five LT01: Unexpected whitespace before start square bracket. violations in unchanged schema files. This remains unresolved; no rules were disabled and no unrelated schema changes were added.

Merge Danger

Door: two-way

Code-only change; no schema changes, migrations, or dependencies. A code revert does not undo task outcomes already stored.

Blast Radius: workers

Shared Edge, Node, and Bun task execution and SQL output serialization. Review-ready, but not merge-ready until all CI checks pass. User approved the review and requested merge through Graphite only after green CI; merge and worktree cleanup remain blocked.

Telemetry or completion RPC errors previously entered the handler-failure path. Separate execution from one-shot settlement, surface logging and acknowledgement errors through the worker boundary, and classify interruption from the shutdown signal instead of the exception name.

Use nullish output handling and SQL coalesce because postgres.js binds sql.json(null) as SQL NULL. Preserve valid falsy values and normalize nullish results to JSON null, with actual-storage integration coverage.

Affected unit, type, lint, export, integration, Edge/Node/Bun runtime, client E2E, and CLI installer checks pass. Both Sol review axes report no findings. The full core pgTAP gate remains open: six existing input-assembly timing assertions fail in the full run; the single focused reproduction passes all eleven assertions. No performance thresholds or schema code changed.

Refs #701
@changeset-bot

changeset-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a7ec425

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@pgflow/core Patch
@pgflow/edge-worker Patch
pgflow Patch
@pgflow/client Patch
@pgflow/dsl Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

jumski commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@nx-cloud

nx-cloud Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit a7ec425

Command Status Duration Result
nx run edge-worker:e2e ✅ Succeeded 3m 33s View ↗
nx run edge-worker:e2e:portable-runtimes ✅ Succeeded 2m 22s View ↗
nx run core:pgtap ✅ Succeeded 2m 49s View ↗
nx affected -t verify-exports --base=origin/mai... ✅ Succeeded 5s View ↗
nx affected -t build --configuration=production... ✅ Succeeded 3s View ↗
nx affected -t lint typecheck test --parallel -... ✅ Succeeded 2m 40s View ↗
nx run cli:e2e ✅ Succeeded 3s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-10-23 13:27:06 UTC

Agent added 2 commits October 23, 2026 13:49
Record patch releases for the core SQL client and shared worker fixes in #701. Keep the fixed package group in sync and describe the falsy-output, shutdown, and one-shot settlement behavior in release notes.
CI installs Sqruff 0.43.0, which rejects whitespace before array brackets in four existing schema files. Run pnpm nx fix-sql core with the CI version to clear the five LT01 violations without changing SQL behavior.

Checked pnpm nx lint:sqruff core with Sqruff 0.43.0 and git diff --ignore-all-space --exit-code; both pass.

jumski commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Oct 23, 4:24 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Oct 23, 4:24 PM UTC: @jumski merged this pull request with Graphite.

@jumski
jumski merged commit f67145b into main Oct 23, 2026
24 of 29 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Production Deployment: Website

✅ Successfully deployed to production!

🔗 Production URL: https://pgflow.dev

📝 Details:

  • Commit: f67145b0174e414351b15d4987969572a1d6505a
  • View Logs

Deployed at: 2026-10-23T18:24:33+02:00

This branch was successfully deployed

1 active deployment
preview — a7ec425b Deployed Oct 23, 2026 by jumski via deploy-website #3420
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.

Fix shared worker result boundaries, falsy outputs, and shutdown classification

1 participant