Files
microfish/docs/engineering-log/2026-08-24-memory-parity-panorama-insight.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

2.5 KiB

Local Memory Parity Slice — 2026-08-24

Scope

Bounded local-memory compatibility work only:

  • LocalMemoryTools.panorama_search now preserves the legacy all-graph inventory contract while relevance-ranking active and historical facts.
  • LocalMemoryTools.insight_forge now derives entity insights and relationship chains from matching edges with the legacy-compatible output shape.
  • LocalEntityReader rejects explicitly supplied graph IDs that differ from its repository-bound graph ID.
  • MEMORY_BACKEND=zep remains the default compatibility path; this slice does not remove Zep or cut over ReportAgent/ProfileGenerator globally.

TDD evidence

  1. Added backend/tests/fixtures/memory_parity/tools_fixture.json with three entities, current and invalidated temporal edges, and one unrelated active edge.
  2. Added backend/tests/test_memory_parity.py covering panorama inventory/temporal behavior, insight entity/relationship shape, and five conflicting graph-ID call forms.
  3. Ran the new tests before the production change; the suite failed for the expected missing parity and scope behaviors.
  4. Implemented the minimal adapter and reader changes.
  5. Re-ran the focused parity suite: 8 passed.

Verification

  • Focused consumer regression set: 17 passed.
  • Backend full suite: 81 passed.
  • Python compileall: PASS.
  • git diff --check: PASS.
  • Added-lines security scan: 0 findings.
  • ruff: unavailable in the backend environment; no lint pass is claimed.
  • A probe run from repository root failed because that cwd cannot resolve the backend pytest executable; the same probe rerun from backend/ passed 8/8. This is a command-location issue, not a test failure.

Independent review gate

  • The first bounded reviewer was stopped after exceeding the context/time budget; its silence was not treated as approval.
  • Replacement reviewer: deleg_73fac0de.
  • Required five-key JSON verdict: passed=true, security_concerns=[], logic_errors=[].
  • Non-blocking suggestion: consider future LLM query decomposition for insight_forge; local sub_queries=[query] remains an explicit semantic gap outside this slice.
  • This closes the review gate for this slice only. It is not approval of full semantic parity, the broader migration, or production readiness.

Remaining boundary

This proves only the bounded panorama/insight/entity-reader contract. It does not prove semantic LLM parity (sub_queries remains local [query]), complete graph/profile/simulation/report E2E, all local consumer cutovers, migration parity, or production readiness.