Skip to content

Loukas Peteinaris Submission - Louk Chatwalker#2

Open
loukaspe wants to merge 52 commits intoGlobalWebIndex:mainfrom
loukaspe:implementation
Open

Loukas Peteinaris Submission - Louk Chatwalker#2
loukaspe wants to merge 52 commits intoGlobalWebIndex:mainfrom
loukaspe:implementation

Conversation

@loukaspe
Copy link
Copy Markdown

No description provided.

cursor[bot]

This comment was marked as outdated.

}
}

return err
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Incorrect Error Handling for Non-Existent Records

The UpdateMessageFeedback and UpdateChatSessionTitle functions incorrectly treat updates to non-existent records as successful. GORM's Update method returns a nil error with RowsAffected=0 when no rows match the update criteria, rather than gorm.ErrRecordNotFound. This causes the functions to return success (e.g., API 201) for non-existent message or chat session IDs, despite no database changes. RowsAffected should be checked to correctly identify and return a 'not found' error.

Additional Locations (1)
Fix in Cursor Fix in Web

Comment thread cmd/main.go

err = db.AutoMigrate(&repositories.User{})
if err != nil {
log.Fatal("cannot migrate user table")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Startup Data Loss in Production

On startup, the application unconditionally drops the users, messages, and chat_sessions database tables. This results in irreversible data loss in production environments with every service restart. A code comment indicates this behavior was intended for assessment purposes, but it remains active in the main application.

Fix in Cursor Fix in Web

Comment thread cmd/main.go
if err != nil {
log.Fatalf("Error getting env, not comming through %v", err)
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Environment Variable Path Issue

The application fails to start because it attempts to load environment variables from ./config/.env using godotenv.Load. In typical runtime environments (e.g., Docker), the .env file is located at the application root, causing a path mismatch. This results in a fatal error during startup, preventing the server from booting even when required environment variables are already provided.

Fix in Cursor Fix in Web

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