Skip to content

Conversation

@GreenVenom77
Copy link
Owner

@GreenVenom77 GreenVenom77 commented Oct 15, 2025

AI-Generated Pull Request Summary

Summary

This PR adds comprehensive item filtering functionality to the TrackHub app, enabling users to filter items by category and manufacturer. It also implements pagination for hub items to improve performance and enhances the UI with improved filtering controls and a customizable top bar.

Technical Changes

  • Item Filtering System — Implemented FilterDropdown component in core-ui with selectedItem: String, onItemSelected: (String) -> Unit callbacks, and ExposedDropdownMenuBox with FilterChip and DropdownMenuItem states. Created FilterDropdownRow component in feat-hub that manages filter state for category and manufacturer, with conditional rendering parameters.

  • Database Filtering Query — Added ItemDao.getItemsWithFiltersPaged() method with hubId: String, category: String?, manufacturer: String? parameters and SQL query with optional WHERE clauses using NULL checks, returning PagingSource<Int, ItemEntity> for efficient pagination.

  • Repository & ViewModel Updates — Modified HubRepository.getHubItems() to accept categoryIds/manufacturerIds parameters and use Room @query with optional IN clauses, returning Flow<PagingData> via Pager(pageSize=20). Updated HubDetailsViewModel to manage filter state and apply filters to the data stream.

  • Hub Data Model Enhancements — Updated HubEntity to enforce non-nullable categoryIds: List using TypeConverter, added Room migration with NOT NULL constraints, and updated HubInsertRequest/HubUpdateRequest DTOs to include category and manufacturer lists.

  • Pagination Implementation — Replaced direct list queries with PagingSource implementation to handle large datasets efficiently, reducing memory usage and improving scrolling performance in hub item lists.

  • UI Component Improvements — Enhanced TopAppBar with showLogo: Boolean parameter and improved Filter UI with better state management, accessibility, and visual feedback in filter dropdown components.

This commit introduces pagination for displaying items within a Hub, improving performance and user experience for large lists of items.

Key changes include:

*   **Paging Implementation:**
    *   Integrated `androidx.paging` library for item list pagination.
    *   `HubRepository.getItemsFromHub` now returns a `Flow<NetworkResult<Flow<PagingData<Item>>, NetworkError>>`.
    *   `HubRepositoryImpl` uses `Pager` to fetch and page items from `HubCacheDataSource.getItemsFromHubPaged`.
    *   `HubDetailsState` now holds `items` as a `Flow<PagingData<Item>>`.
    *   `HubDetailsScreen` uses `collectAsLazyPagingItems` to observe and display paged items in a `LazyColumn`.
*   **Database & DAO Updates:**
    *   Created `ItemDao` to handle all item-related database operations, separating them from `HubDao`.
    *   `HubDao` no longer handles item operations directly.
    *   `ItemDao` includes `getItemsFromHubPaged` and `getItemsWithFiltersPaged` to support pagination.
    *   `TrackHubDatabase` now provides `itemDao`.
    *   `ItemEntity` now has indices on `name`, `manufacturer`, and `category` for improved query performance.
*   **Cache DataSource Refactoring:**
    *   `HubCacheDataSource` and `HubRoomDataSource` now return `Flow<List<HubEntity>>` for `getOwnHubs` and `getSharedHubs` instead of mapped `Hub` objects, with mapping now handled in the `HubRepositoryImpl`.
    *   Item-related methods in `HubCacheDataSource` and `HubRoomDataSource` were updated to use `ItemDao` and support paging (e.g., `getItemsFromHubPaged`).
*   **Dependency Injection:**
    *   `HubFeatureModule` updated to provide `ItemDao` to `HubRoomDataSource`.
    *   `LocalModule` updated to provide `ItemDao`.
*   **Build Configuration:**
    *   Added `androidx.paging.runtime` and `androidx.paging.compose` dependencies.
…ncing

This commit introduces item filtering by category and manufacturer in the HubDetails screen and significantly refactors how hub items are synced and fetched.

**Key Changes:**

*   **Hub Item Filtering:**
    *   Added `FilterItems` action to `HubDetailsAction`.
    *   `HubDetailsViewModel` now accepts `category` and `manufacturer` parameters in `getHubItems` to filter the item list.
    *   When `FilterItems` action is dispatched, the existing `itemsCollectionJob` is cancelled and restarted with the new filter parameters.
    *   `HubRepository` and its implementation now accept `category` and `manufacturer` in `getItemsFromHub`.
    *   `HubCacheDataSource` and `ItemDao` were updated with `getItemsWithFiltersPaged` to support filtered pagination from the local database.
    *   Removed the unused `getItemsFromHubPaged(hubId: String)` from `ItemDao` and `HubCacheDataSource`.

*   **Optimized Hub Item Syncing in `HubRepositoryImpl`:**
    *   Introduced `startHubSync(hubId: String)` which creates a shared, long-lived flow for syncing a specific hub's items.
        *   This flow handles both initial cache loading and continuous remote data fetching and updating.
        *   It uses `shareIn` with `SharingStarted.WhileSubscribed(5000)` to keep the sync active for a short period after the last subscriber disconnects, reducing redundant sync operations.
        *   A `hubSyncFlows` map manages active sync flows per `hubId`.
    *   The main `getItemsFromHub` function is now lightweight. It primarily ensures the sync flow for the given `hubId` is active and then returns a new `Pager` flow based on the current filters (`category`, `manufacturer`) applied to the cached data via `cacheDataSource.getItemsWithFiltersPaged`.
    *   This separation ensures that data synchronization happens independently of UI filtering, making the process more efficient and responsive.
    *   Page size for item fetching changed from 12 to 10.

*   **ViewModel and State Handling:**
    *   `HubDetailsViewModel` no longer fetches the hub details within the `getHubItems` function; it's now done separately in the `init` block.
    *   The `itemsCollectionJob` in `HubDetailsViewModel` is now non-nullable and initialized in the `init` block.
    *   Loading indicator logic in `getHubItems` was slightly adjusted.

This refactoring improves performance by optimizing data synchronization, makes the UI more responsive by separating sync from filtering, and adds the requested filtering functionality.
This commit introduces a `showLogo` boolean parameter to the global `Scaffold` and `TopAppBar` to allow conditionally hiding the logo. This is useful for screens where the title is sufficient and the logo is not needed, such as the `HubDetailsScreen`.

Key changes:
- Added `showLogo: Boolean` to `ScaffoldState`, `ScaffoldViewModel`, and the `SetScaffold` utility, defaulting to `true`.
- The `TopAppBar` composable now accepts a `showLogo` parameter to control the visibility of the app logo.
- `HubDetailsScreen` now sets `showLogo = false` to hide the logo in its `TopAppBar`.
- Changed the default value of `animateIcon` to `true` in `FloatingButton`.
This commit introduces filtering capabilities to the Hub Details screen, allowing users to filter items by category and manufacturer. It also includes several dependency updates and UI refinements.

### Key Changes:

**Features & UI:**
- **New `FilterDropdown` Composable:** Added a new generic `FilterDropdown` composable in the `core-ui` module. This component uses `FilterChip` to display a dropdown menu for selection.
- **Filter Bar in Hub Details:** Implemented a `FilterDropdownRow` on the `HubDetailsScreen` to host dropdowns for category and manufacturer filtering.
- **No Items Found Message:** The `HubDetailsScreen` now displays a "No items found" message when the item list is empty.
- **Internationalization:** Added new strings for "All Categories," "All Manufacturers," and "No items found" in both English and Arabic.

**State & Logic:**
- **Filtering Logic:** Updated `HubDetailsViewModel` to handle the `FilterItems` action, which updates the state with the selected category and manufacturer.
- **State Update:** Added `selectedCategory` and `selectedManufacturer` fields to `HubDetailsState` to manage the filter state.
- **UI Refinements:**
    - Item list cards in `HubDetailsScreen` now have adjusted padding and a subtle `animateItem` effect.
    - Fixed a potential nullability issue in `ItemListCard` by ensuring `hubItem.createdAt` is non-null.

**Dependencies:**
- Upgraded `androidx.compose.material3` from `1.3.2` to `1.4.0`.
- Added the `androidx.compose.material:material-icons-extended` dependency.
This commit introduces several refinements to the UI and validation logic.

- **`FilterDropdown`**:
    - The `ExposedDropdownMenu` is now properly anchored to the `FilterChip` by adding `menuAnchor(ExposedDropdownMenuAnchorType.PrimaryNotEditable)` to prevent the keyboard from appearing on click in Android 13+.

- **`FilterDropdownRow`**:
    - Adjusted the `horizontalArrangement` from `spacedBy(12.dp)` to `SpaceBetween` for better alignment.
    - Increased the width of the category and manufacturer dropdowns to `200.dp` for improved readability.

- **`ValidateInput`**:
    - Updated the email validation regex for better accuracy.
This commit refactors the hub item synchronization logic for better performance and data consistency, and introduces several dependency updates and UI improvements.

### Key Changes:

**Data & Syncing:**
- **Synchronous Cache Access:** `ItemDao.getItemsFromHub` and its implementations (`HubCacheDataSource`, `HubRoomDataSource`) are now synchronous, returning `List<ItemEntity>` instead of a `Flow`. This ensures that item comparisons within the sync logic are performed against the most current snapshot of the database.
- **Optimized Sync Logic (`HubRepositoryImpl`):**
    - The `startHubSync` function no longer maintains a separate `currentItems` set. Instead, it directly compares remote items with the items fetched from the cache (`cacheDataSource.getItemsFromHub`) to determine which items are new or have been deleted.
    - Removed unnecessary initial cache loading within the `channelFlow`, simplifying the sync process.
- **Improved Paging Flow (`HubRepositoryImpl`):**
    - `getItemsFromHub` now uses `channelFlow` to better manage the lifecycle of the sync job, ensuring it's cancelled when the collector is no longer active (`awaitClose`).
- **ViewModel Caching:**
    - Item paging data is now cached within the `viewModelScope` using `.cachedIn(viewModelScope)` in `HubDetailsViewModel`, preventing re-fetching on configuration changes.

**UI & ViewModel:**
- **Loading Indicators:** Added `ShowLoading` and `HideLoading` actions around all asynchronous operations in `HubDetailsViewModel` (add/update/delete for hubs and items) to provide better user feedback.

**Dependencies:**
- Upgraded Ktor from `3.2.3` to `3.3.0`.
- Upgraded Supabase from `3.2.2` to `3.2.4`.
- Added the `ktor-client-logging` dependency to enable network request logging.
…ists

This commit removes nullability from the `manufacturerList` and `categoryList` fields across various data layers, ensuring they are always initialized as non-null `List<String>`. This change simplifies the data models and reduces the need for null checks.

### Key Changes:

*   **Data Models:** Updated `Hub` (domain model), `HubEntity` (cache entity), `OwnedHubResponse`, `SharedHubResponse` (network DTOs), and `HubUpdateRequest` to use non-nullable `List<String>` for `manufacturerList` and `categoryList`.

*   **UI Logic:** In `HubDetailsScreen`, the logic for adding a new manufacturer or category is updated to reflect the non-nullable list, removing safe calls (`?.`) when appending new items.
This commit introduces several user experience improvements to the filtering mechanism and refactors the hub update process to ensure UI consistency.

### Key Changes:

-   **Filter Deselection:**
    -   The `FilterDropdown` composable now allows users to deselect a currently selected filter by clicking on it again, which reverts the selection to the default item (e.g., "All Categories").

-   **Filter State Management:**
    -   `FilterDropdownRow` now manages its own `selectedCategory` and `selectedManufacturer` state using `rememberSaveable`.
    -   The `onItemSelected` callbacks now pass `null` when a filter is deselected, simplifying the filtering logic in the ViewModel.
    -   Removed the unused `label` parameter from `FilterDropdown`.

-   **Hub Update Logic:**
    -   `HubRepository` and `HubRepositoryImpl`'s `updateHub` function now returns `NetworkResult<Hub, NetworkError>` instead of `EmptyResult`. This allows the updated hub object to be passed back to the caller.
    -   `HubDetailsViewModel` now uses this returned hub object to update the `hub` in its state upon a successful update. This ensures the UI immediately reflects the changes without needing a separate refresh.
    -   The logic in `HubDetailsScreen` that navigated back after a hub update has been removed, as the screen now updates in place.
This commit updates the process of creating a new Hub to include lists for manufacturers and categories. It also includes several refactoring improvements for code clarity and consistency.

### Key Changes:

**Features:**
-   **`HubInsertRequest`:** Added `manufacturerList` and `categoryList` fields to the `HubInsertRequest` data class. This allows these lists to be specified when a new hub is created.
-   **`HubListViewModel`:** When creating a new hub, the `addHub` action now sends empty lists for `manufacturerList` and `categoryList` by default.

