Skip to content

refactor: replace float32/number identifiers with integer types#79

Merged
electather merged 6 commits intomainfrom
refactor/replace-float32-with-int
Mar 16, 2026
Merged

refactor: replace float32/number identifiers with integer types#79
electather merged 6 commits intomainfrom
refactor/replace-float32-with-int

Conversation

@electather
Copy link
Owner

Summary

Replace all hand-written float32 flag types and ParseFloat calls with integer types throughout CLI handlers and MCP tool handlers. The auto-generated pkg/api/ client still uses float32 for API parameters; float32(id) casts remain only at those API call boundaries.

Closes #69

Changes

Step 1 — CLI positional arg parsing

  • Replaced strconv.ParseFloat(args[0], 32) with strconv.ParseInt(args[0], 10, 64) for all commands that accept a numeric ID as a positional argument (movies, tv, users, person, collection, service, issue, tmdb, other, overriderule)
  • Season numbers in request create/update now also use ParseInt (the []float32 slice stays because the generated API requires it)

Step 2 — Cobra flag types

  • Changed all cmd.Flags().Float32("xxx", ...) / GetFloat32("xxx") flag registrations to Int for pagination params (--page, --take, --skip), ID params (--media-id, --tmdb-id, --requested-by, --server-id, --profile-id, --language-profile-id, --user-id, --tvdb-id, --network, --studio, --permissions, etc.)

Step 3 — MCP tool handlers

  • Replaced req.RequireFloatreq.RequireInt and req.GetFloatreq.GetInt for all integer IDs and pagination parameters in all MCP tool files

Step 4 — GenreMap

  • Changed GenreMap key type from float32 to int in cmd/mcp/enrich.go

Test plan

  • go test -v ./... passes
  • go fmt ./... produces no diff
  • go build succeeds
  • New tests in tests/int_flags_test.go verify decimal IDs and --page flags are now rejected with a parse error

Checklist

  • New tests added for new behaviour
  • Documentation updated (README, command --help, comments)
  • No unrelated changes included

@electather electather merged commit 3658580 into main Mar 16, 2026
2 checks passed
@electather electather deleted the refactor/replace-float32-with-int branch March 16, 2026 13:18
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.

refactor: Replace float32/number identifiers with integer/string types

1 participant