Skip to content

fix(webapp): refactor dev server URL detection @W-21331028@#30

Merged
deepu-mungamuri94 merged 4 commits intomainfrom
fix/refactor-dev-server-url-detection
Mar 4, 2026
Merged

fix(webapp): refactor dev server URL detection @W-21331028@#30
deepu-mungamuri94 merged 4 commits intomainfrom
fix/refactor-dev-server-url-detection

Conversation

@deepu-mungamuri94
Copy link
Copy Markdown
Collaborator

What does this PR do?

Refactors dev server URL detection from brittle stdout parsing to a configuration-driven approach:

  • Configuration-first URL resolution: Dev server URL is now resolved from --url flag, dev.url in manifest, or default http://localhost:5173 (no stdout parsing)
  • Adds dev.port to manifest: Optional proxy port in webapplication.json; precedence: --port flag > dev.port in manifest > default 4545
  • Verification via polling: Uses HEAD requests to verify URL reachability instead of parsing framework-specific log output (Vite, CRA, Next.js)
  • JSON line contract for extension: CLI emits {"url":"..."} to stderr when ready, so the VS Code extension can parse a single structured line instead of regex on human messages
  • Fail-fast on process error: When dev server process crashes, fails immediately instead of waiting for timeout
  • Improved error context: Includes parsed error reason, suggestions, and last dev server output in timeout/error messages

What issues does this PR fix or reference?

@W-21331028@

Functionality Before

  • DevServerManager parsed stdout/stderr using framework-specific regex patterns (Vite, CRA, Next.js, generic)
  • Framework log format changes (e.g., Vite 6 output) could break URL detection
  • Extension parsed stdout for "Ready for development!" and URL regex patterns; message changes in plugin could break extension
  • Fallback to http://localhost:4545 on timeout

Functionality After

  • Dev URL resolved from config or default; no stdout parsing
  • Single JSON line contract {"url":"..."} — human messages can change without breaking extension
  • URL verification via polling (HEAD request) instead of trusting process output
  • Fail-fast on process crash; no fallback URL on timeout
  • Optional dev.port in manifest for proxy port configuration

@deepu-mungamuri94 deepu-mungamuri94 requested a review from a team as a code owner February 27, 2026 06:01
@deepu-mungamuri94 deepu-mungamuri94 changed the title fix(webapp): refactor dev server URL detection fix(webapp): refactor dev server URL detection @W-21331028@ Feb 27, 2026
@deepu-mungamuri94 deepu-mungamuri94 force-pushed the fix/refactor-dev-server-url-detection branch from 9dae8b9 to 78b0adf Compare March 3, 2026 06:15

## Configuration

### webapplication.json Schema
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like these changes may be removing existing content that still holds value. Please review the updates carefully and ensure that nothing is unintentionally overwritten, and that new changes are incorporated appropriately alongside the existing content.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Since we restructured the url detection flow, we made changes to doc. I think we have the upto date doc with recent changes.

Any issues identified thats not inline or removed which supposed to be there ?

Copy link
Copy Markdown
Collaborator

@amritmishra-sf amritmishra-sf Mar 3, 2026

Choose a reason for hiding this comment

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

For example,

The webapplication.jsonfile is **optional**. All fields are also optional - missing fields use defaults.
got removed, ideally it should still be there or the text updated to mention that it is mandated not removed at al.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nothing major, just few minor updates. I want to ensure we don't remove stuff that is still valid.

Copy link
Copy Markdown
Collaborator Author

@deepu-mungamuri94 deepu-mungamuri94 Mar 4, 2026

Choose a reason for hiding this comment

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

That is still there: https://github.com/salesforcecli/plugin-app-dev/blob/78b0adffabc5f0aeab0e954a727adf5c1c93b0e9/SF_WEBAPP_DEV_GUIDE.md#webapplicationjson-schema. I’ve refactored the document to remove duplicate information and improve the overall flow from the reader’s perspective.

@deepu-mungamuri94 deepu-mungamuri94 force-pushed the fix/refactor-dev-server-url-detection branch from c2be0f7 to f8e981b Compare March 4, 2026 05:08
Copy link
Copy Markdown
Collaborator

@amritmishra-sf amritmishra-sf left a comment

Choose a reason for hiding this comment

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

LGTM

@deepu-mungamuri94 deepu-mungamuri94 merged commit 276bddd into main Mar 4, 2026
15 checks passed
@deepu-mungamuri94 deepu-mungamuri94 deleted the fix/refactor-dev-server-url-detection branch March 4, 2026 07:09
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.

3 participants