Skip to content

fix: tolerate malformed session parts during rendering #330

Description

@jack-champagne

Important

Problem — Opening or re-rendering some Amicode sessions can crash the client with Cannot read properties of undefined (reading 'startsWith') when persisted session data contains a malformed tool part or file-tab entry.
Approach — Make the session receipt and file-tab normalization boundaries tolerate missing or non-string values, preserving valid entries while treating malformed data as non-renderable. Add regression coverage for both persisted-data shapes.
Scope — in: session rendering guards and regression tests · out: migration or deletion of existing user session data
Assumptions — Persisted session records may outlive the current schema and must not be trusted as fully typed UI input.

Acceptance Criteria

  • A malformed tool part without a string tool name does not crash session rendering.
  • A malformed file-tab value does not crash session rendering or tab normalization.
  • Valid Amicode receipt parts and valid file tabs retain their current behavior.
  • Regression tests cover both malformed inputs and the valid paths.

Testing Decisions

Extend the existing session UI test suites and run the focused tests plus the repository checks required for the changed packages.

Key Decisions

Use runtime type guards at the boundaries rather than changing persisted records or weakening the typed model globally.

Constraints & Invariants

Do not hide valid tool receipts, alter tab ordering, or perform destructive cleanup of user session state.

Prior Art

The receipt-collapse pass and session file-tab normalization are the affected rendering paths.

Notes

The issue is a localized chore; it should be published automatically before implementation begins.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    afkImplement + merge unattended

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions