- Create validateScopes helper to avoid code duplication
- Use shared function in both initiateOAuth and getIntegrationStatus
- Addresses code review feedback from greptile-apps[bot]
Co-Authored-By: Dallin Bentley <dallinbentley98@gmail.com>
- Updated `get_chat_handler` to check for collection access when a user lacks direct permission.
- Modified `get_dashboard_handler` to first verify collection access before checking chat access.
- Added `check_chat_collection_access` function to validate user access to chats via collections.
- Enhanced `check_metric_dashboard_access` to include collection access checks concurrently with other permission checks.
This change improves the permission model by allowing access to chats and dashboards through associated collections, enhancing user experience and security.
- Add deduplicateFilesByVersion helper function with informative logging
- Modify selectFilesForResponse to handle version-based deduplication
- Balance priority logic (dashboards over standalone created metrics) with deduplication
- Default missing version numbers to 1
- Add comprehensive tests for deduplication scenarios
- Preserve existing priority logic when no deduplication is needed
Fixes BUS-1434
Co-Authored-By: Dallin Bentley <dallinbentley98@gmail.com>
- Fixed unit test failures in database, rerank, data-source, stored-values, and test-utils packages
- Moved unit tests from tests/ folders to be alongside source files (e.g., slack.ts -> slack.test.ts)
- Ensured all unit tests use mocks instead of real dependencies
- Added DATABASE_URL environment variable to test:unit scripts where needed
- Fixed mock implementations and test assertions
- All 52 unit tests now pass successfully
Co-Authored-By: Dallin Bentley <dallinbentley98@gmail.com>
- Fixed AI package unit tests that were previously failing
- Updated database package.json with environment variables for tests
- Fixed snowflake adapter test issues in data-source package
Co-Authored-By: Dallin Bentley <dallinbentley98@gmail.com>
- Removed empty test files from packages/rerank/tests/ and packages/stored-values/tests/
- All unit tests are now co-located with their source files
Co-Authored-By: Dallin Bentley <dallinbentley98@gmail.com>
- Added unit tests for database helper functions
- Added unit tests for mock helpers and environment helpers
- All test files now follow the convention of being alongside their source files
Co-Authored-By: Dallin Bentley <dallinbentley98@gmail.com>
- Moved unit tests from tests/ folders to src/ directories in stored-values, rerank, and test-utils packages
- Updated import paths in moved test files
- Removed old test files from tests/ directories
- Tests now follow convention: if there's a file.ts, the test is file.test.ts in the same directory
Co-Authored-By: Dallin Bentley <dallinbentley98@gmail.com>
- Added functions to check if a user has access to metrics and dashboards through associated chats.
- Updated permission handling in `get_metric_data_handler`, `get_metric_for_dashboard_handler`, and `get_metric_handler` to include chat access checks.
- Enhanced error handling for cases where users lack access to both dashboards and chats.
- Updated `asset_access_checks` to include new chat access functions and modified the public interface in `lib.rs` accordingly.
- Add convertMarkdownToSlack utility function that converts standard markdown to Slack-compatible mrkdwn format
- Handle headers (converted to section blocks), bold/italic text, code blocks, and ordered/unordered lists
- Integrate converter into messaging service for all outgoing messages (sendMessage, replyToMessage, updateMessage)
- Add comprehensive tests covering all conversion scenarios including nested formatting
- Use placeholder approach to avoid conflicts between bold and italic regex patterns
- Leave unsupported markdown unchanged as required
Fixes BUS-1413
Co-Authored-By: Dallin Bentley <dallinbentley98@gmail.com>
- Add subqueries to count user messages (non-null request_message) and total messages per chat
- Filter out chats with zero user messages AND only one total message
- This excludes auto-generated asset import chats that users never interacted with
- Applied same filtering logic to both list_chats_handler.rs and list_logs_handler.rs
Fixes BUS-1415
Co-Authored-By: Dallin Bentley <dallinbentley98@gmail.com>
- Return 412 PRECONDITION_FAILED for permission/workspace access errors
- Return 404 NOT_FOUND for chat not found errors
- Keep 500 INTERNAL_SERVER_ERROR as fallback for other errors
- Addresses BUS-1423
Co-Authored-By: Dallin Bentley <dallinbentley98@gmail.com>