feat: script module mode with CLI sync, preview, and WAC UI improvements#8380
Draft
rubenfiszel wants to merge 20 commits intomainfrom
Draft
feat: script module mode with CLI sync, preview, and WAC UI improvements#8380rubenfiszel wants to merge 20 commits intomainfrom
rubenfiszel wants to merge 20 commits intomainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add prominent comments explaining that all computation must happen inside task/step/taskScript or it will be replayed on resume/retry. Clarify that waitForApproval does not hold a worker and that approve/reject URLs are available in the timeline step details. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts: # frontend/package-lock.json # frontend/package.json
…nd preview support - Fix pull→push idempotency: use `??` instead of `||` for module lock field so empty strings are preserved (matches API's `lock: ""`) - Add per-module hash tracking in wmill-lock.yaml following the flow inline script pattern (SCRIPT_TOP_HASH + per-module subpath hashes) - Selective module lock regeneration: only regenerate locks for modules whose content actually changed, not all modules - Use unfiltered rawWorkspaceDependencies for module hashes to match what updateModuleLocks passes to fetchScriptLock - Show changed module names in stale script output for clarity - Add module support to `script preview` command: read modules from __mod/ folder and pass them in the preview API request - Add preview tests for taskScript pattern (flat and folder layout) - Update test assertion for module stale detection output Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ename, import consolidation - Reorder WAC template buttons: TypeScript before Python in ScriptBuilder, CreateActionsScript, and CreateActionsFlow - Remove dropdown items from +Script button (simplify to direct link) - Move "Import Workflow-as-Code" to +Flow dropdown with dedicated drawer - Add module tab rename: pencil icon on hover opens popover with validation, fixed-width icon container prevents layout shift Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolve conflicts: - cli/src/commands/script/script.ts: keep both isRawAppPath and module filters - frontend/package.json: keep local parser wasm paths - frontend/package-lock.json: regenerated from main + local deps - Restore backend/.sqlx cache from main - Add isScriptModulePath filter to unified generate-metadata command Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Backend parser updates for WAC detection - CLI sync/types updates for raw app path and module support - Frontend UI polish (Dev.svelte, ScriptRow, script hash page) - Test fixture updates Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Deploying windmill with
|
| Latest commit: |
a4cb9c9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://824e3bce.windmill.pages.dev |
| Branch Preview URL: | https://module-mode.windmill.pages.dev |
…adata Verifies that modifying a single module file re-triggers stale detection and only the changed module is listed, not all modules. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix hardcoded dev path in bun_executor.rs WAC v2 wrapper — use "windmill-client" import instead of absolute filesystem path - Fix missed no_main_func → auto_kind rename in parser TS test - Add modules column to clone_script SQL (windmill-common and windmill-api-workspaces) so cloned scripts retain their modules - Add modules: None to RawCode structs in worker tests - Restore complete sqlx cache (merge main's cache + our new queries) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Change `.clone()` on double reference to `*k` dereference in scripts.rs hash implementation. Update sqlx cache with new query hashes from modified clone_script SQL. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The local file:// paths for windmill-parser-wasm-py and windmill-parser-wasm-ts don't exist in the Cloudflare Pages build environment. Revert to published npm versions (1.655.0). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use newly published windmill-parser-wasm-ts and windmill-parser-wasm-py v1.657.2 which include auto_kind/WAC detection changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ackages Regenerating package-lock.json from scratch pulled different dependency versions causing svelte-check type errors. Instead, start from main's lockfile and only update the two changed packages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Script<SR> struct has a modules field (FromRow), but fetch_script_for_update didn't SELECT modules, causing a runtime error "no column found for name: modules" when the worker processed dependency jobs. This was the root cause of the relock_skip test timeout. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces script module mode — a foundational feature that allows Windmill scripts to have companion module files, enabling the Workflow-as-Code (WAC) pattern where scripts can reference task modules via
taskScript("./helper.ts").Script Module System
__mod/folder, supporting two layouts:my_script.ts+my_script__mod/helper.tsmy_script__mod/script.ts+my_script__mod/helper.tsmodulesJSONB column on thescripttableCLI: Sync Pull/Push
readModulesFromDisk()/writeModulesToDisk()handle reading/writing module files from__mod/folderslock: lock ?? undefinedpreserves empty strings (API returnslock: ""for modules without deps)handleScriptMetadata()detects folder layout viaisModuleEntryPoint()CLI: Per-Module Hash Tracking
wmill-lock.yaml(following the flow inline script pattern)SCRIPT_TOP_HASHmeta-hash combines main script hash + sorted module hashescomputeModuleHashes()walks the__mod/folder and hashes each module's content + workspace depsupdateModuleLocks()accepts optionalchangedModulesparameter for selective lock regenerationf/test/my_script (bun) [changed modules: helper.ts]CLI: Preview with Modules
wmill script previewreads modules from__mod/and passes them in therunScriptPreviewAndWaitResultAPI callCLI: Unified generate-metadata
isScriptModulePath && !isModuleEntryPoint) so they're not treated as standalone scriptsBackend:
auto_kindRefactorno_main_func: bool→auto_kind: VARCHAR(20)on thescripttableNULL(normal script),"lib"(library/no main),"wac"(workflow-as-code)workflow()+task()patterns in TypeScript and Pythonno_main_func = truerows toauto_kind = 'lib'Backend: WAC v2 Execution
WorkflowCtx,StepSuspend,setWorkflowCtxfromwindmill-clientwmill.workflow()/wmill.task()decoratorsFrontend: WAC UI
task(),taskScript(),step(),sleep(),waitForApproval()w-[32px]) prevents layout shift on hoverKey Files Changed
windmill-types/src/scripts.rsauto_kindfield,ScriptModulestruct, hash implwindmill-api-scripts/src/scripts.rsauto_kindin create/updatebun_executor.rs,python_executor.rs,worker.rswindmill-parser-ts,windmill-parser-py20260313000000_script_auto_kind.up.sqlcli/src/commands/script/script.tsreadModulesFromDisk, preview, push/pullcli/src/utils/metadata.tscli/src/commands/generate-metadata/ScriptEditor.svelteScriptBuilder.svelteCreateActionsFlow.svelte,CreateActionsScript.svelteTest plan
bun test test/script_modules.test.ts— module sync unit testsbun test test/resource_folders_unit.test.ts— path utility testsbun test test/unified_generate_metadata.test.ts— metadata generation including module modification detectionbun test test/sync_pull_push.test.ts— sync round-trip testsbun test test/preview.test.ts— preview with modules (flat + folder layout)cargo check --features zipwith-D warnings— clean compilationsvelte-check— 0 errors in changed fileswmill sync pull→wmill sync pushproduces 0 changes for scripts with moduleswmill generate-metadataonly regenerates that module's lockwmill script previewworks with WAC scripts that have modules🤖 Generated with Claude Code