AcevedoR / AcevedoR/rpg-maestro

Cloud-readiness: session writes need transactions or optimistic concurrency

Đang mở
#115 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
TypeScript
Star
0
Fork
0
Merge trung bình
16 phút
Pull request đã merge (30 ngày)
7

Mô tả

## Problem

Session playback state is updated with a read-modify-write against Firestore with no transaction and no version check.

- `apps/rpg-maestro/src/app/sessions/sessions.service.ts` — `upsertCurrentTrack` / `upsertShortEffectTrack` read, mutate, then write

Running a single instance made this safe by accident. With two instances — or a single maestro driving the session from two devices — concurrent track changes can clobber each other, and the last writer wins with no detection.

## Proposed rework

- Wrap the read-modify-write in a Firestore transaction, or
- Add optimistic concurrency: a `version` field on the session, written with a conditional update, retried on conflict

Either way the API should be able to tell the caller that its change lost a race, instead of silently dropping it.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

The issue points to `apps/rpg-maestro/src/app/sessions/sessions.service.ts` and the `upsertCurrentTrack` and `upsertShortEffectTrack` methods. Start by examining how these methods read, mutate, and write session state to Firestore. Research Firestore transactions or optimistic concurrency using a `version` field. The goal is to wrap the updates to prevent race conditions and return a conflict error to the caller.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
firebase, typescript
Lĩnh vực
backend, databases
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
65/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.