fix(server): scope observations to their workspace - #1533
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📚 Documentation PreviewThis PR includes documentation changes. A preview has been deployed: Preview for commit e97346d. Updates automatically on new commits. |
da9b9ba to
c4b5734
Compare
c4b5734 to
e97346d
Compare
Description
Observations now carry an explicit workspace owner, so the existing SQL tenancy inspector can enforce workspace isolation on every repository query without a repository-wide bypass. The database also preserves each observation's provenance by requiring its evaluated practice revision and preventing the referenced practice or revision from being deleted while observations still depend on it.
The migration:
observation.workspace_idfrom the owning practice;This PR is the second layer of the stack and targets #1454. Review #1454 first; this PR contains only the observation tenancy and provenance changes on top of it.
Fixes #1505
How to test
Automated validation completed locally on the final commit:
pnpm run formatpnpm run checkObservationRepositoryIntegrationTest— 17 tests passedProductionSchemaContractIntegrationTest— 22 database-contract tests passedMultiTenancyArchitectureTest— 9 architecture tests passedpnpm run db:generate-erd-docsregenerated the ERD successfullyFor a manual smoke test:
workspace_idas its referenced practice and a non-nullpractice_revision_id.Checklist
.changeset/README.md