Repository navigation
Added an opt-in contentType identity option to createAlgoliaRecords - #371
Merged
Merged
Conversation
ref [#213](#213), [#4](#4) Indexing Ghost pages beside posts needs an identity that does not collapse when a post and a page share a slug, and the planned index migration needs every managed record to carry it. This adds the dormant library primitive: a caller that declares its batch as `'post'` or `'page'` content gets the protected `contentId` (the stable Ghost ID) and `contentType` fields repeated in every derived record — fragment, continuation, and fallback alike — measured inside the 9,999-byte record ceiling. Without the option the output stays byte-identical, so the CLI, the Netlify handlers, and the deprecated wrappers are unaffected until they adopt identity after the guarded migration. The two field names are protected in projection validation from now on, so no projection alias can occupy them before identity is switched on.
✅ Deploy Preview for alg-helpcenter ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Independent review flagged that the version plan and README claimed existing consumers were unaffected while the release also reserves `contentId` and `contentType` as protected names, so a configuration that aliased a projection or ranking field to either name starts failing validation after the upgrade. Both now state the contract change and tell affected consumers to rename the alias before upgrading.
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.
ref TryGhost/algolia#213, TryGhost/algolia#4
What
The dormant Ghost content identity primitive for the fragmenter, the first half of the page-capable library primitives slice in the PRD:
createAlgoliaRecordsaccepts an opt-incontentType: 'post' | 'page'option declaring which Ghost Content API resource the batch came from.contentId(the stable Ghost ID) andcontentTypefields, measured inside the 9,999-byte complete-record ceiling.contentIdandcontentTypejoin the protected record names, so projection and ranking aliases can no longer occupy them.INVALID_POLICYbefore any Ghost content is read.What stays the same
Without the option, records are byte-identical to today, so the CLI, the Netlify handlers, and the deprecated wrappers are unaffected. No adapter is activated; posts-only defaults and slug APIs are untouched, per the dormant-release gate in the PRD.
Release notes
contentIdorcontentTypeis now rejected deterministically before network access.@tryghost/algolia-fragmenter.Verification
pnpm testat the root: 531 tests, strict typecheck, lint, and format all pass, including the packed-package acceptance suite and the exact deprecated-wrapper non-regression tests.createAlgoliaRecordsseam cover identity repetition across fragment/continuation/fallback records, the dormant default, invalid content types, protected-name collisions, and a calibrated byte-boundary case proving identity bytes count toward the ceiling.