feat(data-access): rework Site contentAiConfig (name + index) - #1917
Open
duynguyen wants to merge 2 commits into
Open
feat(data-access): rework Site contentAiConfig (name + index)#1917duynguyen wants to merge 2 commits into
duynguyen wants to merge 2 commits into
Conversation
Add an optional non-empty `name` to the Site `contentAiConfig` schema and a
new `updateContentAiConfig({ name })` setter that merges onto any existing
config, preserving a legacy `index`. `contentAiConfig`, `name`, and `index`
are all optional so pre-existing configs validate without warnings.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Make `name` and `index` equal citizens in `updateContentAiConfig` — both are independently writable and optional, each overwritten only when provided so updating one never clobbers the other. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Reworks the Site
contentAiConfiginspacecat-shared-data-access:name(non-empty when present) to thecontentAiConfigschema.indexfield as an optional, first-class field so pre-existing configs validate without warnings.updateContentAiConfig({ name, index })—nameandindexare equal citizens: both are independently writable and optional, each overwritten only when provided, so updating one never clobbers the other (and existing values are preserved via merge).getContentAiConfig()andConfig.toDynamoItem()serialization are unchanged (pass-through).Contract
contentAiConfig,name, andindexare all optional:getContentAiConfig()isundefined){}{ name }{ index }(legacy){ name, index }{ name: ' ' }updateContentAiConfig(...):{ name }name, preserves existingindex{ index }index, preserves existingname{ name, index }()(no args)Notes
nameis intentionally optional (not required) so existing persisted configs — including ones that only carryindex— validate cleanly and emit no warnings. Downstream readers ofgetContentAiConfig().namemust tolerateundefined.index-only records are preserved as-is.Testing
test/unit/models/site/config.test.jscovering the optional-field matrix, blank-name rejection,updateContentAiConfigname-only / index-only / both / no-arg cases, merge preservation, andtoDynamoItemround-trip.🤖 Generated with Claude Code