Context
Gemini review on PR #8 suggested replacing prototype Math.random() ID suffixes in Nakama runtime helpers with Nakama's platform UUID generation, likely nk.uuidV4().
Current state
newMemoryId(context) and newActivityId(context) currently build IDs from:
- prefix (
mem / act)
- sanitized player id
- timestamp
Math.random() suffix
- current bounded-list sequence
The local backend/nakama/types/nakama-runtime.d.ts shim does not expose uuidV4() yet, and the current ID helpers do not receive nk, so this is broader than the PR #8 behavioral fixes.
Proposed follow-up
- Verify Nakama OSS runtime API support for UUID generation in the exact runtime version used by the project.
- Add the method to the local TypeScript shim if available.
- Thread
nk into ID generation helpers or introduce a small newRuntimeId(prefix, context, nk) helper.
- Keep IDs deterministic enough for test harness assertions where needed.
- Re-run
npm run build && npm test in backend/nakama.
Non-goals
- Do not weaken storage version checks.
- Do not change the agent activity log cap or runtime counter semantics.
- Do not let these IDs become authoritative gameplay identifiers.
Related
Context
Gemini review on PR #8 suggested replacing prototype
Math.random()ID suffixes in Nakama runtime helpers with Nakama's platform UUID generation, likelynk.uuidV4().Current state
newMemoryId(context)andnewActivityId(context)currently build IDs from:mem/act)Math.random()suffixThe local
backend/nakama/types/nakama-runtime.d.tsshim does not exposeuuidV4()yet, and the current ID helpers do not receivenk, so this is broader than the PR #8 behavioral fixes.Proposed follow-up
nkinto ID generation helpers or introduce a smallnewRuntimeId(prefix, context, nk)helper.npm run build && npm testinbackend/nakama.Non-goals
Related
nk.uuidV4().