Files
microfish/docs/engineering-log/2026-08-24-graph-scope-review.md
Kunthawat Greethong 8b84378fe1 feat: SaaS foundation for CrowdSight
Elevate MiroFish/CrowdSight from single-container dev to a SaaS foundation:

- Local memory backend (Zep-compatible): memory services/models, local graph
  builder + updater, AgentActivity seam, import-boundary isolation; Zep stays
  default, local is opt-in behind MEMORY_BACKEND. Semantic parity not yet proven.
- Durable product persistence: projects/simulations/reports schema (migration
  0007) + tenant/owner-scoped ProductRepository + dual-write + scoped_project
  read-first + ArtifactStore abstraction; durable JobQueue + worker.py.
- SaaS hardening: durable RateLimiter (wired to login), UsageService (LLM
  accounting), redacted AuditService, idempotency, CORS allowlist, safe API
  errors, single-use PasswordResetService + endpoints (covers invite-pending).
- Exactly 3 roles (super_admin/admin/user) with tenant authz policy.
- Admin UI: GET/POST/PATCH /api/admin/users + GET/PUT /api/admin/settings
  (super-admin only, encrypted/masked); AdminView.vue + SettingsView.vue with
  admin/super-admin route guards, th/en i18n.
- Production deploy topology: multi-stage Dockerfile (frontend build + gunicorn
  wsgi + nginx SPA-proxy + supervisord worker), backend/wsgi.py, gunicorn dep.

Backend 197 passed; frontend 10 tests + build green. ruff unavailable (gap).
No commit of credentials; secrets handled via env/.env.example.
Deferred: Zep semantic A/B parity, object storage cutover, mobile QA, EasyPanel
container build of deploy topology.
2026-08-31 13:05:21 +07:00

36 lines
2.2 KiB
Markdown

# Graph Scope Review — 2026-08-24
## Scope
Closed the two blockers from the earlier independent review:
1. Project deletion must be organization-scoped and owner-scoped for regular users.
2. Graph read/delete routes must use the local adapter when `MEMORY_BACKEND=local`, without constructing or silently falling back to Zep.
## Changes verified
- `backend/app/api/graph.py` resolves the authenticated actor and routes project/graph access through scoped helpers.
- `backend/app/models/project.py` requires organization scope for project deletion and applies the user-owner restriction where applicable.
- `backend/app/services/local_graph_builder.py` requires organization and project scope and passes graph operations to the tenant-scoped repository.
- `backend/tests/test_graph_backend_routes.py` covers backend dispatch, cross-tenant project/graph behavior, and local graph deletion with nodes and an edge.
## Verification evidence
- Focused regression set: **15 passed**.
- Full backend suite: **72 passed**.
- Frontend contract tests: **10 passed**.
- Frontend production build: **PASS**; existing chunk-size/dynamic-import warnings remain.
- Python `compileall`: **PASS**.
- Added-lines security scan: **0 findings** for hardcoded secrets, shell injection, eval/exec, unsafe pickle, and interpolated SQL patterns.
- `git diff --check`: **PASS**.
- `ruff`: unavailable in the current backend environment; no lint verdict claimed.
## Review gate
Independent review attempts before this entry did not return readable terminal JSON and therefore were fail-closed. Fresh narrow read-only reviewer `deleg_dec1c4b0` then returned the required exact five-key JSON with `passed=true`, empty `security_concerns`, and empty `logic_errors` after reviewing all seven target files. The bounded blocker gate is closed. This does not claim approval, parity completion, production readiness, or full Zep removal.
## Remaining work
- The bounded graph/project/local-memory review gate is closed; continue the staged local-memory consumer cutover and durable resource work.
- Broader migration review, parity, production hardening, and end-to-end tenant matrix remain open.
- No commit, push, or deploy was made during this verification.