Skip to content

feat: agent type safety, notification alignment, contract migration, ci setup (#139 #140 #171 #179)#231

Open
dimka90 wants to merge 1 commit into
DXmakers:mainfrom
dimka90:feat/issues-139-140-171-179
Open

feat: agent type safety, notification alignment, contract migration, ci setup (#139 #140 #171 #179)#231
dimka90 wants to merge 1 commit into
DXmakers:mainfrom
dimka90:feat/issues-139-140-171-179

Conversation

@dimka90
Copy link
Copy Markdown

@dimka90 dimka90 commented May 30, 2026

Summary

Combined PR implementing 4 issues from the additional audit report.


#139 [Agent 17] — Remove unsafe type assertions on private clients

  • Added parseValidatedGoal() helper that narrows types via runtime typeof checks instead of as number / as string casts
  • Replaced all unsafe casts in registerUserGoal() and updateUserGoal() with calls to the typed helper
  • GoalPayloadInput (all unknown fields) is now consumed through a properly typed ValidatedGoalData interface
  • sendMessage() and broadcastMessage() remain public — no need for external as any access

#140 [Agent 18] — Align server notification type with frontend

  • Added ErrorNotification type (was missing in frontend — server sends { type: 'error', payload: { message } })
  • Fixed ConnectedNotification.payload shape to match server ({ userId, timestamp })
  • Added ProactiveNotificationPayload interface with full type, projection, etc.
  • Updated AgentMessagePayload to include sender: 'agent' and projection fields
  • Added type guards: isErrorNotification, isProactiveNotification, isPongNotification
  • Removed catch-all GenericNotification — all incoming messages are now strictly typed

#171 [Contract 24] — Migrate tests from register_contract to register

  • Changed all 41 calls from env.register_contract(None, X) to env.register(X, ())
  • Uses the newer soroban-sdk 22 API

#179 [CI DevOps 07] — Use npm ci instead of npm install

  • CI pipeline already used npm ci — no change needed there
  • Updated README.md setup instructions from npm install to npm ci for consistency

Files changed

File Change
agent/websocket-server.ts Added ValidatedGoalData, parseValidatedGoal(); removed as casts
frontend/src/types/websocket.ts Full rewrite with proper types for all server messages
contracts/src/lib.rs 41 register_contractregister calls
README.md npm installnpm ci in setup instructions

Closes #139
Closes #140
Closes #171
Closes #179

…ct tests, use npm ci (DXmakers#139 DXmakers#140 DXmakers#171 DXmakers#179)

## DXmakers#139 [Agent 17] Remove unsafe type assertions
- Added parseValidatedGoal() helper with proper runtime type narrowing
- Replaced as number / as string casts in registerUserGoal and updateUserGoal
- GoalPayloadInput fields now accessed through validated typed interface

## DXmakers#140 [Agent 18] Align server notification type with frontend
- Added ErrorNotification type to frontend (was missing)
- Updated ConnectedNotification payload shape to match server
- Added ProactiveNotificationPayload interface for notification type
- Added sender and projection fields to AgentMessagePayload
- Added isErrorNotification, isProactiveNotification, isPongNotification guards
- Removed catch-all GenericNotification in favor of strict types

## DXmakers#171 [Contract 24] Migrate tests from register_contract to register
- Changed 41 env.register_contract(None, X) calls to env.register(X, ())
- Uses soroban-sdk 22's new register API

## DXmakers#179 [CI DevOps 07] Use npm ci instead of npm install
- Updated README setup instructions from npm install to npm ci
- CI pipeline already uses npm ci

Closes DXmakers#139, Closes DXmakers#140, Closes DXmakers#171, Closes DXmakers#179
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@dimka90 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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

Labels

None yet

Projects

None yet

1 participant