chore(v2): dead-code purge (fix bundle 3)

~1300 lines removed across four cleanups. Pure deletions; no behavioural
changes.

1. **transaction_processor.py — DELETED (1274 lines).** Orphaned v1 file
   that hasn't been imported anywhere since fix-bundle-1 wired the v2
   distribution chain. The historical Lamassu logic is preserved in git
   history at any commit on main.

2. **views_api.v2_in_progress_stub — DELETED.** The catch-all that
   returned 503 for any unmatched /api/v1/dca/* path. With P3a–P9g
   shipped, every documented endpoint is implemented; the catch-all was
   stale and (per issue #11 M7) unauthenticated, so it leaked the
   extension's existence to anonymous probes. Removed entirely.

3. **tasks.hourly_transaction_polling — DELETED.** v1 LegacyLamassu
   polling no-op. The associated `create_permanent_unique_task` spawn
   in __init__.py is also gone (was spawning a forever-sleeping task
   for no reason).

4. **__init__.py scaffolding artifacts.**
   - Replaced the placeholder "you can debug in your extension using
     'import logger from loguru'" template log with a meaningful
     "satmachineadmin v2 loaded" INFO line.
   - Dropped the now-stale `hourly_transaction_polling` import + spawn.
   - Sorted __all__ (RUF022).

Migration collapse (m001..m007 → single m001_v2_initial) was on the
fix-bundle-3 list but is deferred to a separate PR. The current
migrations are harmless on fresh installs (idempotent CREATE/DROP
chain) and collapsing them risks breaking the LNbits version tracker
on the off chance any operator has v1 data; better to do that as a
dedicated migration-discipline change once we're confident no v1
operator data exists in the wild.

Routes: 34 → 33 (catch-all gone). 76/76 tests pass.

Refs: aiolabs/satmachineadmin#11 — fix bundle 3  (modulo migration
collapse). Remaining in #11: M1-M12 + N1-N12.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-05-14 19:00:43 +02:00
commit b96837164e
4 changed files with 10 additions and 1311 deletions

View file

@ -5,17 +5,16 @@ from lnbits.tasks import create_permanent_unique_task
from loguru import logger from loguru import logger
from .crud import db from .crud import db
from .tasks import wait_for_paid_invoices, hourly_transaction_polling from .tasks import wait_for_paid_invoices
from .views import satmachineadmin_generic_router from .views import satmachineadmin_generic_router
from .views_api import satmachineadmin_api_router from .views_api import satmachineadmin_api_router
logger.debug( logger.info("satmachineadmin v2 loaded")
"This logged message is from satmachineadmin/__init__.py, you can debug in your "
"extension using 'import logger from loguru' and 'logger.debug(<thing-to-log>)'."
satmachineadmin_ext: APIRouter = APIRouter(
prefix="/satmachineadmin", tags=["DCA Admin"]
) )
satmachineadmin_ext: APIRouter = APIRouter(prefix="/satmachineadmin", tags=["DCA Admin"])
satmachineadmin_ext.include_router(satmachineadmin_generic_router) satmachineadmin_ext.include_router(satmachineadmin_generic_router)
satmachineadmin_ext.include_router(satmachineadmin_api_router) satmachineadmin_ext.include_router(satmachineadmin_api_router)
@ -38,19 +37,17 @@ def satmachineadmin_stop():
def satmachineadmin_start(): def satmachineadmin_start():
# Start invoice listener task # bitSpire invoice listener — replaces the v1 SSH/PostgreSQL poller.
invoice_task = create_permanent_unique_task("ext_satmachineadmin", wait_for_paid_invoices) invoice_task = create_permanent_unique_task(
"ext_satmachineadmin", wait_for_paid_invoices
)
scheduled_tasks.append(invoice_task) scheduled_tasks.append(invoice_task)
# Start hourly transaction polling task
polling_task = create_permanent_unique_task("ext_satmachineadmin_polling", hourly_transaction_polling)
scheduled_tasks.append(polling_task)
__all__ = [ __all__ = [
"db", "db",
"satmachineadmin_ext", "satmachineadmin_ext",
"satmachineadmin_static_files",
"satmachineadmin_start", "satmachineadmin_start",
"satmachineadmin_static_files",
"satmachineadmin_stop", "satmachineadmin_stop",
] ]

View file

@ -95,9 +95,3 @@ async def _handle_payment(payment: Payment) -> None:
task.add_done_callback(_inflight_distributions.discard) task.add_done_callback(_inflight_distributions.discard)
async def hourly_transaction_polling() -> None:
"""No-op placeholder. The v1 Lamassu PostgreSQL poller is gone — bitSpire
settlements arrive push-based via Nostr kind-21000 in v2."""
logger.debug("satmachineadmin v2: legacy polling stub (no-op).")
while True:
await asyncio.sleep(3600)

File diff suppressed because it is too large Load diff

View file

@ -733,21 +733,3 @@ async def api_update_super_config(
return config return config
# =============================================================================
# Catch-all stub for endpoints not yet implemented (clients, deposits,
# commission splits, partial-tx, balance-settle, super-config write). Each
# lands in a follow-up commit. The catch-all comes LAST so specific routes
# above take precedence.
# =============================================================================
@satmachineadmin_api_router.api_route(
"/api/v1/dca/{full_path:path}",
methods=["GET", "POST", "PUT", "DELETE", "PATCH"],
)
async def v2_in_progress_stub(full_path: str) -> None:
raise HTTPException(
HTTPStatus.SERVICE_UNAVAILABLE,
f"satmachineadmin v2: /api/v1/dca/{full_path} not yet implemented "
"(landing in P2+). See aiolabs/satmachineadmin#9.",
)