Skip to content

chore: upgrade Dagster stack to 1.13#533

Merged
iamgp merged 5 commits into
mainfrom
GWP/dagster-1-13
May 31, 2026
Merged

chore: upgrade Dagster stack to 1.13#533
iamgp merged 5 commits into
mainfrom
GWP/dagster-1-13

Conversation

@iamgp
Copy link
Copy Markdown
Collaborator

@iamgp iamgp commented May 30, 2026

Summary

  • constrain Phlo's direct Dagster dependencies to the 1.13.x line and refresh the lock to Dagster 1.13.7
  • update phlo-dagster runtime run-id resolution to prefer context.run.run_id, avoiding Dagster 1.13 deprecated context access
  • add a focused regression test and changelog note for the upgrade

Validation

  • uv lock --check
  • uv run python - <<'PY' ... confirmed dagster, dagster-graphql, dagster-webserver, dagster-pipes, and dagster-shared are all 1.13.7
  • uv run pytest packages/phlo-dagster/tests/test_operations.py tests/runtime/test_orchestrator_selection.py tests/plugins/test_capabilities_runtime.py tests/plugins/test_package_dependency_declarations.py
  • uv run pytest -m integration packages/phlo-dagster/tests/test_integration_dagster.py
  • uv run pytest packages/phlo-dagster/tests
  • uv run pytest -m 'not integration'
  • uv run ruff check .
  • uv run ruff format --check .
  • uv run ty check src/phlo packages/phlo-dagster/src packages/phlo-testing/src (completed with existing warn-level diagnostics)

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features

    • Environment variable overrides now supported via .env.local files in test harness configuration.
  • Chores

    • Updated Dagster-related dependencies to version 1.13.
  • Tests

    • Enhanced test coverage for environment variable handling, run ID resolution, and partition key safety checks.

Walkthrough

Pins Dagster dependencies to 1.13 minor range, changes DagsterRuntime.run_id to read from context.run.run_id with tests, makes BundledStackHarness.read_env merge .phlo/.env.local over .phlo/.env, and adds defensive partition_key resolution plus tests in Trino publishing.

Changes

Dagster integration and dependency updates

Layer / File(s) Summary
DagsterRuntime.run_id refactor and validation
packages/phlo-dagster/src/phlo_dagster/adapter.py, packages/phlo-dagster/tests/test_integration_dagster.py
DagsterRuntime.run_id now reads the run id from context.run.run_id. Integration tests added/updated to validate reading from the nested run object.
Dagster version constraint updates
packages/phlo-dagster/pyproject.toml, packages/phlo-testing/pyproject.toml, pyproject.toml
Dagster-related dependencies (dagster, dagster-graphql, dagster-webserver) are updated to the >=1.13,<1.14 constraint across package and root pyproject files.

BundledStackHarness env merging

Layer / File(s) Summary
read_env merges .env and .env.local
packages/phlo-testing/src/phlo_testing/profile_harness.py, packages/phlo-testing/tests/test_profile_harness.py
BundledStackHarness.read_env() reads .phlo/.env then overlays values from .phlo/.env.local when present; a unit test verifies that local values override base values and that non-overridden keys are preserved.

Trino publishing partition-key guards

Layer / File(s) Summary
Partition-key resolution and tests
packages/phlo-trino/src/phlo_trino/publishing.py, packages/phlo-trino/tests/test_publishing.py
_publish_marts now uses _resolve_partition_key(context) which returns None for explicitly unpartitioned runs and otherwise returns a non-empty partition_key; tests construct an unpartitioned context, assert correlation.partition_key is None on emitted events, and verify _resolve_partition_key propagates runtime-specific errors.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: upgrade Dagster stack to 1.13' accurately summarises the primary change—upgrading Dagster dependencies from 1.12.1 to the 1.13.x line across the project.
Description check ✅ Passed The description is directly related to the changeset, detailing the Dagster upgrade objectives, validation steps performed, and the reasoning for the run-id resolution changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch GWP/dagster-1-13

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 and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 30, 2026

Cairn Quality Report

Commit: d7b4e43 · View full report

Checker Status ✅ Passed ❌ Failed Items
ruff passed 0 0 0
ruff-format pass 0 0 1
pytest-3.11 passed 1043 0 1044
pytest-3.12 passed 1043 0 1044

@iamgp iamgp marked this pull request as ready for review May 30, 2026 10:19
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/phlo-dagster/tests/test_integration_dagster.py (1)

136-149: ⚡ Quick win

Consider adding test coverage for the fallback path.

The new test validates that run_id is read from context.run.run_id. To ensure complete coverage of the refactored logic in adapter.py, consider adding a test case where context.run.run_id is not available and the code falls back to context.run_id.