**Refactoring & Fixes:**
-   **`HubInsertRequest`:** Renamed the `userId` field to `ownerId` because it wasn't in the remote table.
-   **`ClientFactory`:**
    -   Renamed `createSupabaseClient` to `buildSupabaseClient` for more descriptive naming.
    -   Updated Supabase plugin installation to use the modern singleton syntax (e.g., `install(Postgrest)` instead of `install(Postgrest.Companion)`).
-   **`HubSupabaseDataSource`:** Switched to using `apply` for modifying the `HubInsertRequest`, sending the actual request instead of unit.
-   **`BuildNetworkError.kt`:** Removed a redundant null-check, simplifying the error message handling logic.
This commit introduces a new GitHub Actions workflow (`auto-pr.yml`) that automatically generates and updates the description for pull requests.

The workflow triggers on the `opened` and `synchronize` events of a pull request. It uses the `octue/generate-pull-request-description` action to create a summary from the commit messages and then updates the pull request body using the `riskledger/update-pr-description` action.
This commit replaces the `octue/generate-pull-request-description` GitHub Action with a new, custom workflow (`auto-pr-description.yml`) that generates a pull request description using an AI model via the OpenRouter API.

### Key Changes:

-   **Deleted Workflow:** The existing `auto-pr.yml` workflow, which used a third-party action to generate PR descriptions, has been removed.
-   **New Workflow (`auto-pr-description.yml`):**
    -   Triggers on `pull_request` `opened` and `reopened` events.
    -   Collects commit messages and a `git diff --stat` summary to use as context for the AI.
    -   Sends a request to an AI model through the OpenRouter API to generate a structured PR description.
    -   Appends the AI-generated summary to the existing pull request body, preserving any manually written content.
This commit enhances the `auto-pr-description.yml` GitHub Actions workflow to improve its reliability and efficiency.

### Key Changes:

- **Full History Fetch:** Changed `actions/checkout@v4` to use `fetch-depth: 0` to ensure the full git history is available for generating accurate diffs against the base branch.
- **Fetch Base Branch:** Added a step to explicitly fetch the base branch (`${{ github.event.pull_request.base.ref }}`) to prevent errors when comparing commits.
- **Context Truncation:** Implemented a size check to truncate the generated `context.txt` file (commit messages and diff summary) if it exceeds 25KB. This prevents potential API errors with very large pull requests.
- **Refined AI Prompt:** The prompt sent to the AI for generating the PR description now includes a constraint to keep the response under 500 words.
- **Error Handling:** Added fallback messages (`(No commits found)` and `(No diff found)`) to handle cases where git log or git diff commands might fail or produce no output.
This commit updates the GitHub Actions workflow responsible for generating automatic pull request descriptions.

### Key Changes:

- **Model Update:** Switched the AI model from `gpt-oss-20b` to `deepseek-r1t2-chimera:free`.
- **Prompt Refinement:** Adjusted the prompt to request a clearer summary and avoid unnecessary information.
- **Improved PR Body Update:** Modified the script that updates the pull request body. It now writes the new content to a temporary file (`new_body.txt`) and uses `gh pr edit --body-file` to apply the update. This approach is more robust for handling multiline content and special characters.
This commit modifies the prompt used to generate automatic pull request descriptions in the `auto-pr-description.yml` GitHub workflow. The instruction to the model is updated to keep the response under 500 words, ensuring more concise and readable summaries.
This commit updates the language model used in the `auto-pr-description.yml` GitHub workflow. The model has been changed from `deepseek-r1t2-chimera:free` to `qwen3-coder:free`.
This commit modifies the `auto-pr-description.yml` GitHub Actions workflow to improve its behavior.

- The workflow trigger is updated to run on `synchronize` events, in addition to `opened` and `reopened`, ensuring the AI-generated description is updated whenever new commits are pushed to the pull request.
- The step that updates the pull request body has been changed to overwrite the existing content entirely, rather than appending the new summary. This prevents the accumulation of outdated summaries on subsequent updates.
- A minor typo in the OpenAI prompt content ("Info" to "info") has been corrected.
This commit updates the large language model used in the `auto-pr-description.yml` GitHub Actions workflow.

The model has been changed from `qwen3-coder:free` to `tngtech/deepseek-r1t2-chimera:free` to leverage a different model for generating pull request descriptions.
This commit updates the GitHub Actions workflow for automatic PR descriptions.

