Skip to content

fix(cli): suppress verbose lock generation messages in generate-metadata#8357

Merged
rubenfiszel merged 3 commits intomainfrom
fix-cli-dirty-output
Mar 13, 2026
Merged

fix(cli): suppress verbose lock generation messages in generate-metadata#8357
rubenfiszel merged 3 commits intomainfrom
fix-cli-dirty-output

Conversation

@pyranota
Copy link
Contributor

@pyranota pyranota commented Mar 13, 2026

out

Improves generate-metadata command output by:

  1. Suppressing verbose lock generation messages that were cluttering the output
  2. Showing inline script names that were updated on the same line as the progress

Before

  [4/5] app    u/admin/testrawapp__raw_app
  Generating lock for runnable a (bun)
          }
    Written a.yaml, a.ts and a.lock
  [5/5] app    u/admin/ttt__raw_app
  Generating lock for runnable a (bun)
          }
    Written a.yaml, a.ts and a.lock

After

[4/5] app u/admin/testrawapp__raw_app: a
[5/5] app u/admin/ttt__raw_app: a

Multiple inline scripts are shown comma-separated:

[4/5] app u/admin/my_app: a, b, c
[5/5] flow u/admin/my_flow: step1, step2

Changes

  • Pass noStaleMessage flag through to internal lock generation functions
  • Add AppLocksResult and FlowLocksResult types to track updated scripts
  • Return list of updated inline script names from lock generation functions
  • Display updated script names inline with progress output

Pass noStaleMessage flag through to updateRawAppRunnables and
updateAppInlineScripts to suppress verbose "Generating lock for..."
messages when running generate-metadata command. Also fixes a stray
`}` character in a template literal.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 13, 2026

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7350308
Status: ✅  Deploy successful!
Preview URL: https://2006cb98.windmill.pages.dev
Branch Preview URL: https://fix-cli-dirty-output.windmill.pages.dev

View logs

@claude
Copy link
Contributor

claude bot commented Mar 13, 2026

Claude finished @pyranota's task in 2m 39s —— View job


PR Review: fix(cli): suppress verbose lock generation messages in generate-metadata

  • Read the diff and changed file
  • Analyze code quality and correctness
  • Post review feedback

Summary

This PR correctly threads the noStaleMessage parameter through to updateRawAppRunnables and updateAppInlineScripts, which were the only two functions in the app metadata pipeline that weren't respecting this flag. It also fixes a genuine bug — a stray } character in a template literal that was being included in the log output.

Findings

Bug fix (template literal) — Good catch

The original code had:

`Generating lock for runnable ${runnableId} (${language})
        }`

This produced output like Generating lock for runnable foo (typescript)\n } — the closing brace and whitespace were part of the string. The fix correctly collapses this to a single line.

noStaleMessage propagation — Correct and consistent

The noStaleMessage pattern is already used throughout the codebase (flow_metadata.ts, metadata.ts, generate-metadata.ts). This PR fills the gap in updateRawAppRunnables and updateAppInlineScripts where the flag was not being passed through. The implementation is consistent with how other functions handle it.

No issues found. The changes are minimal, focused, and follow established patterns. Error messages (log.error) are correctly left unconditional — only informational progress messages are suppressed.

Verdict

LGTM — clean, focused fix. No bugs, no security concerns, no performance issues.

Reproduction instructions

Run wmill generate-metadata in a workspace that contains apps with inline scripts. Before this fix, the command would output verbose "Generating lock for..." and "Written ..." messages for each inline script in apps. After this fix, those messages are suppressed, resulting in cleaner CLI output. Also verify that error messages still appear if a lock generation fails.

@pyranota pyranota marked this pull request as draft March 13, 2026 15:33
Display inline script names that were relocked when processing flows
and apps in the generate-metadata command output. For example:

  [4/5] app    u/admin/test__raw_app: a, b, c

This provides visibility into what work was done without verbose
per-script logging that clutters the output.

- Add AppLocksResult and FlowLocksResult types to track updated scripts
- Update internal functions to return lists of updated script names
- Display script names inline with progress in generate-metadata

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@pyranota pyranota marked this pull request as ready for review March 13, 2026 16:14
@claude
Copy link
Contributor

claude bot commented Mar 13, 2026

Claude finished @pyranota's task in 1m 35s —— View job


PR Review: fix(cli): suppress verbose lock generation messages in generate-metadata

  • Read the PR diff and changed files
  • Analyze code quality, correctness, and patterns
  • Post review feedback

Summary

This PR correctly threads the noStaleMessage flag through to updateRawAppRunnables and updateAppInlineScripts — the two app-related functions that were missing it. It also adds a nice UX improvement by showing updated inline script names inline with the progress output, and fixes a template literal bug (stray } in a multiline string).

Findings

Template literal bug fix — Good catch

The original code in updateRawAppRunnables had:

`Generating lock for runnable ${runnableId} (${language})
        }`

This produced output with a stray } and extra whitespace. Correctly fixed to a single-line string.

noStaleMessage propagation — Correct and consistent

The pattern is already used throughout the codebase. This PR fills the gap in updateRawAppRunnables and updateAppInlineScripts. Error messages (log.error) are correctly left unconditional.

Return type changes — Sound but with one minor concern ⚠️

The return types Promise<string | AppLocksResult | void> and Promise<string | FlowLocksResult | void> are union types that rely on the caller knowing which variant they'll get based on the parameters passed. In generate-metadata.ts, the as FlowLocksResult | void and as AppLocksResult | void casts are safe given the known parameters (dryRun=false), but they're still type assertions that bypass the compiler. A discriminated union or overloaded signatures would be more type-safe, but this is a minor concern — the current approach is pragmatic and consistent with how the rest of the CLI code is written.

Frontend scripts correctly excluded

In updateAppInlineScripts, frontend scripts are excluded from updatedScripts tracking (line 594-597), which is correct since they don't generate locks.

changedScripts scope change in flow_metadata.ts — Correct

Moving changedScripts declaration from inside the if (!justUpdateMetadataLock) block to outside it is necessary for the new return statement. When justUpdateMetadataLock is true, changedScripts remains empty, which correctly results in an empty updatedScripts array in the return value.

Progress output ordering

The log line is now printed after the work completes (moved after the await), which means the script names can be included. This is a subtle but good change — it means the user sees the final state rather than a "starting" message.

Verdict

LGTM — clean, focused fix. No bugs, no security concerns, no performance issues. The changes are minimal, well-structured, and follow established patterns in the codebase.

Reproduction Instructions

To verify these changes, use the Windmill CLI with a workspace that contains apps (both raw and normal) and flows with inline scripts. Run wmill generate-metadata and observe the output. Before this fix, verbose "Generating lock for..." and "Written ..." messages would appear for each inline script in apps. After this fix, those messages are suppressed and replaced with a single progress line per resource that includes the names of updated inline scripts (e.g., [4/5] app u/admin/my_app: a, b, c). Also verify that error messages still appear if a lock generation fails, and that running the command when metadata is already up-to-date still shows the appropriate "up-to-date, skipping" messages.


@rubenfiszel rubenfiszel merged commit 51933be into main Mar 13, 2026
10 of 14 checks passed
@rubenfiszel rubenfiszel deleted the fix-cli-dirty-output branch March 13, 2026 20:32
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants