Skip to content

fix: surface catalog ID in PromptBuilder#919

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

fix: surface catalog ID in PromptBuilder#919
gspencergoog wants to merge 4 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.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the _BasicPromptBuilder to include the active catalog ID in the system prompt and updates the associated tests and golden files. Review feedback identifies a prompt injection vulnerability due to the lack of sanitization on the catalogId and suggests escaping quotes and newlines. It also recommends adding a test case to handle scenarios where the catalog ID is null to ensure consistent behavior.

Comment thread packages/genui/lib/src/facade/prompt_builder.dart Outdated
Comment thread packages/genui/test/facade/prompt_builder_test.dart
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

1 participant