Skip to content

[codex] split instagram runtime facade#4

Draft
rdh073 wants to merge 4 commits into
mainfrom
codex/76350-instagram-runtime-facade
Draft

[codex] split instagram runtime facade#4
rdh073 wants to merge 4 commits into
mainfrom
codex/76350-instagram-runtime-facade

Conversation

@rdh073

@rdh073 rdh073 commented Apr 11, 2026

Copy link
Copy Markdown
Owner

What changed

  • split backend/instagram.py internals into a new backend/instagram_runtime/ package
  • kept backend/instagram.py as the legacy facade entry point
  • moved circuit breaker, auth, relogin, upload payload, and post-job execution concerns into focused runtime modules

Why

backend/instagram.py had grown into a large legacy boundary. This task reduces file size and separates concerns while preserving the legacy import surface expected by the rest of the backend.

Impact

  • existing callers can continue importing from instagram
  • runtime responsibilities are easier to navigate and maintain inside backend/instagram_runtime/
  • application-layer boundaries remain unchanged

Validation

  • .venv/bin/python -c 'import instagram; print(len([s for s in dir(instagram) if not s.startswith("_")]))'
  • timeout 5 .venv/bin/python -m uvicorn app.main:app --port 8002

Xtrzy added 4 commits April 10, 2026 22:36
…ailure

- Explicitly set status='active' in status_repo after relogin, since
  activate_account_client only updates the legacy in-memory state
- Push SSE 'account_updated' event with status='error' when hydrate
  fails and the client was evicted, so the frontend reflects reality
  immediately instead of showing stale 'active' until next refresh
- Skip follower count refresh when the session is dead
…sues

- Refactor bulk_relogin_accounts to delegate to relogin_account via
  asyncio.to_thread, fixing missing status_repo.set('active') on success
  and unreliable username from legacy state dict on SQL backends
- Add type annotation to _hydrate_and_publish usecases parameter
- Remove duplicate 'import time' inside _bulk_hydrate_sequential
- Hoist logger creation outside the loop in _bulk_hydrate_sequential
- Normalize SSE key from 'profile_pic_url' to 'avatar' in verify
  endpoint to match HTTP response key
- SSE: add MAX_RETRIES=10, exponential backoff, connectionLost state
- AppLayout: surface connection-lost banner with role=alert
- Modal: add focus trapping (Tab/Shift+Tab cycling) for a11y
- accountsUI store: remove persist middleware for ephemeral state
- usePostJobStream: relocate to features/posts/hooks (thin re-export)
- AccountsPage: extract 11 components under features/accounts/components
  (1464 → 472 lines)
- OperatorCopilotPage: extract 9 components under features/copilot/components
  (1124 → 612 lines)
- Tailwind: register Tokyo Night palette in @theme for semantic utilities
  (text-tokyo-cyan, bg-tokyo-rose, etc.)
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