Skip to content

Conversation

@alkaline-0
Copy link
Contributor

@alkaline-0 alkaline-0 commented Nov 29, 2025

Problem

When a pipeline runs with dev_mode=True, its dataset_name is suffixed with a unique pipeline_instance_id. On subsequent runs with dev_mode=False, the suffix could persist via restored state, causing:

  1. Confusing dataset naming (dev suffix remains in non-dev runs)
  2. Inconsistent behavior across attaches/initializations
  3. State/schema mismatches after local wipes

Suggested solution

  1. We persist a _local["dev_mode"] flag to detect the toggle and decide the reset early.
  2. Dev→non-dev is now a “hard reset”: we wipe the pipeline working directory and start from a clean state.
  3. After reset, we recompute dataset_name as if it were the first initialization, without the dev suffix.

Implementation details

Add dev_mode to TPipelineLocalState.
Hard reset on dev→non-dev
In _configure, If _local["dev_mode"] was True and current self.dev_mode is False:

  • Wipe the working dir (_create_pipeline).
  • Replace the injected in-memory state (if available) with default_pipeline_state() to reflect a true fresh start.
  • recompute dataset_name (non-dev), then save.

Issues

solves #3276

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 29, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
docs eff8cc5 Commit Preview URL

Branch Preview URL
Nov 30 2025, 04:30 PM

- Introduced `dev_mode` attribute in TPipelineLocalState to track development mode status.
- Implemented logic to recreate initial pipeline state when toggling between dev and non-dev modes.
- Updated dataset name generation to ensure consistency based on the current mode.
- Added tests to verify dataset name behavior in different modes.
@alkaline-0 alkaline-0 force-pushed the fix/3276-maintain-dataset-name-consistency-in-relation-to-dev-mode branch from 1af9e7d to 8436348 Compare November 29, 2025 15:05
- Updated the `_recreate_initial_state` method to clear the injected state dictionary before applying default values.
- Enhanced type casting for better clarity and safety in state management.
- Added assertions in tests to verify the state is correctly reset in development mode.
@alkaline-0 alkaline-0 force-pushed the fix/3276-maintain-dataset-name-consistency-in-relation-to-dev-mode branch from e96c9f6 to 81f0653 Compare November 29, 2025 16:23
- Introduced `_get_prev_dev_mode_from_state` method to read the development mode from the raw state.json, ensuring compatibility with engine versions.
- Updated `_configure` method to utilize the new method for determining previous dev_mode status.
- Enhanced pipeline state migration to include dev_mode and initial working directory in the local state for engine version upgrades.
@alkaline-0 alkaline-0 force-pushed the fix/3276-maintain-dataset-name-consistency-in-relation-to-dev-mode branch from 57d02a6 to 2294535 Compare November 29, 2025 17:40
@alkaline-0 alkaline-0 force-pushed the fix/3276-maintain-dataset-name-consistency-in-relation-to-dev-mode branch 2 times, most recently from c702c51 to 5e729c9 Compare November 30, 2025 16:19
@alkaline-0 alkaline-0 force-pushed the fix/3276-maintain-dataset-name-consistency-in-relation-to-dev-mode branch from 5e729c9 to eff8cc5 Compare November 30, 2025 16:22
@alkaline-0 alkaline-0 marked this pull request as ready for review November 30, 2025 19:20
@alkaline-0 alkaline-0 requested a review from rudolfix December 1, 2025 10:03
@rudolfix rudolfix requested a review from djudjuu December 8, 2025 13:49
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.

2 participants