Repository navigation
fix: export the tombola level for octoberfest bribes - #68
Merged
Merged
Conversation
timzatko
force-pushed
the
fix/tombola-level
branch
2 times, most recently
from
September 10, 2026 14:58
efe4461 to
64d77be
Compare
The level was read as `response.construction_id || data.enhance`, and an octoberfest bribe/upgrade carries neither: the request sends no `enhance`, and the bribe response has no `construction_id`, reporting the level as `enhance` on itself instead. The level came out undefined, and jQuery deletes an undefined value from the ajax data rather than sending it empty, so /service/tombola-export rejected every bribe spin with "Level is not defined!". Normal spins, which do send `enhance`, were unaffected, so only part of each event went missing. Regressed in 14a9728, which swapped `response.enhance` for `data.enhance` to fix the easter level. Read the enhance from the request first and the response second, by first defined rather than with `||`, since 0 is a real level - the un-enhanced spin. `construction_id` is no longer a source: it is 0 on every octoberfest spin and no recorded level has ever come from it (every tombola page from 2022 on shows only 0, 25, 150 and 800), so reading it first would mask the real level. It only appeared to work because `||` skipped it while it was falsy. Two things kept this quiet. A spin with no resolvable level now reports through the error tracker instead of firing a request that cannot succeed, keeping the local stats, which do not use the level. And exportSpin passed only a success callback, so a rejected export vanished; it now warns and reports on every failure. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017pYtZPqMDyRYtvJ7Jqxqw9
timzatko
force-pushed
the
fix/tombola-level
branch
from
September 10, 2026 15:01
64d77be to
57414da
Compare
timzatko
added a commit
that referenced
this pull request
Sep 10, 2026
The tombola service answers /service/tombola-export with a script of its own rather than the jsonp callback jQuery generates - tombola-list does the same, replying with a bare TW_Calc.addTombolaInfo(...) call - so jQuery reports a parsererror for spins the server accepted. The failure handler added in #68 turned each of those into a console error and a /service/send-error report, once per spin. Return early on parsererror with a debug-only log, and drop the error tracking from the handler entirely; a status the export really failed with is still warned about. Claude-Session: https://claude.ai/code/session_01YAUg99g4KbYH58Pk1bSYat Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported as a 400 from
/service/tombola-exportduring Oktoberfest 2026:Cause
tombola-exporter.tsread the level asresponse.construction_id || data.enhance. An octoberfest bribe/upgrade carries neither: the request sends noenhance, and the bribe response has noconstruction_idand reports the level asenhanceon itself (which is what the response interface comment has said all along).The level therefore came out
undefined— and jQuery does not sendlevel=for that.ajaxExtendputs the ajaxdatathroughjQuery.extend(true, …), whose deep copy has an explicitelse if ( copy !== undefined )guard, so the key is deleted beforejQuery.paramever runs. The server saw an absent param, not an empty one, and rejected the spin.Regressed in 14a9728 (2021-03-31), which swapped
response.enhancefordata.enhanceto fix the easter level. Normal spins do sendenhance, so they kept working — only bribe/upgrade spins were lost, quietly, since 2021.Fix
The level is the enhance the spin was played at. It is read from the request first and the response second, by first defined rather than with
||, because0is a real level (the un-enhanced spin).construction_idis no longer a source at all. It is0on every octoberfest spin, and no recorded level has ever come from it — every tombola page from 2022 onward shows only levels 0, 25, 150 and 800, for octoberfest, independence and easter alike. It only ever appeared to work because||skipped it while it was falsy. Keeping it first with first-defined semantics would have started recording0for every independence spin, so this ordering matters.Why it stayed hidden, and what changes so it cannot again
exportSpinpassed only a success callback, so a rejected export vanished silently. It now warns and reports on every failure.Tests
New
tombola-exporter.spec.tsdrives the real class throughinit()and a stubbedwest.wof.WheelofFortune.prototype.process:level: 0level: 25read off the responseconstruction_id: 3present withenhance: 0→level: 0Verified by mutation rather than by eye — each of these breaks the suite:
response.construction_id || data.enhance||instead of first-definedconstruction_idput back as the first sourceNote
The endpoint answers a successful export with an empty 200 body, so jQuery scores every export as a failure. Until the companion website change (timzatko/TW-Calc-Website#12) is deployed, the new failure reporting fires for every spin even when exports are landing.
🤖 Generated with Claude Code
https://claude.ai/code/session_017pYtZPqMDyRYtvJ7Jqxqw9