Repository navigation
Conversation
- yap-frontend/index.html: both OneSignal apps are origin-restricted on their dashboard (dev to localhost:5173, production to https://yap.town), so init() throws "Can only be used on: ..." on any other origin no matter which config is picked. A prior fix (#181) corrected which config the yap-beta.pages.dev preview channel loads, but that channel still isn't an allowed origin for either app, so init kept throwing — just with a different target URL in the message (Sentry JAVASCRIPT-REACT-3T/3V, 69+ occurrences). Skip init entirely on origins that aren't allow-listed instead of calling something guaranteed to fail. - libraries/weapon/src/supabase.rs: the event upload's `Prefer: resolution=ignore-duplicates` header (added in #181) only takes effect for the constraint targeted by PostgREST's implicit ON CONFLICT, which defaults to the primary key (`id`, always fresh on insert) unless an `on_conflict` query parameter says otherwise. The actual identity constraint is `events_unique_stream_device_index`, so the header was a no-op and duplicate rows kept 409'ing (Sentry JAVASCRIPT-REACT-3D, still recurring after #181 shipped). Add the on_conflict parameter naming that constraint. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XRLrz5gmo8yetkS42yzRPC
|
CI's Failing test: Not this PR's: the same test fails identically (same panic, same message) on PR #196, which only touches Root cause: let cache_filename = language_utils::tts_cache_filename(request, &primary);
if let Some(audio) = tts_cache::lookup(http, &cache_filename).await {
return Ok(Synthesized { audio, verified: true, synthesized: false });
}
No existing fix to port — I didn't find another open PR touching this test or Proposed patch (not pushed here — unrelated to this PR's files, so pushing it would widen the diff): make let tts_body = serde_json::to_value(TtsRequest {
text: format!("test-{}", uuid::Uuid::new_v4()),
..tts_request("bonjour")
})
.unwrap();so the cache lookup reliably misses and the handler actually reaches the stripped-credentials path the test means to cover. Given this is pre-existing and unrelated to the change here, I'll leave Generated by Claude Code Generated by Claude Code |
Summary
Two production Sentry issues that a prior automated fix (#181) partially addressed but didn't fully resolve — both still recurring as of today.
yap-frontend/index.html: both OneSignal apps are origin-restricted on their dashboard (dev app →localhost:5173, production app →https://yap.town), soOneSignal.init()throwsCan only be used on: ...on any other origin no matter which config is picked. Fix OneSignal dev-mode misdetection, event-upload races, and localStorage guard #181 fixed which config theyap-beta.pages.devpreview channel loads (it was matching theisDevelopmentsubstring check on "dev" and using the dev config), but that channel still isn't an allow-listed origin for either app — it just started throwing with the production origin in the message instead of the dev one. Sentry JAVASCRIPT-REACT-3T/3V, 69+ occurrences, still firing through today. Now we skipinit()entirely on origins that aren't allow-listed instead of calling something guaranteed to fail.libraries/weapon/src/supabase.rs: the event upload'sPrefer: resolution=ignore-duplicatesheader (added in Fix OneSignal dev-mode misdetection, event-upload races, and localStorage guard #181 to fix a race where a concurrent sync's duplicate row 409'd the whole batch) only takes effect for the constraint PostgREST's implicitON CONFLICTtargets, which defaults to the primary key (id, abigserialthat's always fresh on insert) unless anon_conflictquery parameter names a different one. The actual identity constraint on this table isevents_unique_stream_device_index(user_id, stream_id, device_id, within_device_events_index), so the header was a no-op — duplicate rows kept getting a 409 ("duplicate key value violates unique constraint \"events_unique_stream_device_index\""). Sentry JAVASCRIPT-REACT-3D, 8 users affected, still recurring after Fix OneSignal dev-mode misdetection, event-upload races, and localStorage guard #181 shipped. Added theon_conflictparameter naming that constraint so the ignore-duplicates resolution actually applies to it — still only skips inserting rows that already exist under that identity, never updates one, preserving the append-only event invariant.Other open Sentry issues surveyed (push-service AbortErrors, WASM network aborts, "Failed to fetch" against Supabase/the AI backend, an OPFS
NotReadableError) are transient/environmental — browser or network failures already caught and logged, not something a code change can unambiguously prevent — so left alone per the "avoid large changes to chase noise" guidance.Test plan
cargo check --package weaponcargo clippy --package weapon(clean)cargo fmt --package weapon -- --check(clean)*.pages.dev) deploy, and normal init still fires onyap.town/ local dev🤖 Generated with Claude Code
https://claude.ai/code/session_01XRLrz5gmo8yetkS42yzRPC
Generated by Claude Code