feat: schema analyzer modal#258
Conversation
vkarpov15
commented
Jun 2, 2026
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f018bb58f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <div v-if="!validationResult.valid" class="rounded border border-edge bg-muted p-3 text-sm text-content-secondary"> | ||
| {{ validationResult.error }} | ||
| </div> | ||
| <div v-if="Object.keys(validationResult.errors).length > 0" class="rounded border border-edge"> |
There was a problem hiding this comment.
Guard null validation errors before Object.keys
When the API returns a validation result with errors: null (which it does for valid documents and for timeout/non-ValidationError failures), this template still evaluates Object.keys(validationResult.errors), causing Vue to throw instead of rendering the modal result. This makes the new Validate action break on every valid document and on timeout-style invalid results; guard with validationResult.errors && ... or normalize errors to {} before rendering.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Adds a new “Schema Analyzer” UI modal and supporting backend endpoints to analyze a model’s schema against stored documents, including validation results and per-path observed value type distributions. This complements the existing model/document tooling by surfacing schema/data drift and validation failures directly in the Studio UI.
Changes:
- Add backend actions
Model.analyzeSchemaandModel.validateDocumentplus a shared validation-with-timeout helper, and wire them into authorization. - Add a new frontend “Analyze Schema” modal in the Models page and a “Validate” modal action in the Document page.
- Add test coverage for schema analysis sampling, nested paths/arrays (depth-limited), and validation timeout/parallelism behavior.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/Model.analyzeSchema.test.js | Adds tests for schema analysis output, sampling behavior, nested path depth, arrays, and validation timeouts. |
| package.json | Adds direct mpath dependency (used in frontend). |
| frontend/src/models/models.js | Adds state + handler to open the schema analyzer modal. |
| frontend/src/models/models.html | Adds “Analyze Schema” action and renders the modal component. |
| frontend/src/models/analyze-schema-modal/analyze-schema-modal.js | New Vue component to fetch and display schema analysis, with filtering and type visualizations. |
| frontend/src/models/analyze-schema-modal/analyze-schema-modal.html | New modal UI for schema analysis (summary stats, invalid docs list, per-path type breakdown). |
| frontend/src/document/document.js | Adds “Validate Document” modal flow that calls Model.validateDocument. |
| frontend/src/document/document.html | Adds “Validate” menu option and renders validation results in a modal. |
| frontend/src/api.js | Adds frontend API methods for Model.analyzeSchema and Model.validateDocument (lambda + non-lambda). |
| backend/helpers/validateDocumentWithTimeout.js | New helper to validate a hydrated doc with a 1s timeout and return structured error info. |
| backend/authorize.js | Grants roles access to Model.analyzeSchema and Model.validateDocument. |
| backend/actions/Model/validateDocument.js | New backend action to validate a single document by id. |
| backend/actions/Model/index.js | Exports the new Model actions. |
| backend/actions/Model/analyzeSchema.js | New backend action to sample documents, validate them, and compute per-path observed type counts (depth-limited). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.