Skip to content

fix: propagate compiler diagnostics to playground - #35

Merged
salaheldinsoliman merged 1 commit into
hyperledger-solang:developfrom
mohamedbasuony:fix/propagate-solang-errors-1898
May 17, 2026
Merged

salaheldinsoliman merged 1 commit into
hyperledger-solang:developfrom
mohamedbasuony:fix/propagate-solang-errors-1898

Conversation

@mohamedbasuony

Copy link
Copy Markdown
Contributor

Summary

Fixes #1898 by preserving Solang compiler diagnostics through the playground compile flow.

Compiler diagnostics were being reduced before reaching the UI: the backend kept only the substring after the first lowercase error: in compiler stderr, and the frontend displayed only one diagnostic field. This could hide warnings/context, multiline source spans, diagnostics without that exact marker, and useful fallback output.

What changed

  • Preserve the full ANSI-stripped compiler stderr in the backend.
  • Avoid replacing empty compiler stderr with a placeholder that would shadow useful fallback output.
  • Return a small non-secret body for backend failures instead of an empty HTTP 500 response.
  • Display compiler diagnostics in the frontend using this fallback order:
    compile_stderr > compile_stdout > stderr > stdout > generic fallback.
  • Read non-200 response body text before falling back to statusText.
  • Keep the API shape, compiler dependency, Docker image, and generated bindings unchanged.

Verification

Ran locally:

  • git diff --check
  • rustfmt --check crates/backend/src/services/compile.rs crates/backend/src/services/sandbox.rs
  • cargo test -p backend
  • cargo test
  • npm run build --workspace=packages/frontend

Manual Docker-backed check:

  • Posted an invalid contract to /compile and verified that the response preserves the compiler diagnostic text.
  • Verified multiline/source-span formatting is preserved.
  • Verified a valid compile control still succeeds.

npm run test --workspace=packages/app requires a running server at localhost:9000; without that server it fails with connection errors.

@salaheldinsoliman

Copy link
Copy Markdown
Contributor

Could you rebase the PR to develop?
We can then merge this branch to develop and then to main.

@mohamedbasuony
mohamedbasuony force-pushed the fix/propagate-solang-errors-1898 branch from 18b3581 to fb96a85 Compare May 17, 2026 16:42
@mohamedbasuony
mohamedbasuony changed the base branch from main to develop May 17, 2026 16:43
Preserve Solang compiler diagnostics from compile failures and surface them through the playground UI instead of replacing them with generic errors.

Keep successful compile behavior unchanged and preserve readable multiline diagnostic output for user-facing compiler errors.

Signed-off-by: mohamedbasuony <mohamedbasuony@aucegypt.edu>
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