🧪 Suggested additional test case
def test_dagster_runtime_reads_run_id_fallback():
    """DagsterRuntime should fall back to context.run_id when run object lacks run_id."""
    from phlo_dagster.adapter import DagsterRuntime

    context = SimpleNamespace(
        run=SimpleNamespace(tags={}),  # run object exists but no run_id
        run_id="fallback-run-id",
        has_partition_key=False,
        log=SimpleNamespace(),
        resources=SimpleNamespace(),
    )

    runtime = DagsterRuntime(context=cast(AssetExecutionContext, context))
    assert runtime.run_id == "fallback-run-id"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/phlo-dagster/tests/test_integration_dagster.py` around lines 136 -
149, The test suite covers the path where DagsterRuntime reads run_id from
context.run.run_id but misses the fallback path; add a new test similar to
test_dagster_runtime_reads_run_id_from_run_object that constructs a context with
run present but without run_id (e.g., run=SimpleNamespace(tags={})) and with
context.run_id set (e.g., "fallback-run-id"), instantiate
phlo_dagster.adapter.DagsterRuntime with that context and assert runtime.run_id
== "fallback-run-id" to validate the fallback branch in DagsterRuntime.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/phlo-dagster/tests/test_integration_dagster.py`:
- Around line 136-149: The test suite covers the path where DagsterRuntime reads
run_id from context.run.run_id but misses the fallback path; add a new test
similar to test_dagster_runtime_reads_run_id_from_run_object that constructs a
context with run present but without run_id (e.g., run=SimpleNamespace(tags={}))
and with context.run_id set (e.g., "fallback-run-id"), instantiate
phlo_dagster.adapter.DagsterRuntime with that context and assert runtime.run_id
== "fallback-run-id" to validate the fallback branch in DagsterRuntime.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2b38e08a-ed2d-45ad-b8b6-3fccb04f5e93

📥 Commits

Reviewing files that changed from the base of the PR and between 965eb62 and 19e3810.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • packages/phlo-dagster/pyproject.toml
  • packages/phlo-dagster/src/phlo_dagster/adapter.py
  • packages/phlo-dagster/tests/test_integration_dagster.py
  • packages/phlo-testing/pyproject.toml
  • pyproject.toml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: python / package tests (platform)
  • GitHub Check: python / package tests (data)
  • GitHub Check: python / core tests (3.11)
  • GitHub Check: python / core tests (3.12)
  • GitHub Check: frontend / observatory
  • GitHub Check: docs / build
  • GitHub Check: integration / required suites
🔇 Additional comments (5)
packages/phlo-testing/pyproject.toml (1)

10-11: LGTM!

pyproject.toml (2)

45-46: LGTM!


124-125: LGTM!

packages/phlo-dagster/pyproject.toml (1)

11-11: Check repo compatibility with dagster-graphql>=1.13,<1.14 (Dagster 1.13 breaking GraphQL-adjacent removals).
Dagster 1.13 removed/changed several GraphQL-related APIs/deprecated parameters that may affect this codebase, including: external_asset_from_spec / external_assets_from_specs, deprecated deps support as a single-AssetKey argument (use AssetDep objects), Definitions.get_all_asset_specs, @observable_source_asset legacy freshness/auto-observe parameters, AssetsDefinition.legacy_freshness_policies_by_output_name, and ComponentLoadContext.load_component_at_path / build_defs_at_path. Scan the repo for these symbols/usages and update call sites if any are present.

packages/phlo-dagster/src/phlo_dagster/adapter.py (1)

179-184: Dagster 1.13 run_id access pattern is aligned.

AssetExecutionContext.context.run_id is deprecated in favour of context.run.run_id; packages/phlo-dagster/src/phlo_dagster/adapter.py now prefers self.context.run.run_id when available and safely falls back to self.context.run_id (returning None if neither exists).

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/phlo-trino/tests/test_publishing.py (1)

346-353: 💤 Low value

The current test already forces the partition_key access; the has_partition_key=True tweak is only for clarity.

_resolve_partition_key only short-circuits to None when context.has_partition_key is False. If has_partition_key is missing (as in _ContextWithProviderError), it still reads context.partition_key, so the RuntimeError propagates and the “does not swallow” intent is already exercised.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/phlo-trino/tests/test_publishing.py` around lines 346 - 353, Test
already triggers partition_key access but is unclear; update the
test_resolve_partition_key_does_not_swallow_runtime_specific_errors to make
intent explicit by adding a has_partition_key attribute set to True on the
_ContextWithProviderError test class so that publishing._resolve_partition_key
will not short-circuit and will attempt to read partition_key (thereby letting
RuntimeError propagate). Locate the test and the _ContextWithProviderError class
and add has_partition_key = True to it so the behavior and intent are
unambiguous.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/phlo-trino/tests/test_publishing.py`:
- Around line 346-353: Test already triggers partition_key access but is
unclear; update the
test_resolve_partition_key_does_not_swallow_runtime_specific_errors to make
intent explicit by adding a has_partition_key attribute set to True on the
_ContextWithProviderError test class so that publishing._resolve_partition_key
will not short-circuit and will attempt to read partition_key (thereby letting
RuntimeError propagate). Locate the test and the _ContextWithProviderError class
and add has_partition_key = True to it so the behavior and intent are
unambiguous.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f7a624f2-5df9-454f-bd76-3ad3f04e6fbd

📥 Commits

Reviewing files that changed from the base of the PR and between d30f083 and 3068bc8.

📒 Files selected for processing (4)
  • packages/phlo-dagster/src/phlo_dagster/adapter.py
  • packages/phlo-dagster/tests/test_integration_dagster.py
  • packages/phlo-trino/src/phlo_trino/publishing.py
  • packages/phlo-trino/tests/test_publishing.py
📜 Review details
🔇 Additional comments (5)
packages/phlo-dagster/src/phlo_dagster/adapter.py (1)

176-179: LGTM!

packages/phlo-dagster/tests/test_integration_dagster.py (1)

136-151: LGTM!

Also applies to: 160-160

packages/phlo-trino/src/phlo_trino/publishing.py (1)

365-372: LGTM!

packages/phlo-trino/tests/test_publishing.py (2)

5-6: LGTM!


303-343: LGTM!

@iamgp iamgp merged commit 1ab44f5 into main May 31, 2026
16 checks passed
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