Skip to content

rdk: Replace hardcoded blocked_flags with generic flag deduplication in deploy_rdk#11531

Open
niranjanyardi wants to merge 1 commit into
youtube:mainfrom
niranjanyardi:generic_flag_dedup_deploy_rdk
Open

rdk: Replace hardcoded blocked_flags with generic flag deduplication in deploy_rdk#11531
niranjanyardi wants to merge 1 commit into
youtube:mainfrom
niranjanyardi:generic_flag_dedup_deploy_rdk

Conversation

@niranjanyardi

@niranjanyardi niranjanyardi commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary

Replaces the hardcoded blocked_flags set in deploy_rdk.py with generic key-based CLI switch deduplication.

When launching Cobalt on device as a WPEFramework plugin, existing sbmainargs are retrieved via JSON-RPC. If --devtools or new arguments via --param (e.g. --enable-heap-profiling, --memlog=all, --trace-startup=...) are passed, appending them directly to sbmainargs can result in duplicate switches and startup parsing failures.

Rather than maintaining a hardcoded blacklisted set of switch names (blocked_flags) that must be expanded manually whenever new flags are used, this change dynamically extracts all flag keys (arg.split("=", 1)[0]) from the parameters being added and strips any pre-existing matching flags from sb_args prior to extending.

Motivation & Architecture

  • Avoids Infinite Flag Blacklists: Eliminates the need to modify deploy_rdk.py whenever someone wants to pass --v=1, --fps, --user-agent, or future profiling/tracing parameters.
  • Strict Long-Switch Scoping (--): Uses arg.startswith("--") to safely match Chromium/Cobalt double-dash switches without risking collision with negative positional arguments or non-flag parameters.

Verification

  • Verified argument filtering behavior when overriding --remote-debugging-port and --param flags.
  • Checked git branch rebased against latest origin/main.

Bug: 502702565

TAG=agy
CONV=073fedec-c1e0-47a6-bc41-c69a0d7df7ab

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Gemini Suggested Commit Message


starboard: Deduplicate flags in deploy_rdk

Update the RDK deployment script to support generic de-duplication of
command line arguments. This ensures that flags provided through
command line parameters correctly override default settings without
leaving duplicate or conflicting arguments in the final execution
string. This improvement simplifies debugging by allowing flexible
parameter overrides and includes usage examples for heap profiling.

Bug: 11531

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message

@niranjanyardi
niranjanyardi force-pushed the generic_flag_dedup_deploy_rdk branch 2 times, most recently from c4c2666 to c5ebd0e Compare July 24, 2026 02:38
@niranjanyardi niranjanyardi changed the title Generic flag dedup deploy rdk rdk: Replace hardcoded blocked_flags with generic flag deduplication in deploy_rdk Jul 24, 2026
@niranjanyardi
niranjanyardi marked this pull request as ready for review July 24, 2026 02:55
@niranjanyardi
niranjanyardi requested a review from a team as a code owner July 24, 2026 02:55

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the command-line argument handling in deploy_rdk.py to dynamically filter out existing arguments in sb_args that are overridden by new_args, replacing a hardcoded list of blocked flags. The review feedback points out two potential issues with the standard double-dash ("--") separator: first, "--" should be excluded from the override keys to prevent it from being filtered out, and second, new arguments should be inserted before the "--" separator rather than appended to the end, ensuring they are not incorrectly treated as positional arguments.

@niranjanyardi
niranjanyardi force-pushed the generic_flag_dedup_deploy_rdk branch from c5ebd0e to 51d5bcf Compare July 24, 2026 03:02
…in deploy_rdk

Instead of maintaining a hardcoded blacklisted set (blocked_flags) of CLI
switches for every new parameter passed to --param or --devtools,
dynamically extract option keys from new parameters (arg.split("=", 1)[0])
and remove any pre-existing matching flags from sbmainargs.

This avoids having to expand a hardcoded flag whitelist whenever new
runtime arguments (such as heap profiling, tracing, or debugging options)
are introduced.

Bug: 502702565

TAG=agy
CONV=073fedec-c1e0-47a6-bc41-c69a0d7df7ab
@niranjanyardi
niranjanyardi force-pushed the generic_flag_dedup_deploy_rdk branch from 51d5bcf to fe7b57d Compare July 24, 2026 03:09
@niranjanyardi
niranjanyardi requested a review from jonastsai July 24, 2026 03:15
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