-
Notifications
You must be signed in to change notification settings - Fork 2
fix: address PR #121 review comments post-merge #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a7ddebb
fix: address PR #121 review comments post-merge
29c703a
📝 Add docstrings to `fix/pr121-followup`
coderabbitai[bot] 16eed45
fix: rename migration to 002 (follows 001 initial)
BillChirico 3ce9052
fix: add partial index on discord_message_id for fast lookups
BillChirico 53f52e9
fix: address review comments
BillChirico 0d00f5d
fix: add channelName/messageUrl/discordMessageId to OpenAPI schema an…
BillChirico File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /** | ||
| * Migration 002: Add discord_message_id to conversations table | ||
| * | ||
| * Stores the native Discord message ID alongside each conversation row so the | ||
| * dashboard can construct clickable jump URLs for individual messages. | ||
| * Existing rows will have NULL for this column (history before this migration). | ||
| */ | ||
|
|
||
| /** @param {import('node-pg-migrate').MigrationBuilder} pgm */ | ||
| exports.up = (pgm) => { | ||
| pgm.sql(` | ||
| ALTER TABLE conversations | ||
| ADD COLUMN IF NOT EXISTS discord_message_id TEXT | ||
| `); | ||
|
|
||
| pgm.sql(` | ||
| CREATE INDEX IF NOT EXISTS idx_conversations_discord_message_id | ||
| ON conversations(discord_message_id) | ||
| WHERE discord_message_id IS NOT NULL | ||
| `); | ||
| }; | ||
|
|
||
| /** @param {import('node-pg-migrate').MigrationBuilder} pgm */ | ||
| exports.down = (pgm) => { | ||
| pgm.sql(` | ||
| DROP INDEX IF EXISTS idx_conversations_discord_message_id | ||
| `); | ||
|
|
||
| pgm.sql(` | ||
| ALTER TABLE conversations | ||
| DROP COLUMN IF EXISTS discord_message_id | ||
| `); | ||
| }; | ||
BillChirico marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -185,6 +185,7 @@ describe('ai module coverage', () => { | |
| 'user', | ||
| 'hello', | ||
| 'testuser', | ||
| null, | ||
| ]); | ||
| }); | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,6 +154,7 @@ describe('ai module', () => { | |
| 'user', | ||
| 'hello', | ||
| 'testuser', | ||
| null, | ||
| ]); | ||
| }); | ||
| }); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { escapeIlike } from '../../src/utils/escapeIlike.js'; | ||
|
|
||
| describe('escapeIlike', () => { | ||
| describe('no special characters', () => { | ||
| it('returns plain strings unchanged', () => { | ||
| expect(escapeIlike('hello')).toBe('hello'); | ||
| expect(escapeIlike('foo bar')).toBe('foo bar'); | ||
| expect(escapeIlike('')).toBe(''); | ||
| }); | ||
|
|
||
| it('leaves alphanumeric and punctuation untouched', () => { | ||
| expect(escapeIlike('abc123')).toBe('abc123'); | ||
| expect(escapeIlike('hello.world!')).toBe('hello.world!'); | ||
| expect(escapeIlike('[email protected]')).toBe('[email protected]'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('percent sign (%)', () => { | ||
| it('escapes a single percent', () => { | ||
| expect(escapeIlike('%')).toBe('\\%'); | ||
| }); | ||
|
|
||
| it('escapes percent at the start', () => { | ||
| expect(escapeIlike('%foo')).toBe('\\%foo'); | ||
| }); | ||
|
|
||
| it('escapes percent at the end', () => { | ||
| expect(escapeIlike('foo%')).toBe('foo\\%'); | ||
| }); | ||
|
|
||
| it('escapes multiple percents', () => { | ||
| expect(escapeIlike('100%% done')).toBe('100\\%\\% done'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('underscore (_)', () => { | ||
| it('escapes a single underscore', () => { | ||
| expect(escapeIlike('_')).toBe('\\_'); | ||
| }); | ||
|
|
||
| it('escapes underscore in a word', () => { | ||
| expect(escapeIlike('snake_case')).toBe('snake\\_case'); | ||
| }); | ||
|
|
||
| it('escapes multiple underscores', () => { | ||
| expect(escapeIlike('__private__')).toBe('\\_\\_private\\_\\_'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('backslash (\\)', () => { | ||
| it('escapes a single backslash', () => { | ||
| expect(escapeIlike('\\')).toBe('\\\\'); | ||
| }); | ||
|
|
||
| it('escapes backslash in a path', () => { | ||
| expect(escapeIlike('C:\\Users')).toBe('C:\\\\Users'); | ||
| }); | ||
|
|
||
| it('escapes multiple backslashes', () => { | ||
| expect(escapeIlike('\\\\')).toBe('\\\\\\\\'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('combinations', () => { | ||
| it('escapes all three special characters together', () => { | ||
| expect(escapeIlike('%_\\')).toBe('\\%\\_\\\\'); | ||
| }); | ||
|
|
||
| it('escapes a realistic search pattern', () => { | ||
| expect(escapeIlike('50% off_sale\\')).toBe('50\\% off\\_sale\\\\'); | ||
| }); | ||
|
|
||
| it('escapes repeated mixed specials', () => { | ||
| expect(escapeIlike('%%__\\\\')).toBe('\\%\\%\\_\\_\\\\\\\\'); | ||
| }); | ||
|
|
||
| it('handles adjacent special chars with regular chars', () => { | ||
| expect(escapeIlike('a%b_c\\d')).toBe('a\\%b\\_c\\\\d'); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.