- The language model has been changed from `tngtech/deepseek-r1t2-chimera:free` to `qwen/qwen3-coder:free`.
- The system prompt has been enhanced to instruct the model to analyze the diff summary for meaningful changes, especially when commit messages are vague.
This commit updates the prompt used by the `auto-pr-description.yml` GitHub workflow to generate more effective and structured pull request descriptions.

The new prompt is designed to produce descriptions that cater to both stakeholders and developers. It emphasizes explaining the business value and user-facing changes, followed by the technical implementation details.

Key changes to the prompt instructions:
- Mandates "Summary" and "Key Changes" sections.
- The summary must now explain the what, why, and business/technical value.
- "Key Changes" must follow a "What changed — How it was implemented" structure.
- Provides clearer guidelines on what to include (e.g., key technologies, architectural patterns) and what to exclude (e.g., line counts, minor changes).
This commit updates the AI model used for automatically generating pull request descriptions in the `auto-pr-description.yml` workflow.

The model has been changed from `openai/gpt-oss-20b:free` to `z-ai/glm-4.5-air:free`.
This commit updates the prompt for the `auto-pr-description.yml` workflow to generate more technical and developer-focused pull request descriptions.

The new prompt is designed to produce a concise summary and a list of specific technical changes, emphasizing implementation details, key classes, libraries, and architectural patterns. It explicitly instructs the model to omit business justifications and marketing language in favor of precise, actionable information for code reviewers and future maintainers.
This commit updates the language model used in the `auto-pr-description.yml` GitHub Actions workflow.

The model has been changed from `z-ai/glm-4.5-air:free` to `nvidia/nemotron-nano-9b-v2:free`.
This commit updates the language model used in the `auto-pr-description.yml` GitHub Actions workflow.

The model has been changed from `nvidia/nemotron-nano-9b-v2:free` to `mistralai/devstral-small-2505:free` for generating pull request descriptions.
This commit updates the prompt for the `auto-pr-description.yml` GitHub workflow to generate more detailed and specific technical pull request descriptions.

The prompt instructions were revised to demand code-level details, including specific method signatures, parameter names, state management approaches (e.g., `StateFlow`), and database query specifics (e.g., `IN (:categoryIds)`). The examples were also updated to reflect this higher level of detail, guiding the model to produce descriptions that allow developers to understand the implementation without needing to read the code directly.
This commit refines the `auto-pr-description.yml` GitHub Actions workflow to generate more concise and meaningful pull request descriptions. It improves the diff collection process and provides the AI with a more focused and structured prompt.

### Key Changes:

- **Diff Collection:**
    - The workflow now captures the full `git diff` instead of just the `--stat` summary, providing the AI with actual code changes for better context.
    - Implemented a truncation strategy for large diffs. If the diff exceeds a size limit, it falls back to a more compact `diff --unified=1` format and includes a note that the content has been truncated.

- **Prompt Engineering:**
    - The prompt for the AI has been rewritten to emphasize summarizing functional changes rather than listing modified files.
    - New instructions guide the AI to group related changes into a single bullet point, focus on architectural impact, and prioritize major features over minor tweaks.
    - Updated examples and "anti-examples" are provided to better steer the AI toward generating high-quality, developer-focused technical summaries.

- **Workflow Scripting:**
    - The method for setting multi-line GitHub Actions outputs has been updated to a more robust `echo "key<<EOF" ... "EOF"` block format.
This commit removes the parentheses from the fallback messages in the `auto-pr-description.yml` workflow.

When no commits or diffs are found, the output messages will now be "No commits found" and "No diff found", instead of "(No commits found)" and "(No diff found)". This provides a cleaner presentation in the generated pull request description.
This commit refactors the `auto-pr-description.yml` GitHub Actions workflow to improve its readability and robustness.

### Key Changes:
- **Heredoc for JSON Payload:** The `curl` command now uses a `heredoc` (`<<'JSON'`) to pass the JSON payload. This improves readability and maintainability by allowing the JSON to be written naturally without escaping.
- **Quoted GitHub Output Redirection:** The redirection to `$GITHUB_OUTPUT` is now properly quoted (`>> "$GITHUB_OUTPUT"`) to prevent potential word-splitting issues and ensure robustness.
- **Simplified Script Logic:** Removed several unnecessary comments and simplified the shell script logic, particularly around generating context and handling truncation.
This commit refactors the `auto-pr-description.yml` GitHub workflow to enhance its reliability and the quality of generated pull request descriptions.

