fix(sl-toolkit): align payload keys with metastore contract (sql_dialect, constraint rule) - #92
Draft
jbotor wants to merge 1 commit into
Draft
fix(sl-toolkit): align payload keys with metastore contract (sql_dialect, constraint rule)#92jbotor wants to merge 1 commit into
jbotor wants to merge 1 commit into
Conversation
…ect, constraint rule) Co-Authored-By: jan.botorek <botorekj@gmail.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
sl-toolkitdocumented payloads diverged from the Metastore's canonical JSON schemas, so a real/sl-buildpush fails with 422 before anything is created. This fixes the two payload-key mismatches and re-points the regression tests (which were pinned to the wrong keys) at the actual contract.Source of truth = the schemas the Metastore validates against, in
keboola/go-monoreposervices/metastore/migrations/schema/:semantic-model_schema_1.0.0.json→required: ["name", "sql_dialect"](snake_case)semantic-constraint_schema_1.0.0.json→required: [..., "rule", ...],additionalProperties: false;ruleExpressionis optional{operator, left, right, bounds}1.
semantic-model:sqlDialect→sql_dialectThe skill sent camelCase; the Metastore's
additionalPropertiesis lax so the unknown key is silently dropped, leaving the requiredsql_dialectmissing → 422 on the first POST, killing the run.Also corrects PR #72, which "fixed" a dialect problem in the wrong direction and locked camelCase in via regression tests. Those tests are inverted here to assert snake_case (with a comment pointing at the metastore schema so the direction can't silently flip again).
2.
semantic-constraint:ruleis required (string)The skill documented only
ruleExpression: {bounds: {...}}; the Metastore requires a stringrule→ 422 missing property 'rule'. Fix documentsruleas the required field and keepsruleExpressionas the optional structured companion (downstream pipelines readruleExpression.bounds; the API enforcesrule). Also notes the constraint schema isadditionalProperties: false(unlike the model), so payloads must be clean.Files
skills/semantic-layer/SKILL.md,commands/sl-build.md— payload docs + POST bodytests/fixtures/{semantic-model,semantic-constraint}.json,tests/schemas/{semantic-model,semantic-constraint}.json— fixtures + local validation schemastests/test_smoke.py,tests/test_skill_consistency.py,tests/README.md— inverted the sql_dialect invariant, added a constraint-ruleinvariant3.0.0→3.0.1(plugin.json,marketplace.json)All 32 plugin tests pass locally.
Out of scope (follow-up)
A third finding —
db_name()hardcodes theKEBOOLA_<projectId>database pattern (wrong on some stacks; should read the real DB off an existing table/dataset FQN) — is intentionally not in this PR. Happy to do it next.Release Notes
Justification, description
Fixes
sl-toolkitsemantic-layer push failures caused by payload keys that don't match the Metastore contract (sql_dialect, constraintrule).Plans for Customer Communication
N/A
Impact Analysis
Docs/fixtures/tests only for the
sl-toolkitplugin; no runtime service code. Unblocks/sl-buildand conversational constraint creation.Deployment Plan
N/A
Rollback Plan
Revert the PR.
Post-Release Support Plan
N/A
Link to Devin session: https://app.devin.ai/sessions/267d4c07e859442c871eb6e817482749
Requested by: @jbotor