Repository navigation
ci: extend workflow triggers to release/** branches #816
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
19 commits
Select commit
Hold shift + click to select a range
e185764
fix(player): harden stream bridge + add 57 missing tests (#815)
LucasSantana-Dev c4b9367
ci: extend workflow triggers to release/** branches
LucasSantana-Dev dcef5eb
Merge branch 'release/v2.10.0' into ci/release-branch-triggers
LucasSantana-Dev b823fcd
ci: add PR-Agent AI review and Socket.dev supply chain scan
LucasSantana-Dev 282795b
feat(backend): add /invite UTM tracking route + update README messaging
LucasSantana-Dev 57770db
fix: correct pr-agent model field + synchronize error-kill assertion
LucasSantana-Dev a2420c9
ci: add allow-warnings to socket.dev action, note GitHub App covers P…
LucasSantana-Dev 9646c1b
feat(spotify): add getUserSavedTracks + likedTrackIds to user seeds
LucasSantana-Dev 8ac328a
fix(backend): harden invite route + add test coverage
LucasSantana-Dev 153f79e
ci: disable unavailable socketdev action + fix S5144 in getUserSavedT…
LucasSantana-Dev 0aacb04
ci: replace unavailable SocketDev action with run step
LucasSantana-Dev 949676f
test(spotify): add getUserSavedTracks coverage to fix SonarCloud gate
LucasSantana-Dev 9ae3a9a
ci: trigger CI for PR #816 [skip ci-push]
LucasSantana-Dev 646e7dd
fix(ci): fix YAML syntax error in Socket.dev scan step
LucasSantana-Dev 94b498d
fix(autoplay): use Spotify genres as fallback when Last.fm is not lin…
LucasSantana-Dev 4f1eac2
Revert "fix(autoplay): use Spotify genres as fallback when Last.fm is…
LucasSantana-Dev 1ecc667
fix: address CodeRabbit review comments on PR #816
LucasSantana-Dev b9e60a6
fix: address review findings from /pr-review-toolkit:review-pr
LucasSantana-Dev 613756c
test(invite): mock logAndSwallow + reset mockInfoLog between tests
LucasSantana-Dev 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
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,37 @@ | ||
| name: PR Agent | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, ready_for_review] | ||
| issue_comment: | ||
| types: [created] | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| pull_request_review_comment: | ||
| types: [created] | ||
| pull_request_review: | ||
| types: [submitted] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| pr-agent: | ||
| name: AI Code Review | ||
| runs-on: ubuntu-latest | ||
| if: ${{ github.event.sender.type != 'Bot' && (github.event_name != 'issue_comment' || github.event.issue.pull_request != null) }} | ||
|
LucasSantana-Dev marked this conversation as resolved.
|
||
| permissions: | ||
| issues: write | ||
| pull-requests: write | ||
| contents: read | ||
| steps: | ||
| - name: PR Agent action | ||
| uses: Codium-ai/pr-agent@009ba5a116c4d3273368a6dc53a4efdb7904d519 # main | ||
| env: | ||
| OPENAI.KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| OPENAI.API_TYPE: anthropic | ||
| OPENAI.MODEL: claude-sonnet-4-6 | ||
| CONFIG.AI_PROVIDER: anthropic | ||
|
LucasSantana-Dev marked this conversation as resolved.
|
||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| github_action_config.auto_review: 'true' | ||
| github_action_config.auto_describe: 'true' | ||
| github_action_config.auto_improve: 'true' | ||
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 |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import type { Express, Request, Response } from 'express' | ||
| import { infoLog } from '@lucky/shared/utils' | ||
| import { logAndSwallow } from '@lucky/shared/utils/error' | ||
| import { apiLimiter } from '../middleware/rateLimit' | ||
|
|
||
| const DISCORD_INVITE_URL = | ||
| 'https://discord.com/oauth2/authorize?client_id=962198089161134131&scope=bot%20applications.commands&permissions=36970496' | ||
|
|
||
| function toUtmString(value: unknown): string | undefined { | ||
| return typeof value === 'string' ? value : undefined | ||
| } | ||
|
|
||
| export function setupInviteRoute(app: Express): void { | ||
| app.get('/invite', apiLimiter, (req: Request, res: Response) => { | ||
| const utm_source = toUtmString(req.query.utm_source) | ||
| const utm_medium = toUtmString(req.query.utm_medium) | ||
| const utm_campaign = toUtmString(req.query.utm_campaign) | ||
| const utm_content = toUtmString(req.query.utm_content) | ||
|
|
||
| try { | ||
| infoLog({ | ||
| message: '[invite] click', | ||
| data: { utm_source, utm_medium, utm_campaign, utm_content }, | ||
| }) | ||
| } catch (err) { | ||
| logAndSwallow(err, 'invite.infoLog') | ||
| } | ||
|
|
||
| res.redirect(302, DISCORD_INVITE_URL) | ||
| }) | ||
| } |
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 |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| import { describe, test, expect, jest, beforeEach } from '@jest/globals' | ||
| import express from 'express' | ||
| import request from 'supertest' | ||
|
|
||
| const mockInfoLog = jest.fn() | ||
| const mockLogAndSwallow = jest.fn() | ||
|
|
||
| jest.mock('@lucky/shared/utils', () => ({ | ||
| infoLog: (...args: unknown[]) => mockInfoLog(...args), | ||
| })) | ||
|
|
||
| jest.mock('@lucky/shared/utils/error', () => ({ | ||
| logAndSwallow: (...args: unknown[]) => mockLogAndSwallow(...args), | ||
| })) | ||
|
|
||
| jest.mock('../../../src/middleware/rateLimit', () => ({ | ||
| apiLimiter: (_req: unknown, _res: unknown, next: () => void) => next(), | ||
| })) | ||
|
|
||
| import { setupInviteRoute } from '../../../src/routes/invite' | ||
|
|
||
| function buildApp() { | ||
| const app = express() | ||
| setupInviteRoute(app) | ||
| return app | ||
| } | ||
|
|
||
| describe('GET /invite', () => { | ||
| beforeEach(() => { | ||
| jest.clearAllMocks() | ||
| mockInfoLog.mockReset() | ||
| }) | ||
|
|
||
| test('redirects to Discord invite URL', async () => { | ||
| const res = await request(buildApp()).get('/invite') | ||
| expect(res.status).toBe(302) | ||
| expect(res.headers.location).toContain('discord.com/oauth2/authorize') | ||
| }) | ||
|
|
||
| test('logs UTM params when present', async () => { | ||
| await request(buildApp()).get( | ||
| '/invite?utm_source=github&utm_medium=readme&utm_campaign=test&utm_content=badge', | ||
| ) | ||
| expect(mockInfoLog).toHaveBeenCalledWith( | ||
| expect.objectContaining({ | ||
| data: expect.objectContaining({ | ||
| utm_source: 'github', | ||
| utm_medium: 'readme', | ||
| utm_campaign: 'test', | ||
| utm_content: 'badge', | ||
| }), | ||
| }), | ||
| ) | ||
| }) | ||
|
|
||
| test('logs undefined for missing UTM params', async () => { | ||
| await request(buildApp()).get('/invite') | ||
| expect(mockInfoLog).toHaveBeenCalledWith( | ||
| expect.objectContaining({ | ||
| data: { | ||
| utm_source: undefined, | ||
| utm_medium: undefined, | ||
| utm_campaign: undefined, | ||
| utm_content: undefined, | ||
| }, | ||
| }), | ||
| ) | ||
| }) | ||
|
|
||
| test('coerces array UTM values to undefined', async () => { | ||
| await request(buildApp()).get('/invite?utm_source=a&utm_source=b') | ||
| const logged = (mockInfoLog.mock.calls[0] as [{ data: { utm_source: unknown } }])[0] | ||
| expect(logged.data.utm_source).toBeUndefined() | ||
| }) | ||
|
|
||
| test('still redirects when infoLog throws', async () => { | ||
| mockInfoLog.mockImplementation(() => { | ||
| throw new Error('logging failure') | ||
| }) | ||
| const res = await request(buildApp()).get('/invite') | ||
| expect(res.status).toBe(302) | ||
| expect(res.headers.location).toContain('discord.com') | ||
| }) | ||
|
|
||
| test('never redirects to a user-supplied URL (no open redirect)', async () => { | ||
| const res = await request(buildApp()).get( | ||
| '/invite?redirect=https://evil.example.com', | ||
| ) | ||
| expect(res.headers.location).not.toContain('evil.example.com') | ||
| expect(res.headers.location).toContain('discord.com') | ||
| }) | ||
| }) |
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
Oops, something went wrong.
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.