feat: extract shared infrastructure into internal/platform layer#2434
feat: extract shared infrastructure into internal/platform layer#2434Al-Pragliola wants to merge 4 commits intokubeflow:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
4927e76 to
bb5a665
Compare
bb5a665 to
a4df2d1
Compare
pboyd
left a comment
There was a problem hiding this comment.
Looks good, in general. I didn't go line-by-line through the added files because I assume they've just been copied. Let me know if there's anything I should pay particular attention to.
I think there's some lost code (at least #2424), and some of the removed comments were probably helpful (mostly, I agree with removing them--but a few have information that's not obvious from the code).
| switch propertyName { | ||
| case "externalId": | ||
| // Match any source prefix: sourceId:externalId | ||
| return "%:" + escapeLike(strVal), true | ||
| case "name": | ||
| // If value already contains ":", treat as full namespaced name — exact match only. | ||
| if strings.Contains(strVal, ":") { | ||
| return nil, false | ||
| } | ||
| // Match namespaced form so model name without source prefix still finds the row. | ||
| return "%:" + escapeLike(strVal), true | ||
| default: | ||
| return nil, false | ||
| } |
There was a problem hiding this comment.
This reverts the change from #2424. Assuming that was unintentional?
| @@ -3,23 +3,13 @@ package datastore | |||
| import "reflect" | |||
|
|
|||
| // Spec is the specification for the datastore. | |||
| // Each entry | |||
There was a problem hiding this comment.
These doc comments aren't perfect, but I think they do have some value. Can we keep them? Looks like they've been removed from a other few files too.
| if isNewEntity { | ||
| if existingUpdateTime == 0 { | ||
| r.setLastUpdateTime(&schemaEntity, now) | ||
| } | ||
| if existingCreateTime == 0 { | ||
| r.setCreateTime(&schemaEntity, now) | ||
| } | ||
| } else { | ||
| if existingUpdateTime == 0 { | ||
| r.setLastUpdateTime(&schemaEntity, now) | ||
| } | ||
| if existingCreateTime == 0 { | ||
| r.setCreateTime(&schemaEntity, now) | ||
| } | ||
| } |
There was a problem hiding this comment.
I know this was just copied here, but I took some AI help with this review and so I'll pass along the finding. The if/else branches here are identical.
| if isNewEntity { | |
| if existingUpdateTime == 0 { | |
| r.setLastUpdateTime(&schemaEntity, now) | |
| } | |
| if existingCreateTime == 0 { | |
| r.setCreateTime(&schemaEntity, now) | |
| } | |
| } else { | |
| if existingUpdateTime == 0 { | |
| r.setLastUpdateTime(&schemaEntity, now) | |
| } | |
| if existingCreateTime == 0 { | |
| r.setCreateTime(&schemaEntity, now) | |
| } | |
| } | |
| if existingUpdateTime == 0 { | |
| r.setLastUpdateTime(&schemaEntity, now) | |
| } | |
| if existingCreateTime == 0 { | |
| r.setCreateTime(&schemaEntity, now) | |
| } |
| @@ -166,7 +150,6 @@ func DecodeCursor(token string) (*Cursor, error) { | |||
| return nil, err | |||
| } | |||
|
|
|||
| // Split only on the first ":" so the value can contain colons (e.g. stored names "sourceId:modelName"). | |||
There was a problem hiding this comment.
A lot of the removed comments are junk, but this one seems like a helpful explanation of something subtle.
| // If we can't parse query parameters, let the request continue | ||
| // The parsing error will be handled elsewhere |
| // parseCipherSuites parses a colon-separated list of cipher suite names | ||
| // and returns the corresponding cipher suite IDs |
There was a problem hiding this comment.
Not the best doc comment. But it at least gives some indication of the expected input format.
Extract reusable infrastructure into internal/platform/ to decouple
shared database, datastore, proxy, and server components from
model-registry-specific internals. This enables new registries
(e.g., catalog) to import platform packages without depending on
model-specific code.
New platform packages:
- errors, apiutils, tls
- db/entity, db/filter, db/repository, db/schema, db/scopes
- db/types, db/constants, db/dbutil, db/utils
- db/{mysql,postgres} with connection, migration, and SQL files
- db/drivers for explicit backend registration
- datastore (connector and repository interfaces)
- proxy (dynamic router and health checks)
- server/middleware (validation and router)
Updates model registry and catalog imports to use platform packages,
converts shared db packages to re-export shims, deletes redundant
originals, and updates tooling paths.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
The platform extraction accidentally reverted the name filter expansion from PR kubeflow#2424. Restores the GetEqualityExpansion logic that allows name = "modelName" to match namespaced stored values (sourceId:modelName), along with the associated tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
- Restore doc comments on Spec struct fields (datastore/repos.go) - Collapse identical if/else branches in PreserveHistoricalTimes logic (generic_repository.go) - Restore helpful comments in paginate.go, validation.go, and tls/config.go Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-Authored-By: Paul Boyd <pboyd@users.noreply.github.com> Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
PR kubeflow#2433 added internal/apiutils import to the MCP catalog test file. After rebase, update to internal/platform/apiutils. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
1f76bcb to
fd8691e
Compare
|
pboyd
left a comment
There was a problem hiding this comment.
Thanks for the changes, @Al-Pragliola.
/lgtm
|
/hold will need to port all the bug fixes from main after the next release |
|
closed in favor of #2644 |
Description
Introduces internal/platform/, a new package tree that separates reusable infrastructure from model-registry-specific internals, then migrates the model registry to use it.
Problem
The catalog (and any future registry) must import packages from the model registry's internal/ tree — internal/db/, internal/datastore/, internal/apiutils/, etc. These packages mix generic database infrastructure with model-registry-specific logic. This makes the model registry the platform itself rather than a consumer of it, and makes it impossible to add a new registry without depending on model-specific code.
What this does
Design constraint
The platform layer has zero imports from model-specific packages. No file in internal/platform/ references internal/core/, internal/db/models/, internal/converter/, internal/server/openapi/, or internal/defaults/.
How Has This Been Tested?
Merge criteria:
DCOcheck)ok-to-testhas been added to the PR.