From f1b7b2297ecdad7859c26a2196e11731507fc96c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 4 Apr 2026 05:19:34 +0000 Subject: [PATCH] palette: ensure unique customer IDs in demo scripts This change replaces `random.choices` with `random.sample` in the `get_customer_ids` tasks within `01_getting_started.py` and `02_logging.py`. Using `random.choices` could occasionally lead to duplicate customer IDs in the summary tables, which can be confusing for users following the tutorial. `random.sample` ensures that the five generated IDs are unique, providing a more professional and realistic demo experience. Added a corresponding entry to `.Jules/palette.md` to document this UX improvement. Co-authored-by: ruh-al-tarikh <203426218+ruh-al-tarikh@users.noreply.github.com> --- .Jules/palette.md | 4 ++++ 01_getting_started.py | 3 ++- 02_logging.py | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.Jules/palette.md b/.Jules/palette.md index 74d0394..c9f7b4f 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -17,3 +17,7 @@ ## 2026-04-01 - [CLI Onboarding & Information Density] **Learning:** For terminal-based workflow scaffolds, rendering the flow's docstring as a 'Prefect Workflow Guide' using `rich.Markdown` inside a `rich.Panel` provides immediate, high-quality context to the user. Additionally, adding footers to summary tables (e.g., total items processed) improves information density and allows users to verify outcomes at a glance. **Action:** Incorporate a Markdown-rendered welcome panel at the start of main entry points and include summary footers in result tables to enhance clarity and professional feel. + +## 2026-04-02 - [Realistic Mock Data for CLI Clarity] +**Learning:** In terminal-based demos, using `random.choices` for small mock data sets can lead to duplicate entries, which can confuse users or make the summary tables look broken. +**Action:** Use `random.sample` instead of `random.choices` when generating mock data for tutorial scripts to ensure uniqueness and maintain a professional appearance in terminal output. diff --git a/01_getting_started.py b/01_getting_started.py index 8f31d36..7f64bab 100644 --- a/01_getting_started.py +++ b/01_getting_started.py @@ -14,7 +14,8 @@ def get_customer_ids() -> list[str]: """Fetch customer IDs from a database or API.""" # Use sorted and zero-padded IDs for better terminal alignment - ids = [f"customer-{n:02d}" for n in random.choices(range(100), k=5)] + # Using random.sample ensures unique IDs for a more realistic demo + ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)] return sorted(ids) diff --git a/02_logging.py b/02_logging.py index 3d14d66..1ff8ed1 100644 --- a/02_logging.py +++ b/02_logging.py @@ -15,7 +15,8 @@ def get_customer_ids() -> list[str]: """Fetch customer IDs from a database or API.""" # Use sorted and zero-padded IDs for better terminal alignment - ids = [f"customer-{n:02d}" for n in random.choices(range(100), k=5)] + # Using random.sample ensures unique IDs for a more realistic demo + ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)] return sorted(ids)