Skip to content

Suggest: full-serialization fixes for feature-ai-rag (include_items + include_expansion) - #115

Open
reekitconcept wants to merge 2 commits into
feature-ai-ragfrom
kid/114/suggest-include-expansion
Open

Suggest: full-serialization fixes for feature-ai-rag (include_items + include_expansion)#115
reekitconcept wants to merge 2 commits into
feature-ai-ragfrom
kid/114/suggest-include-expansion

Conversation

@reekitconcept

Copy link
Copy Markdown
Member

Fixes #114.

The feature branch forked from main on 2026-07-12, before #106 (fix for #105) landed on main (2026-08-10), so its serialize_brain() still ran the full serialization with no keywords. Two commits, kept deliberately separate:

  1. Cherry-pick of Suggest: do not embed the child listing of folderish suggestions (#105) #106: include_items=False — no per-suggestion catalog query / embedded child listing for folderish types.
  2. New: include_expansion=False — no @components expansion links (breadcrumbs, navigation, actions...) in the type-ahead payload, per @davisagli's review comment on Suggest: do not embed the child listing of folderish suggestions (#105) #106: Suggest: do not embed the child listing of folderish suggestions (#105) #106 (review)

Commit 2 is mirrored as a separate PR against main so the @components fix makes the v2 release; this PR merges only after that one is approved and merged.

Test: test_full_serialization_omits_the_expansion_components added to the serialize_brain suite from #106.

`serialize_brain()` serializes a small set of portal types in full via
`ISerializeToJson` instead of from the catalog brain. plone.restapi resolves
that to `SerializeFolderToJson` for any Dexterity container, which defaults to
`include_items=True` - so for a folderish type every suggestion ran an extra
catalog query and carried its complete child listing (`items`, `items_total`,
`batching`) in the response.

Nothing in the suggest UI consumes those keys, and suggest is a type-ahead
endpoint, so the waste multiplies by keystrokes x suggestions on the one
interaction that is meant to feel instant.

Pass `include_items=False`. Plain `SerializeToJson` accepts and ignores the
keyword, so no type check is needed and non-folderish types are unaffected.

Also lift the inline `["Member"]` literal into `FULL_SERIALIZATION_TYPES`, so
the behaviour is named and the tests can cover it without adding a `Member`
content type to the fixtures.

(cherry picked from commit 439e0bc)
Follow-up to the include_items fix cherry-picked from #106, per David's
review comment on that PR: the full serialization also merged in
expandable_elements(), so every fully serialized suggestion carried the
@components dict (breadcrumbs, navigation, actions...) that the suggest
dropdown never follows. Pass include_expansion=False alongside
include_items=False.

This commit is kept separate from the cherry-pick so it can itself be
cherry-picked onto main for the v2 release, ahead of the feature branch
merge.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants