Skip to content

UN-3636 [FIX] Two OSS test fixes blocking the cloud rig integration tier#2202

Draft
chandrasekharan-zipstack wants to merge 2 commits into
mainfrom
fix/exec-serializer-stub-leak
Draft

UN-3636 [FIX] Two OSS test fixes blocking the cloud rig integration tier#2202
chandrasekharan-zipstack wants to merge 2 commits into
mainfrom
fix/exec-serializer-stub-leak

Conversation

@chandrasekharan-zipstack

@chandrasekharan-zipstack chandrasekharan-zipstack commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Two OSS test issues that block the cloud test-rig integration tier (which consumes OSS main). Independent commits — splittable if preferred.

1. Leaked sys.modules stub (test_execution_serializer)

The test stubbed workflow_manager.workflow_v2.models in sys.modules at import time and never restored it. Under pytest-xdist a worker process is shared across many tests, so the fake WorkflowExecution (no real Workflow) shadowed the real module for every later test on that workercannot import name 'Workflow' via the URLconf. Latent until the rig ran real multi-worker parallelism, then deterministic (~30 failures/run).

Fix: delete the stub — the suite runs under pytest-django (app registry loaded), so the real serializer imports directly. Deleted rather than restored-in-finally so the footgun can't be copy-pasted; it was the only sys.modules-mutating test in the backend.

2. None DB value serialized as the string "None" (get_sql_values_for_query)

Fell through to f"{value}" for None, writing the literal "None" — invalid JSON for a jsonb column (e.g. data on an errored record). test_insert_into_db_with_error_postgresql was marked xfail(strict) for exactly this; the bug is env-fragile (reproduces on some Postgres builds, XPASSes on others), which the cloud rig surfaced as a hard XPASS(strict) failure.

Fix: bind None as SQL NULL (deterministic across environments); drop the obsolete strict xfail + unused pytest import.

Verification

  • serializer test, unit tier: 9 passed
  • full integration tier, -n auto (real rig config), ×2: 0 Workflow import errors, 708 passed
  • get_sql_values_for_query({"data": None, ...})data is SQL NULL, other values unchanged
  • cloud rig integration tier now 712 passed (was 30 failed / 461 errors), lone remaining failure was this XPASS

🤖 Generated with Claude Code

test_execution_serializer stubbed workflow_manager.workflow_v2.models in
sys.modules at import time and never restored it. Under pytest-xdist the
worker process is shared across tests, so the fake WorkflowExecution (no real
Workflow) shadowed the real module for every later test on that worker, which
failed to import Workflow via the URLconf. It surfaced once the rig ran real
multi-worker parallelism.

The stub was never needed: the suite runs under pytest-django, which loads the
app registry, so the real serializer imports directly. Delete the stub (and the
os.environ / sys / types scaffolding) rather than restore it in a finally, so
the pattern can't be copied. The tests are unchanged and still DB-free (they
drive the serializer with MagicMock execution objects).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4cffee01-88c2-45fe-b787-39982ea29865

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/exec-serializer-stub-leak

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

get_sql_values_for_query fell through to f"{value}" for None, writing the
literal "None" — invalid JSON for a jsonb column (e.g. the data column on an
errored record). test_insert_into_db_with_error_postgresql was marked
xfail(strict) for exactly this; the bug is env-fragile (it reproduces on some
Postgres builds, XPASSes on others), which surfaced as a hard failure in the
cloud rig's integration tier.

Bind None as SQL NULL so the behaviour is correct and deterministic across
environments, and drop the now-obsolete strict xfail (and its unused pytest
import).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chandrasekharan-zipstack chandrasekharan-zipstack changed the title UN-3636 [FIX] Drop leaked sys.modules stub in execution serializer test UN-3636 [FIX] Two OSS test fixes blocking the cloud rig integration tier Jul 23, 2026
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant