feat!: require ordered axis in custom categoryNames#21
Merged
antonstefer merged 2 commits intoApr 28, 2026
Conversation
Replace the silent House-prepend fallback in generate() with an
explicit error when a user-supplied categoryNames list contains no
category with ordered: true. The default-categories path (when
categoryNames is omitted) is unchanged.
The previous behavior silently changed the puzzle shape — pass 4
themed categories, get a puzzle with 5 columns including an
unrelated 'House 1/2/3/4'. That violates the project's
no-silent-fallbacks rule and surprises callers who expected their
category list to be respected.
BREAKING CHANGE: generate({ categoryNames: [...] }) now throws when
no category has ordered: true. Migration: prepend
defaultHouseCategory(size) to categoryNames, or mark a
domain-relevant category as ordered: true with orderingPhrases.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
logic-grid | e55319c | Commit Preview URL Branch Preview URL |
Apr 28 2026, 11:59 AM |
Adds a positive test for the new validation in generator.ts so that a future refactor that drops the throw fails CI.
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
Replace the silent
Houseauto-prepend at generator.ts:177-179 with an explicit error when a user-suppliedcategoryNameslist contains no category withordered: true.Before:
generate({ categoryNames: [4 unordered] })→ silently mutates input to 5 categories (House + your 4) and proceeds.After: same call → throws with a message that explains the requirement and points to
defaultHouseCategory(size)as the escape hatch.The default path (no
categoryNamessupplied) is unchanged — it still prependsHousetoDEFAULT_CATEGORIESbecause that contract is internal.Why
Throw on errors — never silently swallow or use fallback valuesrule.Migration
The error message itself includes this hint.
Implementation notes
validateCategories(categories)so existing structural errors (duplicate values, duplicate names, missing verbs) still surface first when present.logic-grid-aiis unaffected:validateThemeResultalready requires an ordered axis on AI output, sogenerateThemeresults always satisfy the new contract.defaultHouseCategory(size).Release impact
feat!:triggers a major bump → release-please will propose logic-grid 3.0.0. After it lands,logic-grid-ai's peerDep should bump to^3.0.0in a follow-up commit so a correspondinglogic-grid-aimajor is cut.