Skip to content

Handle invalid dashboard inputs without crashing the Streamlit app #21

Description

@dipeshbabu

Priority

P2 — routine editing mistakes replace the whole operator view with an exception.

Summary

Several dashboard controls parse or execute user-controlled input during every Streamlit rerun without a validation boundary. Invalid JSON, malformed traces, or an invalid repository path raise directly from page code.

Evidence

  • Patch planning calls build_patch_plan() directly at dashboard/app.py:386-388.
  • Quality fixture uploads/text are decoded with json.loads() at lines 537-539.
  • Trace uploads are decoded and converted at lines 654-656.
  • There are no form submission boundaries or inline exception handlers around these paths.

Reproduction

On the Quality Gates page, delete one closing brace while editing the JSON text area. Streamlit reruns immediately and raises JSONDecodeError before the user can finish the edit. Similar failures occur for an invalid uploaded trace or a patch repository outside the allowed root.

Impact

A recoverable input problem disrupts the complete page, hides the original input behind an exception view, and gives no field-specific next step. This is especially disruptive on an operator dashboard handling manually uploaded artifacts.

Proposed scope

Move expensive/validated actions behind explicit forms or buttons and translate known parse/domain errors into inline, accessible feedback. Preserve the user's input so it can be corrected.

Acceptance criteria

  • Partial or malformed fixture JSON does not crash a rerun.
  • Invalid trace uploads identify schema/path errors before the store action is enabled.
  • Invalid patch repository paths show the allowed-root requirement inline.
  • Errors state what to fix and remain adjacent to the relevant control.
  • Previously entered text and selections survive validation errors.
  • Success/error status updates are accessible to assistive technology through Streamlit-supported semantics.
  • Shared parsing/validation helpers are unit tested; representative pages have Streamlit AppTest coverage.
  • Unexpected internal exceptions remain observable without exposing secrets or raw trace content to end users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcode-qualityCode quality tooling

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions