Skip to content

Improve Excel2SBOL conversion error reporting#357

Closed
Gonza10V wants to merge 1 commit into
masterfrom
codex/implement-user-friendly-excel2sbol-errors-gkny07
Closed

Improve Excel2SBOL conversion error reporting#357
Gonza10V wants to merge 1 commit into
masterfrom
codex/implement-user-friendly-excel2sbol-errors-gkny07

Conversation

@Gonza10V

@Gonza10V Gonza10V commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Motivation

  • Provide users with a friendly, actionable error message when Excel2SBOL conversion fails while still returning full technical output for developers in the same API response.
  • Avoid additional endpoints or calls and keep successful conversion behaviour unchanged.
  • Redact likely sensitive environment values from any returned terminal output or traceback.

Description

  • Backend: wrap the Excel2SBOL/XDC invocation in contextlib.redirect_stdout/redirect_stderr, classify common exceptions (FileNotFoundError, KeyError, ValueError, fallback) and return a single JSON error payload with status: "error", error.code, error.message, error.hint, error.details, and error.technical_details containing terminal_output and traceback; add a redact_sensitive_values helper to replace configured env values with [REDACTED].
  • Backend: log the exception server-side via existing app.logger.exception and preserve existing success responses unchanged.
  • Frontend: add a compact ConversionError renderer and showUploadErrorNotification/showConversionErrorNotification helpers that initially show only the friendly message and hint with a local More / Hide details toggle that reveals technical_details from the already-returned response without further network calls.
  • Tests: add a backend test that simulates ValueError from the XDC constructor to assert the JSON shape, presence of technical_details, and that redaction removed the secret value.

Testing

  • Ran python -m py_compile backend/sbs_server/app/views.py to validate syntax, which succeeded.
  • Ran the new backend pytest (pytest backend/tests/test_excel2sbol_errors.py) but collection failed in this environment due to missing runtime dependency (ModuleNotFoundError: No module named 'flask'), so the test could not be executed here.
  • Built the frontend with npm run build (Vite) which completed successfully (build warnings about large chunks but no errors).

Codex Task

Comment on lines +86 to +98
return jsonify({
"status": "error",
"error": {
"code": classified["code"],
"message": classified["message"],
"hint": classified["hint"],
"details": redact_sensitive_values(str(exc)),
"technical_details": {
"terminal_output": redact_sensitive_values(terminal_output),
"traceback": redact_sensitive_values(traceback.format_exc()),
},
},
}), classified["status"]

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7d04f14ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

except AttributeError as e:
os.remove(metadata_path)
return jsonify({"error": str(e)}), 400
with contextlib.redirect_stdout(stdout_buffer), contextlib.redirect_stderr(stderr_buffer):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid process-wide stdout redirection during uploads

When the backend runs with a threaded Flask/Wsgi worker, contextlib.redirect_stdout/redirect_stderr replaces the process-wide sys.stdout and sys.stderr for the entire duration of this potentially long XDC upload. Any concurrent request or background task that prints/logs to these streams during that window will be captured into this user's technical_details response, which can leak unrelated output and also hide it from server logs. Prefer a conversion-local logging/capture mechanism, or avoid returning global stdout/stderr capture from a request handler.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://witty-hill-08172a210-357.centralus.5.azurestaticapps.net

@Gonza10V Gonza10V closed this Jun 6, 2026
@Gonza10V Gonza10V deleted the codex/implement-user-friendly-excel2sbol-errors-gkny07 branch June 6, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants