Skip to content

wp#13

Merged
1batu merged 12 commits intoDigitalCoreHub:mainfrom
1batu:main
Nov 9, 2025
Merged

wp#13
1batu merged 12 commits intoDigitalCoreHub:mainfrom
1batu:main

Conversation

@1batu
Copy link
Member

@1batu 1batu commented Nov 9, 2025

This pull request focuses on improving type safety and data validation for WebSocket and API responses across several frontend components. The main changes ensure that data received from the backend is thoroughly checked before being used, which reduces the risk of runtime errors and makes the codebase more robust.

Type safety and data validation improvements:

  • Added runtime validation for API responses in Dashboard, Leaderboard, and LatestNews components to ensure only well-formed data is processed and rendered. This includes checking the structure and types of objects and arrays before updating state. [1] [2] [3] [4]
  • Improved handling of WebSocket messages in ReasoningFeed, including stricter checks on the shape and type of incoming data for both agent thinking and decision events. [1] [2]

Type definition and import cleanup:

  • Refactored WebSocketMessage to use unknown for the data property and moved its definition to a shared module, updating imports and removing duplicate interface declarations in components. [1] [2] [3] [4]

These changes collectively increase the reliability of frontend data handling and make the codebase easier to maintain.

1batu added 12 commits November 9, 2025 21:01
Added explicit type validation for agent_thinking and agent_decision message data in ReasoningFeed to prevent invalid data from being processed. This improves robustness against malformed WebSocket messages.
Add type checks for agent message handling
Added stricter checks for the presence and type of agent_id in agent_thinking WebSocket messages to prevent potential errors from malformed data.
Improve agent_thinking message validation
Update ReasoningFeed.tsx
Introduced stricter type checking and filtering for WebSocket message data in LatestNews, Leaderboard, and ReasoningFeed components. This improves robustness by ensuring only valid and expected data shapes are processed, reducing the risk of runtime errors from malformed messages. Also updated WebSocketMessage interface to use 'unknown' for the data property.
Add type guards for WebSocket message data
Improves data validation in Dashboard, Leaderboard, and ReasoningFeed components by adding stricter type checks for API responses before updating state. This prevents potential runtime errors from malformed or unexpected data structures returned by the backend.
Add robust type checks for API responses in frontend
Update ReasoningFeed.tsx
@1batu 1batu merged commit 353f541 into DigitalCoreHub:main Nov 9, 2025
2 checks passed
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.

1 participant