8000 Networking-first rewrite with events in mind by noahm · Pull Request #349 · noahm/DDRCardDraw · GitHub
[go: up one dir, main page]

Skip to content

Networking-first rewrite with events in mind - #349

Open
noahm wants to merge 425 commits into
mainfrom
partykit
Open

noahm wants to merge 425 commits into
mainfrom
partykit

Conversation

@noahm
@noahm noahm commented Jul 12, 2024 •
Copy link
Copy Markdown
Owner

This will be the future form of networking in the app. The whole app uses a shared state that is sync'd between as many users as you see fit. Multiple configuration presets are supported, and users/matches can even be pulled/pushed from a start.gg event. For a more guided tour of all the new features here, see this somewhat outdated video walk-through: https://youtu.be/4Gpj9jTNcfM

The main thing keeping this from merging and replacing our current main branch is the lack of some features that many people still expect, like local-only ITG imports. This can be solved in party by supporting these only in the "classic mode" (no networking) and eventually supporting some sort of external hosting for custom imports.

This PR is perpetually deployed at next.ddr.tools

Current known blockers

  • Support custom/imported data (requires move to separate CDN?)
  • better streamlining for classic mode (transition from classic to shared seamlessly?)
  • polished experience for smaller mobile screens

@vercel
vercel Bot commented Jul 12, 2024 •
Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ddr-tools Ready Ready Preview Nov 25, 2026 3:45am UTC

@gitguardian
gitguardian Bot commented Jul 14, 2024 •
Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

noahm and others added 29 commits October 20, 2026 10:09
# Conflicts:
#	scripts/validate.mjs
#	src/song-search/index.tsx
#	src/songs/syr5.json
#	src/songs/syr6.json
#	src/utils/share.ts
Charts are keyed on their song's `id` instead of `saHash` or name and
artist. Songs whose id is their old saHash keep their keys; for the
rest, reuseKeysForChart also hands out the key a chart had before
(rebuilt from the name, artist, style, difficulty, level and extras a
drawn chart already stores), so charts drawn before the switch are
still excluded from draws. primaryReuseKey keeps its old behavior.

Custom bundles published before v2 are upgraded as they load: each
song's id is its saHash, else saIndex (SMX's 573.no song_id), else its
name and artist, which keeps the chart keys such songs already had.
The loader validates against songs.schema.json (now identical to the
hosted v2) and the separate copy of the hosted v1 is gone.

The SMX edit builder and score import match on `id`, and drawn charts
store their song's `id` as `songId`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hosted PartyKit has been taken offline. The room server is now a
SQLite-backed Durable Object (`Main`) routed by partyserver at the same
/parties/main/<room> paths, so partysocket on the client is unchanged.

- snapshot-store: R2 through the SNAPSHOTS binding instead of signed S3
  requests; same bucket and key layout, so rooms already saved there
  hydrate from it on first visit
- drop aws4fetch, the R2_* secrets, LOCAL_SNAPSHOT_URL and the local
  snapshot store script; wrangler dev simulates the binding locally
- storage value limit is now 2 MB (gzip kept)
- client host is a build-time PARTY_HOST, defaulting to
  ddr-card-draw-party.psoplayer.workers.dev
- yarn start:backend runs wrangler dev on :1999; new yarn deploy:party;
  watch:room wraps wrangler tail
- worker code typechecks against workers-types via tsconfig.worker.json

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Custom domain route in wrangler.jsonc, and the production default for
PARTY_HOST in webpack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the party server from hosted PartyKit to partyserver on Workers
Adds a third source to the custom-data dialog alongside SMX edits and ITG
packs: pick (or drop anywhere on the page) a single .json file that
conforms to the Game Data schema, and it's published as-is to
data.ddr.tools like the other custom sets, so synced peers resolve the
same bytes. The file is validated client-side first so a bad file shows
readable schema errors; only the display name can be changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A file whose `$schema` points at data.ddr.tools/schema/*.json is now
checked against that schema, fetched live, instead of the v1 copy this
build bundles. That lets premade files written for v2 (required
song.id) through the upload form, and lets their published bundles
load back. Anything else keeps the bundled schema; the publish Worker
still validates on upload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upload a premade game data JSON file as custom data
Moves validate.mjs's consistency checks (declared styles, difficulties
and flags all translated, defaults that exist, known styles/diffClasses
on charts, draw groups, folders, unique chart ids) into a shared
src/utils/game-data-consistency.ts. The script imports it directly via
Node's type stripping and passes in its jacket-file check; the premade
JSON upload form runs the rest after the schema passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hold uploaded data files to the same consistency checks as yarn validate
# Conflicts:
#	scripts/validate.mjs
Idle rooms are now evicted from memory while their sockets stay open, so
nothing a live client depends on can be memory-only:

- heartbeat pings are answered by a websocket auto-response, so they no
  longer wake the room
- the catch-up tail moves to a SQLite table; onStart drops rows past the
  restored seq
- the coalesced R2 write is carried by an alarm instead of a timer, which
  would block hibernation and die with an evicted instance
- onStart skips the R2 read when a stored remoteSeq shows room storage is
  current, since it now runs on every wake

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqZjZSFoFLhGnJuVwR1U3X
Drop the M3 cutover that would have moved catalogs, jackets, import
scripts and the schema into rgt-data. Stock updates become
deploy-independent through the CDN publish job and manifest, not a repo
split. Instead, rgt-data's Worker moves onto partykit beside the party
Worker (new step 4), keeping its name and bindings, and the hosted
schema is served from the repo's songs.schema.json.

Also catch the plan up with recent partykit changes: room persistence
is Durable Object storage + R2 snapshots (not Supabase event_state),
custom data can be a premade JSON upload validated against its declared
hosted schema, and rgt-data#5 is live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs: keep M3 data in DDRCardDraw, fold the data Worker in
Resolves conflicts with #678 and #679:
- validate.mjs now delegates to the shared findConsistencyErrors, so the
  duplicate song id check moves into src/utils/game-data-consistency.ts.
- loadCustomGamedataByUrl validates against the schema a bundle declares.
  Hosted v1 forbids `song.id`, so a bundle declaring a hosted schema is
  validated as published and upgraded afterwards; one held to the bundled
  v2 schema is upgraded first, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Schema v2 on partykit: merge main, key charts on song.id
Replaces the ddr-tools-api proxies on Val Town (which is shutting down)
with official routes on the party Worker:

- /api/e/:eventId/cab/:cabId/player/:playerIndex — plain-text name of the
  player at that position in the cab's active match, or 204 with an
  x-empty-reason header
- /api/e/:eventId/draws — every drawing in the event as JSON

Both read the room's Durable Object state directly instead of fetching
/parties/main/<room> over HTTP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It uses the workers-runtime Env global, so like worker.ts and server.ts it's
only checked by tsconfig.worker.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… API

The old full-draw-history proxy answered at /e/:eventId, so with its
val.run redirect pointed at live.ddr.tools/api the path lands here
unchanged. docs/api.md covers both routes for users, linked from the
OBS guide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add GET /api routes for player names and draw history
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
ddr-card-draw-party 9756af4 Nov 25 2026, 03:36 AM

This branch was successfully deployed

1 active deployment
Preview — 9756af42 Deployed Nov 25, 2026 by vercel[bot]
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

0