klaim baseline saldo stabil (V56/B18) + endpoint cek akun payout-eligible /api/voter (V57)
V56/B18: pre-claim liquid balance dibaca SEKALI per window (poll_claim) dan dibawa ke tiap _try_claim_once — klaim yang mendarat di attempt 1 membuat before attempt 2 (ditolak already-claimed) sudah termasuk reward → delta 0 → alert palsu KLAIM MENDARAT · REWARD TAK TERUKUR (kasus 10 Agt: bfa9ab02 reward 1679.3365 vs tx ditolak b0a8b2f9) ; oracle B18 attempt-1-mendarat → claimed + reward asli terukur
V57: db.py single source eligible_voters(owner=None) — SQL jendela payout V40/V52 (last_vote > now−STALE AND first_seen_at IS NOT NULL AND first_seen_at ≤ now−MATURITY, cutoff UTC-naive) dipakai BAIK distribute.py run_distribution (refactor, hapus _eligible_cutoffs) MAUPUN endpoint baru GET /api/voter/<owner> → 200 {owner, is_valid_voter} (DB-snapshot, selalu 200, ⊖ format-validation); BARU/kadaluarsa/hidden/asing → false ; docs §I/§V/V57 + T50 + AGENTS ; oracle test_dashboard (V57 true/false + drift endpoint==db pool + pool distribusi==db) + test_distribute (mock eligible_voters utk no-op, distribusi luas)
This commit is contained in:
1 parent
ee4682da00
commit
8e80653df9
9 files changed
+172
-40
No files matched your search
+5
-4
@@ -88,6 +88,7 @@ def main():
|
||||
tmp = tempfile.mkdtemp()
|
||||
db.DB_PATH = os.path.join(tmp, 'test.db')
|
||||
_orig_query = db.query
|
||||
_orig_eligible = db.eligible_voters
|
||||
# V40: stempel last_vote SEJAK SEKARANG (relatif) agar umur jatuh di band
|
||||
# VALID (3..28 hari) — stempel hardcode berumur <3 hari justru dibuang.
|
||||
fresh = (datetime.now() - timedelta(days=5)).isoformat(timespec='seconds')
|
||||
@@ -149,7 +150,7 @@ def main():
|
||||
|
||||
# ————— V25: no-op — pemilih kosong / saldo kecil —————
|
||||
dist.fetch_balance = lambda: Decimal('100.0000')
|
||||
db.query = lambda sql, params=(): []
|
||||
db.eligible_voters = lambda owner=None: []
|
||||
buf = io.StringIO()
|
||||
with redirect_stdout(buf):
|
||||
rc = dist.run_distribution(dry_run=False)
|
||||
@@ -158,7 +159,7 @@ def main():
|
||||
make_voters_db(db.DB_PATH, [('aaa1', '1.0', 1200.0, '2026-08-05T00:00:00',
|
||||
fresh)])
|
||||
dist.fetch_balance = lambda: Decimal('0.0000')
|
||||
db.query = _orig_query
|
||||
db.eligible_voters = _orig_eligible
|
||||
buf = io.StringIO()
|
||||
with redirect_stdout(buf):
|
||||
rc = dist.run_distribution(dry_run=False)
|
||||
@@ -374,11 +375,11 @@ def main():
|
||||
and 'Gagal: 0' in intern[1][2])
|
||||
|
||||
# no-op (pemilih kosong) → ⊥ notif baru
|
||||
db.query = lambda sql, params=(): []
|
||||
db.eligible_voters = lambda owner=None: []
|
||||
with redirect_stdout(io.StringIO()):
|
||||
dist.run_distribution(dry_run=False)
|
||||
check('V30 no-op ⊥ notif', len(tg['posts']) == 4)
|
||||
db.query = _orig_query
|
||||
db.eligible_voters = _orig_eligible
|
||||
|
||||
# failure (⊥ key) → notif gagal ke INTERNAL saja (ops detail)
|
||||
dist.BP_PRIVATE_KEY = ''
|
||||
|
||||
Reference in new issue
Block a user