Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ jobs:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
plugins: 'code-review@claude-code-plugins'
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
prompt: '/code-review:code-review --comment ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
claude_args: '--allowedTools "mcp__github_inline_comment__create_inline_comment"'
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options

65 changes: 65 additions & 0 deletions .github/workflows/claude-issue-response.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Respond to @claude mentions in issues

on:
issues:
types: [opened, edited]
issue_comment:
types: [created, edited]

jobs:
claude-response:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: read

steps:
- name: Check if @claude was mentioned
id: check_mention
run: |
BODY="${{ github.event.issue.body || github.event.comment.body }}"
if [[ "$BODY" == *"@claude"* ]]; then
echo "mentioned=true" >> $GITHUB_OUTPUT
else
echo "mentioned=false" >> $GITHUB_OUTPUT
fi

- name: Respond to @claude mention
if: steps.check_mention.outputs.mentioned == 'true'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
console.log('Workflow triggered for @claude mention');
console.log('Issue/PR number:', context.issue.number);

const issue_number = context.issue.number;
const repo = context.repo.repo;
const owner = context.repo.owner;

const body = github.event.issue?.body || github.event.comment?.body || '';
console.log('Body contains @claude:', body.includes('@claude'));

const responseBody = '👋 Hey! I see you mentioned @claude.\n\nI am here to help! The Claude GitHub App is installed and ready to assist with:\n- 🔍 Analyzing code and issues\n- 🐛 Fixing CI errors\n- 📝 Reviewing pull requests\n- 🤖 Responding to development tasks\n\nPlease describe what you need help with, and I will get started!';

try {
const comment = await github.rest.issues.createComment({
owner: owner,
repo: repo,
issue_number: issue_number,
body: responseBody
});
console.log('Comment created successfully:', comment.data.id);
} catch (error) {
console.error('Error creating comment:', error);
throw error;
}

- name: Log issue details
if: steps.check_mention.outputs.mentioned == 'true'
run: |
echo "Issue #${{ github.event.issue.number }} mentioned @claude"
echo "Repository: ${{ github.repository }}"
echo "Issue Title: ${{ github.event.issue.title }}"
echo "Body: ${{ github.event.issue.body || github.event.comment.body }}"
2 changes: 1 addition & 1 deletion .github/workflows/claude.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ jobs:
# Optional: Add claude_args to customize behavior and configuration
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
# claude_args: '--allowed-tools Bash(gh pr:*)'
# claude_args: '--allowed-tools Bash(gh pr *)'

3 changes: 2 additions & 1 deletion backend/app/market/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def get_price(self, ticker: str) -> float | None:
def remove(self, ticker: str) -> None:
"""Remove a ticker from the cache (e.g., when removed from watchlist)."""
with self._lock:
self._prices.pop(ticker, None)
if self._prices.pop(ticker, None) is not None:
self._version += 1

@property
def version(self) -> int:
Expand Down
21 changes: 21 additions & 0 deletions backend/tests/market/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,27 @@ def test_remove_nonexistent(self):
cache = PriceCache()
cache.remove("AAPL") # Should not raise

def test_remove_increments_version(self):
"""Test that removing a ticker bumps the version counter.

SSE change detection relies on this: without it, a ticker removed
from the watchlist would keep appearing in already-connected clients'
streams until some other ticker happened to update.
"""
cache = PriceCache()
cache.update("AAPL", 190.00)
v_before = cache.version
cache.remove("AAPL")
assert cache.version == v_before + 1

def test_remove_nonexistent_does_not_bump_version(self):
"""Test that removing an unknown ticker is a true no-op, version included."""
cache = PriceCache()
cache.update("AAPL", 190.00)
v_before = cache.version
cache.remove("NOPE")
assert cache.version == v_before

def test_get_all(self):
"""Test getting all prices."""
cache = PriceCache()
Expand Down
Loading