Skip to content

Development#95

Merged
dangerworm merged 6 commits into
mainfrom
development
Apr 25, 2026
Merged

Development#95
dangerworm merged 6 commits into
mainfrom
development

Conversation

@dangerworm
Copy link
Copy Markdown
Owner

No description provided.

dangerworm and others added 4 commits April 25, 2026 00:17
…istings

Drew-only v1. When a Torn item market scan finds a listing whose
single-unit profit (sell to city) exceeds $5,000, a bargain_alerts
row opens; the frontend polls and surfaces it as a persistent
top-right toast plus an OS-level notification when the tab is hidden.

- V1.25 migration adds bargain_alerts with a partial unique index
  enforcing one active alert per item at the DB layer.
- BargainAlertService.EvaluateAsync hooks DatabaseService.ProcessListingsAsync
  after ReplaceListingsAsync; threshold lives in ProfitThreshold (5_000).
- TornMarketsProcessor overrides a new TryGetPriorityQueueItemAsync
  hook on QueueProcessorBase, interleaving hot items with the normal
  queue (50/50, bounded by MaxInterleaves). Synthetic queue items
  bypass the queue-table mutations.
- AlertsController + IBargainAlertAuthService gate /api/alerts/* on
  BargainAlertsConfiguration.AuthorisedPlayerIds — clean seam for
  the deferred subscriber-ledger extension.
- Frontend BargainAlertsProvider polls /api/alerts/active every 12s
  (always-on so backgrounded tabs still detect; extra fetch on
  return-to-visible). Web-Audio chirp when foregrounded; OS
  notification when hidden. Notification permission prompt fires on
  first user gesture after authorisation succeeds.

ToS / payment-gating extension is deferred — see TODO.md for the
analysis. Plan + verification SQL in context/plans/.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: feda54a99c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread api/TornTools.Cron/Processors/QueueProcessorBase.cs Outdated
Comment thread api/TornTools.Application/Services/DatabaseService.cs Outdated
dangerworm and others added 2 commits April 25, 2026 03:02
Codex review surfaced two issues with the bargain-alerts MR:

1. RunWorkerAsync's `continue` after priority work jumped past the
   per-worker rate-limit delay, so the alternating snipe-loop drove
   call volume to roughly 2x the configured budget. Restructured so
   priority work still skips the queue-table mutations (no DB row to
   increment / remove against) but falls through to the common delay
   block at the bottom of the loop.

2. ProcessListingsAsync only evaluated bargain alerts inside the
   `hasMarketChanged || hasMinimumPriceChanged` branch, so the
   first-scan-of-an-item path (CreateListingsAsync) and the
   no-listings-returned early-return path skipped evaluation.
   Result: bargains present on the first scan never opened, and
   alerts whose listings disappeared entirely never expired.
   Now evaluates on every reachable path.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@dangerworm dangerworm merged commit c5b6b39 into main Apr 25, 2026
1 check passed
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.

1 participant