Community-VyProjects / Community-VyProjects/VyManager
Organization groundwork: org-scoped connection plumbing
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 446
- Forks
- 65
- Avg merge
- 52m
- Merged PRs (30d)
- 156
Description
Preparation stack for the organization system: every database unit of work moves inside a transaction that carries the request's organization context as SET LOCAL settings (app.org_id, app.is_system_admin). This is the substrate later row-level-security enforcement keys on.
Behavior-invisible by design — no endpoint changes its responses while this stack lands; permission output is proven byte-identical with the golden-file harness at each step, and the full suite stays green throughout.
Planned as three PRs, merged in order:
- Core plumbing — the org_scope module (scoped-connection context manager + FastAPI dependency), middleware org derivation from the active instance, permission-check path on scoped connections, and a guard making the empty-string org id (the no-context sentinel) impossible to collide with a real organization. (PR link when open.)
- Admin surface — session/site/instance, user-management, token and backup handlers take their connection from the dependency; org-context parameter (defaulting to the user's sole org) on the endpoints that have no active instance.
- Adversarial test skeleton — two-organization fixtures, cross-org negative tests that execute today and document current behavior (expected-failure marks until enforcement), and a build-failing canary that flags any handler resolving a database connection outside the sanctioned path, with a reviewed allowlist.
Working rule stated in code and docs: one unit of work = one scoped-connection acquisition; a logically atomic read-modify-write never splits across two.
Streaming surfaces (SSE/console/monitoring) and the remaining DB-backed routers follow in two further batches, after which the canary's burn-down list is empty. Behavior-changing hardening items are tracked as separate issues.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin with the planned org_scope module and FastAPI dependency, then trace middleware organization derivation and the permission-check path on scoped connections. Use the golden-file harness and full suite as the first checks; done requires the ordered plumbing, admin handlers, adversarial fixtures, and canary described in the plan.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python
- Domain
- api, backend, database, security
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100