Skip to content

fix(server): scope observations to their workspace - #1533

Open
FelixTJDietrich wants to merge 1 commit into
production-readiness-review-e81ofrom
1454-server-scope-observations
Open

fix(server): scope observations to their workspace#1533
FelixTJDietrich wants to merge 1 commit into
production-readiness-review-e81ofrom
1454-server-scope-observations

Conversation

@FelixTJDietrich

@FelixTJDietrich FelixTJDietrich commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

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:

  • backfills observation.workspace_id from the owning practice;
  • rejects cross-workspace practice references with a composite foreign key;
  • changes the practice and practice-revision relationships from destructive deletion behavior to restricted deletion;
  • keeps workspace purge and SCM/conversation erasure working through the explicit workspace column; and
  • updates the generated ERD and adds architecture, repository, erasure, and production-schema regression coverage.

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 format
  • pnpm run check
  • ObservationRepositoryIntegrationTest — 17 tests passed
  • ProductionSchemaContractIntegrationTest — 22 database-contract tests passed
  • MultiTenancyArchitectureTest — 9 architecture tests passed
  • targeted observation consumers — 77 unit tests passed
  • a fresh PostgreSQL schema applied all 950 Liquibase changesets successfully
  • pnpm run db:generate-erd-docs regenerated the ERD successfully

For a manual smoke test:

  1. Apply the Liquibase migration to a database containing observations.
  2. Confirm each observation has the same workspace_id as its referenced practice and a non-null practice_revision_id.
  3. Confirm deleting a referenced practice or practice revision is rejected and the observation remains readable.
  4. Purge a workspace, then confirm its observations and dependent feedback/reaction rows are removed.

Checklist

  • My changeset summary reads as an operator/user-facing note (it becomes the changelog entry) — see .changeset/README.md
  • No operator action is required; the schema migration and backfill run automatically.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f0e94240-cf98-47a7-8619-38656422666b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added documentation Improvements or additions to documentation application-server Spring Boot server: APIs, business logic, database size:XL This PR changes 500-999 lines, ignoring generated files. bug Something isn't working labels Aug 26, 2026
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

📚 Documentation Preview

This PR includes documentation changes. A preview has been deployed:

🔗 View Docs Preview

Preview for commit e97346d. Updates automatically on new commits.

@FelixTJDietrich
FelixTJDietrich force-pushed the 1454-server-scope-observations branch 2 times, most recently from da9b9ba to c4b5734 Compare August 26, 2026 09:43
@FelixTJDietrich
FelixTJDietrich force-pushed the 1454-server-scope-observations branch from c4b5734 to e97346d Compare August 26, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

application-server Spring Boot server: APIs, business logic, database bug Something isn't working documentation Improvements or additions to documentation size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(server): scope observations to their workspace and make provenance pins indestructible

1 participant