Skip to content

fix: surface catalog ID in PromptBuilder#919

Open
gspencergoog wants to merge 8 commits into
flutter:mainfrom
gspencergoog:add_catalog_id
Open

fix: surface catalog ID in PromptBuilder#919
gspencergoog wants to merge 8 commits into
flutter:mainfrom
gspencergoog:add_catalog_id

Conversation

@gspencergoog
Copy link
Copy Markdown
Collaborator

Description

This PR Fixes #900 by surfacing the catalog ID in the system prompt generated by PromptBuilder when it is provided in the Catalog.

Changes

  • packages/genui/lib/src/facade/prompt_builder.dart:
    • Added a line to the system prompt: The active catalog ID is: "${catalog.catalogId}". if catalog.catalogId is not null.
  • packages/genui/test/facade/prompt_builder_test.dart:
    • Added a test to verify that the catalog ID is surfaced.
    • Removed the test for null fallback as the implementation was changed by the user to not include the line when null.
  • packages/genui/test/facade/prompt_builder_test.golden/:
    • Updated all 8 golden files to reflect the new prompt content.

Impact & Risks

  • No breaking changes.
  • Minimal risk.

Testing

  • Ran prompt_builder_test.dart and verified that all 10 tests pass.

gemini-code-assist[bot]

This comment was marked as resolved.

@gspencergoog
Copy link
Copy Markdown
Collaborator Author

/gemini review

gemini-code-assist[bot]

This comment was marked as resolved.

…lable active catalog ID

- Escape backslashes (`\`) and carriage returns (`\r`) inside `catalogId` in `prompt_builder.dart` to prevent quote escaping and line-break injections in system prompts.
- Update `SurfaceOperations` documentation and prompt instructions to refer conditionally to the active catalog ID ("if provided"), resolving a logic inconsistency when `catalogId` is null.
- Update test suite and regenerate prompt builder golden files to assert new sanitization patterns and conditional wording.
@gspencergoog gspencergoog requested a review from ditman May 18, 2026 22:43
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.

PromptBuilder doesn't surface the Catalog's id

2 participants