make_post_sell/test.ini
russell@unturf.com 157e6f769a
feat: bounded SSE feeds for offer & auction state machines
New text/event-stream endpoints — /o/{offer_id}/events (buyer/seller only)
and /a/{auction_id}/events (public). Each polls the row ~every 1.5s, emits
a `data: {json}` frame on connect and whenever the state-machine state
changes, sends a heartbeat comment, then closes after ~25s so the browser
EventSource reconnects — "bounded" because uWSGI is sync (~16 worker
threads) and a long-lived SSE would starve the pool. Shared helper
lib/sse.py (sse_response / event_stream); it uses its own short-lived DB
session per poll (request.dbsession is already closed by pyramid_tm by the
time the streaming generator runs). Timings come from settings
(app.sse.hold_seconds / app.sse.poll_interval_seconds; test.ini sets them
tiny so the streaming tests finish in ~0.06s).

Client: auction.js opens the EventSource and feeds each frame into its
existing applyState(); it falls back to polling /a/{id}.json every 5s
where EventSource is unavailable. offer.js opens the EventSource on the
offer page and reload()s on a state change (the whole layout depends on
state / can_act). offer.j2 carries data-offer-state. Caddy auto-detects
text/event-stream and stops buffering — no Salt change.

Tests: 4 new functional tests (both endpoints stream the right
content-type + a state frame; 404 for outsiders / unknown ids). 994 passed.
2026-05-12 21:03:50 -04:00

109 lines
3 KiB
INI

[app:main]
use = egg:make_post_sell
pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
sqlalchemy.url = sqlite:///%(here)s/${TEST_DATABASE_PATH:-test_make_post_sell.sqlite}
retry.attempts = 3
session.hashalg = sha512
session.secret = test-secret
session.timeout = 31104000
session.max_age = 31104000
session.reissue_time = 15552000
session.samesite = None
app.root_domain = blanka.foxhop.net
app.bucket.secure_uploads = plan-period-files
app.bucket.secure_uploads.region = nyc3
app.bucket.secure_uploads.post_endpoint = https://nyc3.digitaloceanspaces.com
app.bucket.secure_uploads.get_endpoint = https://plan-period-files.nyc3.digitaloceanspaces.com
app.bucket.secure_uploads.access_key = ${MPS_APP_SECURE_UPLOADS_ACCESS_KEY}
app.bucket.secure_uploads.secret_key = ${MPS_APP_SECURE_UPLOADS_SECRET_KEY}
# stripe test mode is enabled for development & disabled by default.
app.stripe.test_mode = True
# Payment method toggles
app.payments.stripe.enabled = True
app.payments.monero.enabled = False
app.payments.paypal.enabled = True
# MPS-22: feature kill switches — ON in tests so feature tests keep working.
# Production / development.ini default both to False (broken in prod until
# MPS-18 + MPS-19 land). TestKillSwitches builds a fresh app with both off.
app.features.karaoke.enabled = True
app.features.torrent.enabled = True
# Bounded SSE (offer/auction live feeds) — tiny windows so the streaming
# endpoints return almost immediately under webtest instead of holding for
# ~25s. Production / development use the code defaults (25s hold, 1.5s poll).
app.sse.hold_seconds = 0.05
app.sse.poll_interval_seconds = 0.02
# PayPal sandbox mode for testing
app.paypal.sandbox_mode = True
# Monero RPC Configuration for tests
monero.rpc_url = http://127.0.0.1:18083/json_rpc
monero.rpc_user =
monero.rpc_pass =
monero.account_index = 0
monero.quote_expiry_seconds = 900
monero.rate_source_url = https://api.coingecko.com/api/v3/simple/price?ids=monero&vs_currencies=usd
# Monero confirmation requirements by amount tier
# Note: Payment thresholds are now per-shop settings (default $10 and $100)
monero.confirmations.petty = 2
monero.confirmations.mid = 10
monero.confirmations.high = 20
[pshell]
setup = make_post_sell.scripts.pshell.setup
[alembic]
# path to migration scripts
script_location = make_post_sell:scripts/alembic
sqlalchemy.url = sqlite:///%(here)s/${TEST_DATABASE_PATH:-test_make_post_sell.sqlite}
[server:main]
use = egg:waitress#main
listen = localhost:6502
[loggers]
keys = root, make_post_sell, sqlalchemy
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = INFO
handlers = console
[logger_make_post_sell]
level = DEBUG
handlers =
qualname = make_post_sell
[logger_sqlalchemy]
level = DEBUG
handlers =
qualname = sqlalchemy.engine
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s