### Key Changes:

- **Truncation Logic:** Improved the logic for handling large diffs. Instead of just truncating the file, the workflow now regenerates the diff with a reduced context (`--unified=1`) to capture more changes within the size limit.
- **Diff Generation:** The `git diff` command now captures the full diff of code changes, not just file stats, providing better context for the AI model.
- **Shell Scripting:**
    - Replaced the use of `@- <<'JSON'` with a single-quoted JSON string in the `curl` command. This change prevents issues with special characters in the prompt content.
    - Added proper multiline output formatting for setting GitHub Actions outputs, ensuring the full context and generated description are passed correctly to subsequent steps.
This commit refines the `auto-pr-description.yml` GitHub workflow to generate more focused and robust pull request descriptions.

### Key Changes:

*   **Diff Filtering:**
    *   The `git diff` command now uses `--diff-filter=AM` to ensure that only added and modified files are included in the context provided to the AI. This prevents deleted or renamed files from influencing the summary.

*   **Improved Context & Truncation:**
    *   The workflow now includes a summary of changed files (added and modified) in the context.
    *   Truncation logic is improved to handle large diffs more gracefully, ensuring the most relevant parts (commits and the start of the diff) are preserved within size limits.

*   **Enhanced Prompting & Output:**
    *   The prompt for the AI model now explicitly instructs it to focus only on added and modified files.
    *   The generated PR description now includes a footer indicating it was auto-generated and based only on added/modified files.

*   **Scripting & Readability:**
    *   The shell script logic for handling multiline outputs (`GITHUB_OUTPUT`) and creating the API payload and PR body has been improved using HEREDOCs and temporary files, making the workflow script cleaner and more reliable.
This commit adjusts the indentation and removes the footer from the AI-generated pull request descriptions in the `auto-pr-description.yml` GitHub workflow. The summary content is now indented for better visual structure within the PR body.
This commit enhances the `auto-pr-description.yml` GitHub Actions workflow to make it more robust and reliable.

Key changes include:

*   **Error Handling:**
    *   Added comprehensive error handling for the `curl` call to the OpenRouter API. The workflow now checks the HTTP status code and handles non-200 responses gracefully.
    *   Implemented JSON validation to ensure the API response is well-formed before attempting to parse it.
    *   The PR description now indicates if the AI generation failed, providing context like the HTTP status code or parsing errors.

*   **Code Quality & Cleanup:**
    *   The `git fetch` command now fetches the full history of the base branch instead of using `--depth=1`, ensuring a complete context for diff generation.
    *   Added cleanup steps to remove temporary files (`context.txt`, `payload.json`, `new_body.txt`) after they are used, keeping the runner environment clean.
    *   Improved the final `gh pr edit` step with success and failure logging.
This commit enhances the error handling in the `auto-pr-description.yml` GitHub workflow to provide more detailed and actionable feedback when AI description generation fails.

### Key Changes:

- **Detailed HTTP Error Messages:**
  - When an API call fails (non-200 status code), the workflow now generates a comprehensive error message in the PR description.
  - This message includes the HTTP status code, the error message extracted from the API response body, a list of possible causes (e.g., invalid API key, rate limiting), and the raw API response for debugging.

- **Handling of Empty/Null AI Responses:**
  - If the API call is successful but returns an empty or null description, a specific error message is now displayed.
  - This message includes possible causes (e.g., filtered content) and the raw API response.

- **Invalid JSON Response Handling:**
  - If the API response is not valid JSON, the workflow now provides a detailed error message explaining the failure.
  - This includes potential causes like the API returning an HTML error page and the raw response body.
This commit updates the language model used in the `auto-pr-description.yml` GitHub workflow.

The model has been changed from `mistralai/devstral-small-2505:free` to `z-ai/glm-4.5-air:free`.
This commit updates the language model used in the `auto-pr-description.yml` GitHub workflow.

The model has been changed from `mistralai/devstral-small-2505:free` to `z-ai/glm-4.5-air:free`.
This commit updates the language model used in the `auto-pr-description.yml` GitHub workflow.

