Fix land/city selling math for negative inputs - #34
Open
Manbo04 wants to merge 1534 commits into
Open
Conversation
added 30 commits
June 27, 2026 18:16
…t baked-in text or borders
… manager to fix the 'Invalid verification link' bug
…erification failures
…ing spatial clustering
… (GEMINI.md) Most players are on phones/tablets; every mobile bug shipped came from building desktop-first (unstyled signup on tablet, side ads leaking onto touch, cramped building lists, oversized images). Codify mobile-first as a non-negotiable rule for both AI CLIs working in this repo. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The admin command center crashed with 'invalid input syntax for integer: dede' — get_recent_actions joined admin_actions.actor (which holds either a user id OR a username) with CAST(actor AS INTEGER). Postgres evaluates that cast even for non-numeric actors, throwing and 500ing the panel for every admin. Compare as text on both sides (users.id::text) so numeric and username actors both resolve safely. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… verification)
- /admin/ads crashed: template used url_for('ads_bp.upload_ad') but the
blueprint endpoint is 'ads.upload_ad'. Fixed both references.
- Add scripts/hourly_monitor.py: verifies the latest master commit passed
CI AND the Railway redeploy workflow AND is live (catches the failure
where a fix passes CI but the deploy workflow fails, so it never ships),
and scans Discord bug/ticket channels for new player reports since the
last run. Logs to monitor.log and posts a staff-chat alert on issues.
- scripts/run_hourly_monitor.sh: runs it via the Gemini CLI (agy) for the
scheduled hourly check.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Per request, the hourly agy agent now detects, fixes, verifies deploy, and replies to the reporting player: - monitor emits channel_id/author_id per new bug so the agent can @mention - scripts/discord_reply.py posts a fix confirmation + explanation as the bot - scripts/AGENT_PLAYBOOK.md is the operational procedure (investigate on prod read-only, fix, push, verify CI+redeploy actually shipped, reply to player) with safety rules (no railway up, no destructive SQL, escalate uncertain/ balance decisions to staff-chat instead of guessing) - wrapper prompt drives the full loop Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…y or message players The autonomous agent's two irreversible actions (deploying to prod, messaging players) are now behind human approval: - SAFE MODE wrapper: agent works on agent/fix-* branches and opens PRs; never pushes master, merges, deploys, or messages players directly. It posts one summary + draft replies to staff-chat for a human to act on. - Kill switch: touch ~/AnO-Reborn/.agent-disabled to pause it entirely. - scripts/agent_guard.sh: hard block — refuses commits on master, refuses changes to protected paths (migrations, .github, config.py, app.py auth, the agent scripts themselves), and caps diffs at 8 files. - Playbook rewritten: read-only investigation (SELECT only), escalate uncertain/balance decisions instead of guessing, keep diffs tiny. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…hored, human-reviewed) Autonomous agy agent produced these mobile-only (@media max-width:480px) fixes for the country page; reviewed and verified before merge: - VIEW/REVENUE/NEWS/EDIT tabs: 50% width, 48px tap targets - country banner/flag bounded (max-height 180px, object-fit) so images don't fill the screen - info tables table-layout:fixed + word-break to stop horizontal overflow - demographics/stat cards stack to single column for readability Desktop untouched. Bundle verified consistent.
Players couldn't reach the tutorial — /tutorial works (200) but there was no nav link to it anywhere; you had to know the URL. Added a Tutorial entry to the 'Other' dropdown and the mobile menu, next to Mechanics. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…g unpkg Every page had three synchronous, un-deferred resources from unpkg.com in <head> (popper, tippy, tippy CSS) — and the scripts hit 302 redirects. Synchronous head scripts block HTML parsing until they finish, so every page load stalled waiting on a flaky free CDN + redirect round-trips — the cause of the extraordinarily long loads. Self-host tippy-bundle (includes popper, one file) under static/vendor and load it deferred; deferred scripts still run in order before DOMContentLoaded where tooltips.js initialises tippy, so tooltips keep working. Tippy CSS is now local and non-blocking. No external CDN, no redirects, no render-blocking. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… view) Player-reported (ticket-0020): on the classic province view the Purchase button sat on top of the Land amount input, hiding it. Cause: the legacy .divflex2center forces max-content widths on both the input column and the button column, which overlap inside the card. Added a scoped clean flex layout for these purchase forms (input takes the space, button sizes to its label, stacks on phones), overriding the broken max-content sizing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ooltips, pinch-zoom
…tions/statistics so their mobile CSS applies
…r, style unit chips, tighter spacing
Player report (ticket-0020): the classic province page's land/city purchase form only has a "Purchase" button (no separate sell button), and typing a negative amount silently failed. Buildings already support demolishing via a negative quantity in the quick builder (2026-07-06 fix), but that fix never covered land/cityCount, which go through the separate /<way>/<units>/<province_id> route. A negative amount on the buy route for land/cityCount now flips to a sell of that many instead, mirroring the existing building pattern. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Player report (ticket-0022, luciuskonst): deleting an account "does not work as intended." migrations/0036_referrals.sql added three foreign keys to users(id) with no ON DELETE action (users.referred_by_user_id, referral_active_days.referred_user_id, and both referrer/referred columns on referral_milestone_payouts). delete_own_account() deletes the users row first without ever touching these tables, so any player who ever referred someone or was referred hit an unhandled foreign-key IntegrityError and the whole deletion transaction failed. Clean up the referral rows (and null out any other user's referred_by_user_id pointing at this account) before deleting the users row, matching how every other related table is already handled in this function. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fix account deletion failing for players who used the referral system
Sell land/cities via negative quantity in classic purchase form
Fix undefined column userId during Discord signup
Player report (ticket-0022): a referrer's dashboard shows 0 invitees despite luciuskonst completing a Discord signup with their referral code. Code review of link_referrer_on_signup / apply_signup_referral_bonus / session handling didn't turn up an obvious bug, and production DB access wasn't reliable enough to verify directly. Log the form/session/resolved referral code and the outcome of linking + bonus application at every signup, so the next occurrence pinpoints exactly where the code is getting lost instead of guessing again. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add diagnostic logging to referral-signup linking
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.
Bug: Player reported that selling lands by entering a negative number doesn't work (ticket-0020).
Root cause: the price was calculated using the cost of buying additional lands starting from the current amount, rather than the lands being sold.
Fix: adjusted the starting index of the summation function
sum_cost_capped_lineartocurrent - wantedUnitswhen selling.Draft reply:
channel_id=1522322046720147606
author_id=1002628734932762755
Hey <@1002628734932762755>, thanks for letting us know! The math for selling land and cities has been corrected and should be working smoothly on the next deploy.