Skip to content

bug fixes - #290

Open
ali-ahnaf wants to merge 4 commits into
mainfrom
develop
Open

bug fixes#290
ali-ahnaf wants to merge 4 commits into
mainfrom
develop

Conversation

@ali-ahnaf

@ali-ahnaf ali-ahnaf commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes

    • The dashboard now refreshes automatically after a pending expense is converted into a transaction.
    • Dismissing a pending expense no longer triggers an unnecessary dashboard refresh.
  • Documentation

    • Expanded deployment guidance for GitHub Actions secrets, multiline and SSH key values, production environment files, secret updates, and manual deployment reruns.
    • Updated a contributor’s displayed guild master level in the README.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Greetings, @ali-ahnaf. Thy scroll hath arrived unblemished — the runes align and no conflict bars the path. The council shall now convene over its contents, weighing each incantation by candlelight. Tarry a while, brave adventurer; we shall investigate and return to thee with our verdict.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 99dfb062-bd41-4b0b-8e64-953d3911a75f

📥 Commits

Reviewing files that changed from the base of the PR and between bc643c6 and 82586cb.

📒 Files selected for processing (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md

📝 Walkthrough

Walkthrough

The pending expense flow now refreshes dashboard transactions after transaction creation. Deployment documentation adds GitHub CLI secret management instructions. The README updates a contributor level.

Changes

Pending expense transaction refresh

Layer / File(s) Summary
Resolution callback flow
packages/ui/src/components/pending-expenses/PendingExpenseDetailModal.tsx, packages/ui/src/components/pending-expenses/PendingExpensesPanel.tsx, packages/ui/src/app/page.tsx
The modal reports whether resolution created a transaction. The panel invokes the optional callback when true. The dashboard connects the callback to its refresh handler.

Deployment secret documentation

Layer / File(s) Summary
Secret management workflow
documentation/deployment.md
The documentation adds commands and guidance for setting, replacing, verifying, deleting, and formatting deployment secrets.

Contributor roster update

Layer / File(s) Summary
Contributor badge update
README.md
The contributor badge changes the displayed level from 101 to 108.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PendingExpenseDetailModal
  participant PendingExpensesPanel
  participant DashboardPage
  PendingExpenseDetailModal->>PendingExpensesPanel: report resolution and transactionCreated status
  PendingExpensesPanel->>DashboardPage: invoke onTransactionCreated when true
  DashboardPage->>DashboardPage: refresh transaction data
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title refers to the transaction refresh fix but is too generic to identify the primary change clearly. Use a specific title such as "Refresh dashboard after pending expense transaction creation".
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ali-ahnaf ali-ahnaf changed the title Develop bug fixes Aug 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@documentation/deployment.md`:
- Line 17: Update the VAPID_PUBLIC_KEY documentation entry to state that it must
match the API’s VAPID_PUBLIC_KEY, not the private key. Keep the existing UI
build variable reference and security guidance unchanged.
- Line 23: Update the deployment instructions to use the canonical repository
name ali-ahnaf/pocket_pixel and explicitly include --repo ali-ahnaf/pocket_pixel
in gh secret commands. Do not rely on the current Git remote, and remove the
incorrect ali-ahnaf/pixel_pocket reference.
- Around line 25-32: Update the deployment documentation around the single-line
secret examples to remove the claim that stdin prevents values from appearing in
shell history. State only that values are not passed as gh arguments, or revise
the examples to obtain sensitive values interactively or from files.
- Line 50: Update the deployment guidance around the manual workflow command to
use `gh run rerun <run-id>`, since `.github/workflows/ci-cd.yml` does not expose
a `workflow_dispatch` trigger; alternatively, add that trigger to the workflow
and document the supported dispatch command.
- Line 48: Update the deployment secrets guidance to reflect the per-job
configuration in ci-cd.yml: document HOSTINGER_VPS_* and API_ENV as production
environment secrets for deploy, and VAPID_PUBLIC_KEY as a repository-level
secret for build; remove the blanket instruction against using --env/--org.

In `@packages/ui/src/components/pending-expenses/PendingExpenseDetailModal.tsx`:
- Line 114: Update the pending-expense resolution flow around
deletePendingExpense and createTransaction so transaction creation and
pending-expense cleanup cannot leave a partially completed retryable state.
Prefer a server-side operation that atomically creates the transaction and
deletes the pending expense; otherwise add a stable idempotency key to
createTransaction, handle cleanup failures explicitly, and call onResolved only
after the combined operation succeeds.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 72f22dc2-3c8e-418d-ade6-8147f846da6e

📥 Commits

Reviewing files that changed from the base of the PR and between 1f5b6e0 and bc643c6.

📒 Files selected for processing (5)
  • README.md
  • documentation/deployment.md
  • packages/ui/src/app/page.tsx
  • packages/ui/src/components/pending-expenses/PendingExpenseDetailModal.tsx
  • packages/ui/src/components/pending-expenses/PendingExpensesPanel.tsx

| `HOSTINGER_VPS_APP_DIR` | App dir on VPS, e.g. `/var/www/pocket_pixel` |
| `HOSTINGER_VPS_SSH_KEY` | Private SSH key (deploy job strips `\r`) |
| `API_ENV` | **Entire content** of the API `.env` — written verbatim to `packages/api/.env` on the VPS every deploy |
| `VAPID_PUBLIC_KEY` | Web Push VAPID public key — inlined into the UI build as `NEXT_PUBLIC_VAPID_PUBLIC_KEY` (see the `Build UI` step). Not secret, but must match the API's private key. |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Reference the API public key, not the private key.

Line 17 says VAPID_PUBLIC_KEY must match the API private key. The UI value must match the API's VAPID_PUBLIC_KEY; line 57 already states this. If a user follows line 17 and supplies VAPID_PRIVATE_KEY, the build exposes the signing key through NEXT_PUBLIC_VAPID_PUBLIC_KEY.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@documentation/deployment.md` at line 17, Update the VAPID_PUBLIC_KEY
documentation entry to state that it must match the API’s VAPID_PUBLIC_KEY, not
the private key. Keep the existing UI build variable reference and security
guidance unchanged.


### Setting the secrets with the `gh` CLI

Requires `gh` authenticated with `repo` scope (`gh auth login`, verify with `gh auth status`). All commands below assume you are inside the repo clone so `gh` resolves `ali-ahnaf/pixel_pocket` from the git remote; otherwise add `--repo ali-ahnaf/pixel_pocket`. `gh secret set` creates or overwrites — there is no separate update command, and existing values can never be read back, only replaced.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Target the canonical repository explicitly.

Line 23 names ali-ahnaf/pixel_pocket, but this repository is ali-ahnaf/pocket_pixel. The commands also inherit the current Git remote, so a fork clone can store secrets in the wrong repository. Use --repo ali-ahnaf/pocket_pixel, or state that the remote must point to the canonical repository.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@documentation/deployment.md` at line 23, Update the deployment instructions
to use the canonical repository name ali-ahnaf/pocket_pixel and explicitly
include --repo ali-ahnaf/pocket_pixel in gh secret commands. Do not rely on the
current Git remote, and remove the incorrect ali-ahnaf/pixel_pocket reference.

Comment on lines +25 to +32
Single-line values — pass them on stdin rather than as an argument so they never land in your shell history:

```bash
printf '%s' '203.0.113.10' | gh secret set HOSTINGER_VPS_HOST
printf '%s' '22' | gh secret set HOSTINGER_VPS_PORT
printf '%s' 'deploy' | gh secret set HOSTINGER_VPS_USER
printf '%s' '/var/www/pocket_pixel' | gh secret set HOSTINGER_VPS_APP_DIR
printf '%s' 'BB...public-key...' | gh secret set VAPID_PUBLIC_KEY

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Do not claim that these examples avoid shell history.

printf '%s' 'value' still places value in the shell command line and shell history. Change the text to say that the value is not passed as a gh argument, or read sensitive single-line values from an interactive or file-based source.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@documentation/deployment.md` around lines 25 - 32, Update the deployment
documentation around the single-line secret examples to remove the claim that
stdin prevents values from appearing in shell history. State only that values
are not passed as gh arguments, or revise the examples to obtain sensitive
values interactively or from files.

- `API_ENV` is the whole `.env` file, not one variable. Re-run the `--body-file` command after adding any new API env var; the local `packages/api/.env` may contain dev-only values, so keep a prod copy (e.g. `~/pocket_pixel/prod.env`) and set the secret from that instead of from the working tree.
- Verify names and update timestamps (values are never shown): `gh secret list`.
- Remove one with `gh secret delete <NAME>`.
- These are repo-level Actions secrets, which is what `ci-cd.yml` reads. Don't pass `--env`/`--org` unless you also rewire the workflow to an environment.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

rg -n -C 4 'environment:|secrets\.(HOSTINGER_VPS_|API_ENV|VAPID_PUBLIC_KEY)' .github/workflows/ci-cd.yml

Repository: ali-ahnaf/pocket_pixel

Length of output: 1834


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- deployment docs lines 1-80 ---\n'
sed -n '1,80p' documentation/deployment.md

printf '\n--- ci-cd workflow top/context ---\n'
sed -n '1,120p' .github/workflows/ci-cd.yml

printf '\n--- relevant docs references to secrets/env flags ---\n'
rg -n -C 3 'secret|secrets|--env|BUILD|HOSTINGER|VAPID|API_ENV' documentation/deployment.md

Repository: ali-ahnaf/pocket_pixel

Length of output: 251


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- deployment docs lines 1-80 ---'
sed -n '1,80p' documentation/deployment.md

printf '%s\n' ''
printf '%s\n' '--- ci-cd workflow top/context ---'
sed -n '1,120p' .github/workflows/ci-cd.yml

printf '%s\n' ''
printf '%s\n' '--- relevant docs references to secrets/env flags ---'
rg -n -C 3 'secret|secrets|--env|BUILD|HOSTINGER|VAPID|API_ENV' documentation/deployment.md

Repository: ali-ahnaf/pocket_pixel

Length of output: 15225


Document per-job secret visibility.

.github/workflows/ci-cd.yml already sets deploy to environment: production, while build has no environment. Replace the blanket “don’t pass --env/--org” note with scoped guidance: deploy secrets such as HOSTINGER_VPS_* and API_ENV should be environment secrets on production; VAPID_PUBLIC_KEY needs repository-level visibility because the build job reads it.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@documentation/deployment.md` at line 48, Update the deployment secrets
guidance to reflect the per-job configuration in ci-cd.yml: document
HOSTINGER_VPS_* and API_ENV as production environment secrets for deploy, and
VAPID_PUBLIC_KEY as a repository-level secret for build; remove the blanket
instruction against using --env/--org.

- Remove one with `gh secret delete <NAME>`.
- These are repo-level Actions secrets, which is what `ci-cd.yml` reads. Don't pass `--env`/`--org` unless you also rewire the workflow to an environment.

After changing a secret, the next push to `main` picks it up — editing only `.md`/`.yml` files does not trigger a run, so re-run the last workflow manually if you need a deploy without a code change: `gh workflow run ci-cd.yml --ref main`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

rg -n -C 4 'workflow_dispatch|^on:' .github/workflows/ci-cd.yml

Repository: ali-ahnaf/pocket_pixel

Length of output: 267


🏁 Script executed:

#!/bin/bash
set -e
printf 'deployment.md line 50 context:\n'
sed -n '44,56p' documentation/deployment.md
printf '\nci-cd.yml workflow dispatch section:\n'
sed -n '1,40p' .github/workflows/ci-cd.yml

Repository: ali-ahnaf/pocket_pixel

Length of output: 2323


Fix the manual-redispatch command.

.github/workflows/ci-cd.yml has no workflow_dispatch trigger, so gh workflow run ci-cd.yml --ref main will fail. Document gh run rerun <run-id> instead, or add workflow_dispatch and mention that option in this section.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@documentation/deployment.md` at line 50, Update the deployment guidance
around the manual workflow command to use `gh run rerun <run-id>`, since
`.github/workflows/ci-cd.yml` does not expose a `workflow_dispatch` trigger;
alternatively, add that trigger to the workflow and document the supported
dispatch command.

});
await profileApi.deletePendingExpense(userId, item.id);
onResolved(item.id);
onResolved(item.id, true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rg -n -C 12 '\b(createTransaction|deletePendingExpense|resolvePendingExpense)\b' .

Repository: ali-ahnaf/pocket_pixel

Length of output: 28356


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "## PendingExpenseDetailModal.tsx"
sed -n '70,120p' packages/ui/src/components/pending-expenses/PendingExpenseDetailModal.tsx | cat -n

echo
echo "## ProfileApi.ts relevant methods"
sed -n '160,182p' packages/ui/src/lib/api/ProfileApi.ts | cat -n

echo
echo "## shared DTOs for transactions/pending expenses"
rg -n "PendingGmailExpenseDto|createTransaction|pending-expenses|idempotency|Idempotency|idempotent|X-Idempotency-Key|idempotency-key|Idempotency-Key|Idempotent" -S . --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' || true

echo
echo "## API route references for pending-expenses/transactions"
rg -n "pending-expenses|/transactions|transactions" -S . --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' | head -200

Repository: ali-ahnaf/pocket_pixel

Length of output: 37074


Make pending-expense resolution atomic or idempotent.

deletePendingExpense can fail after createTransaction succeeds, so cleanup never runs and onResolved is not called. A retry can duplicate the transaction because createTransaction has no client-side idempotency key. Add a server-side endpoint that creates the transaction and deletes the pending expense atomically, or make the client retry path idempotent and surface/delete cleanup failures.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/src/components/pending-expenses/PendingExpenseDetailModal.tsx` at
line 114, Update the pending-expense resolution flow around deletePendingExpense
and createTransaction so transaction creation and pending-expense cleanup cannot
leave a partially completed retryable state. Prefer a server-side operation that
atomically creates the transaction and deletes the pending expense; otherwise
add a stable idempotency key to createTransaction, handle cleanup failures
explicitly, and call onResolved only after the combined operation succeeds.

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.

1 participant