The model has been changed from `mistralai/devstral-small-2505:free` to `z-ai/glm-4.5-air:free`.
…orkflow

This commit refactors the `auto-pr-description.yml` GitHub Actions workflow to improve its reliability and readability.

Key changes include:

*   **Error Handling:** Added `set -e` to the beginning of all key shell scripts. This ensures that the workflow will fail immediately if any command fails, preventing unexpected behavior.
*   **Readability & Consistency:**
    *   Explicitly set `shell: bash` for all relevant steps.
    *   Simplified the process of setting multiline outputs (`context` and `description`) by using heredoc syntax directly with `cat` and `echo`, making the script cleaner and more robust.
    *   Removed redundant comments and `2>/dev/null` error suppression, relying on `set -e` for clearer error reporting.
    *   Simplified the `wc` command for truncating oversized diffs.
This commit improves the robustness and reliability of the `auto-pr-description.yml` GitHub Actions workflow.

Key changes include:

*   **Error Handling:** Removed `set -e` from several steps to prevent the workflow from failing on non-critical errors, such as when `git diff` or `git log` find no changes. Error output from these commands is now redirected to `/dev/null`.
*   **Scripting Logic:**
    *   Switched from `for` loops to `while IFS= read -r` loops for iterating over file lists. This correctly handles filenames that may contain spaces or other special characters.
    *   Simplified setting multi-line outputs for `GITHUB_OUTPUT` by removing intermediate `cat` commands and using `echo`.
*   **Context Truncation:** Improved the logic for truncating oversized diffs to avoid API limits. The byte count is now more reliably calculated using `awk`.
*   **Code Cleanup:** Removed unnecessary `shell: bash` directives and empty lines for better readability.
This commit refactors the `auto-pr-description` GitHub Actions workflow to improve how the JSON payload is constructed for the OpenRouter API call.

It replaces the inline, unescaped JSON string with a more robust method using `jq`. This ensures that the context from `steps.context.outputs.context`, which may contain special characters, is properly escaped before being embedded into the JSON payload, preventing potential `curl` command failures.
This commit fixes a bug in the `auto-pr-description.yml` GitHub Actions workflow.

The previous method of creating a multi-line `CONTEXT` environment variable was prone to shell interpretation issues. This has been changed to read the context directly from the `context.txt` file, ensuring the content is passed correctly to the `jq` command for JSON payload creation.
This commit refactors the GitHub Actions workflow for generating automatic PR descriptions to improve how the prompt and context are handled.

The main change is moving the static prompt text and the dynamic context from `context.txt` into a temporary `prompt_template.txt` file. This avoids potential shell interpretation issues with special characters when reading the context into an environment variable.

The `jq` command was updated to use `--rawfile` to read the entire prompt directly from `prompt_template.txt`, making the script more robust and reliable.
This commit updates the AI model used in the `auto-pr-description.yml` GitHub workflow. The model has been changed from `mistralai/devstral-small-2505:free` to `z-ai/glm-4.5-air:free` for generating pull request descriptions.
This commit updates the model used in the `auto-pr-description.yml` GitHub workflow. The model has been changed from `z-ai/glm-4.5-air:free` to `google/gemini-2.0-flash-exp:free`.
This commit updates the prompt used by the `auto-pr-description.yml` GitHub workflow.

The new prompt is designed to generate a more structured and detailed pull request description. It now asks for:
- A brief summary of changes.
- A list of affected files.
- Key functionalities added, modified, or removed.
- Dependency changes.
- Testing procedures and results.
- Known issues or limitations.

This replaces the previous, more prescriptive prompt that focused on "WHAT" changed over "WHICH" files and provided specific examples of good and bad bullet points. The new prompt aims to produce a comprehensive yet concise description to facilitate code review.
This commit refines the automated pull request description workflow.

The prompt has been significantly updated to guide the language model towards generating more technical and feature-focused descriptions, rather than just listing modified files. The new prompt emphasizes architectural changes, method signatures, and grouping related modifications.

The language model used for generation has been switched from `z-ai/glm-4.5-air:free` to `qwen/qwen3-coder:free`.
This commit updates the AI model used in the `auto-pr-description.yml` GitHub workflow. The model has been changed from `qwen/qwen3-coder:free` to `z-ai/glm-4.5-air:free`.
@GreenVenom77 GreenVenom77 merged commit e4b7973 into development Oct 15, 2025
1 check passed
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