Skip to content

refactor(tenant): take the project default from the models package - #23

Merged
KilianBoute merged 1 commit into
mainfrom
refactor/project-scope-from-models
Aug 18, 2026
Merged

KilianBoute merged 1 commit into
mainfrom
refactor/project-scope-from-models

Conversation

@KilianBoute

@KilianBoute KilianBoute commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

Description

This refactor moves project resolution logic to the models package by replacing the direct projectscope dependency with models.ResolveProjectId.

Centralising this behaviour in models improves consistency across services and reduces the risk of different implementations drifting over time, especially during the hidden single-project rollout where project ownership must remain deterministic without relying on database lookups.

The change also simplifies the tenancy package by removing an unnecessary dependency on an internal subpackage and aligning consumers with the public API exposed by models. Updating to github.com/uug-ai/models v1.7.16 consolidates the logic in a single canonical location and cleans up unused transitive dependencies in the module graph.

models folds pkg/projectscope into pkg/models, so the call moves from
projectscope.ResolveProjectId to models.ResolveProjectId. No behaviour
change: the same pure function, resolved the same way.

The asymmetry this module documents is unchanged and is the reason the
default stays in models rather than moving here. Organisation ownership
is verified against persisted records and needs the driver this module
provides; project ownership is defined and must never be queried, so it
belongs where the nine models-only modules can reach it without taking
on mongo.

Requires the models release that carries models.ResolveProjectId; the
go.mod bump lands with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@KilianBoute
KilianBoute merged commit c692d8f into main Aug 18, 2026
5 checks passed
@KilianBoute
KilianBoute deleted the refactor/project-scope-from-models branch August 18, 2026 16:01
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant