Skip to content

Evangelos Asimakopoulos code GWI#43

Open
evangelosas wants to merge 20 commits into
GlobalWebIndex:mainfrom
evangelosas:junie_experiment
Open

Evangelos Asimakopoulos code GWI#43
evangelosas wants to merge 20 commits into
GlobalWebIndex:mainfrom
evangelosas:junie_experiment

Conversation

@evangelosas

@evangelosas evangelosas commented Sep 21, 2025

Copy link
Copy Markdown

The code was written mostly by Junie Pro and my role was to supervise and make all the necessary changes in order to provide a deliverable of high standard. The time gained gave me the opportunity to add more tests and functionality.

@evangelosas evangelosas changed the title Junie experiment Evangelos Asimakopoulos code GWI Sep 21, 2025

@alexandros-georgantas alexandros-georgantas left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hello Evangelos 👋 ,

Thank you for taking the time working on this assignment!
I've left some comments as part of my review of this PR and I would love to hear your thoughts!

Thanks,
Alex

Comment thread Containerfile
# Podman uses the same Dockerfile syntax. This Containerfile mirrors the Dockerfile.

# ----- Build stage -----
FROM golang:1.22-alpine AS builder

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you please explain your rationale behind keeping this old version of golang?

Comment thread README.md

Two store implementations:
- In-memory (default): fast, volatile.
- File-backed (JSON): persists to a single file. Configure via env vars:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I understand your choice of using an in-memory store for the scope of this assignment, however I would like to hear your thoughts about the file backed option.
For your file-based storage why you haven't chosen sqlite for example which would have given you some structure to work with?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you please review this file and suggest if it could be simplified?

}

func (chart *ChartAsset) MarshalJSON() ([]byte, error) {
type alias ChartAsset

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you please explain the need of type alias and what you are trying to solve?

Comment thread gwiexercise/server.go

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you please suggest potential refactoring of this file as it scores low when it comes to structure and readability?

Comment thread gwiexercise/server.go
writeError(w, http.StatusNotFound, "not found")
}

func (s *Server) handleUserFavourites(w http.ResponseWriter, r *http.Request, userID string) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What is you opinion on having a single handler handling all the HTTP methods?

Comment thread main.go
store = gwi.NewInMemoryStore()
log.Printf("Using in-memory store")
}
server := gwi.NewServer(store)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you suggest a more graceful approach of initializing the HTTP server?

ID string `json:"id"`
Type AssetType `json:"type"`
Description string `json:"description"`
Payload json.RawMessage `json:"payload"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there a way to define acceptable payload types at compile time instead of just accepting raw data?

req AddAssetRequest
wantType AssetType
wantErr bool
errorMsg string

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In your test, are you interested in verifying whether the implementation correctly returns an error when it should, or whether the specific error message returned is the expected one?

Why do you think, in this particular case, the error string itself matters?

Comment thread temporary.txt
9) Test coverage
- Add unit tests that assert: (a) status mapping without relying on string matching (once typed errors exist), (b) duplicate IDs within a batch, (c) duplicate against existing store, (d) large offset/limit interaction after bulk insert, (e) body Content-Type handling, (f) maximum batch size enforcement.

These improvements would make the bulk endpoint more robust, maintainable, and user-friendly without changing the core behavior clients rely on today. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you please explain what is this file for?

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.

3 participants