Merge pull request 'fix(auth): typed context keys and real sentinel errors' (#4) from devin/1776538999-fix-auth-context-keys-and-errors into master
Some checks failed
CI / Backend (go 1.23.x) (push) Has been cancelled
CI / Backend security scanners (push) Has been cancelled
CI / Frontend (node 20) (push) Has been cancelled
CI / gitleaks (secret scan) (push) Has been cancelled

This commit was merged in pull request #4.
This commit is contained in:
2026-04-18 19:35:55 +00:00
7 changed files with 145 additions and 37 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"net/http"
"github.com/explorer/backend/api/middleware"
"github.com/explorer/backend/featureflags"
)
@@ -16,11 +17,8 @@ func (s *Server) handleFeatures(w http.ResponseWriter, r *http.Request) {
}
// Extract user track from context (set by auth middleware)
// Default to Track 1 (public) if not authenticated
userTrack := 1
if track, ok := r.Context().Value("user_track").(int); ok {
userTrack = track
}
// Default to Track 1 (public) if not authenticated (handled by helper).
userTrack := middleware.UserTrack(r.Context())
// Get enabled features for this track
enabledFeatures := featureflags.GetEnabledFeatures(userTrack)