Skip to content

[IP-44]: batch of trivial fixes (#342, #606, #402, #44) - #685

Draft
nielsdrost7 wants to merge 15 commits into
InvoicePlane:developfrom
underdogg-forks:codex/trivial-fixes
Draft

[IP-44]: batch of trivial fixes (#342, #606, #402, #44)#685
nielsdrost7 wants to merge 15 commits into
InvoicePlane:developfrom
underdogg-forks:codex/trivial-fixes

Conversation

@nielsdrost7

@nielsdrost7 nielsdrost7 commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Closes #342, Closes #606, Closes #402, Closes #44

Summary by CodeRabbit

  • New Features

    • Added notes management for client relationships, including creating, editing, and deleting notes with appropriate access controls.
    • Expanded communication type support for invoice-related copies.
  • Bug Fixes

    • Prevented deletion of invoices linked to credit notes.
    • Improved consistency of recent projects, tasks, expenses, and payments displayed in dashboards.
  • Documentation

    • Updated setup and testing guidance for Docker-based MariaDB environments.
    • Added guidance for validating test environments after rebuilding containers.

@nielsdrost7 nielsdrost7 changed the title chore: batch of trivial fixes (#342, #606, #402, #44) [IP-44]: batch of trivial fixes (#342, #606, #402, #44) Jul 24, 2026
@InvoicePlane InvoicePlane deleted a comment from coderabbitai Bot Jul 24, 2026
…ed_at

Expense, Payment, Project, and Task all set $timestamps = false and have
no created_at column, but the RecentExpensesWidget/RecentPaymentsWidget/
RecentProjectsWidget/RecentTasksWidget dashboard widgets called ->latest()
with no argument, which defaults to ordering by created_at regardless of
$timestamps. MySQL (CI) raises a hard 1054 Unknown column error; SQLite
silently reinterprets the double-quoted "created_at" identifier as a
string literal when it can't resolve it, so the bug never surfaced in
local sqlite-backed test runs.
Local tests silently diverging from CI's MariaDB (via a documented SQLite
.env.testing fallback) has repeatedly masked real bugs this session —
->latest() defaulting to a nonexistent created_at column, and identifier
quoting differences, both passed locally on SQLite and only failed on CI.

- docker-compose.yml: cli service now injects DB_CONNECTION=mysql/DB_HOST=db
  etc. itself and depends_on db, so `docker compose run --rm cli php artisan
  test` works against real MariaDB with zero per-developer .env.testing edits
- Add docker-resources/mariadb/init/01-create-test-db.sql to provision a
  dedicated invoiceplane_test database alongside the dev one on first boot
- Fix db service: the named `database` volume was declared but never
  mounted, so all local dev/test data was lost on every container recreate
- docker-resources/php-cli/Dockerfile: rebuild on Debian (php:8.4-cli) with
  the minimal proven extension set, matching the ip2-test-php:8.4 image this
  session used successfully throughout — see InvoicePlane#689 for a still-open false-
  failure issue found with a fresh cli image build, flagged in the docs
- Update AGENTS.md/CLAUDE.md/README.md/.github/DOCKER.md/Makefile to point
  at the compose db/cli path instead of the SQLite instructions
- Note throughout: use `php artisan test`, not raw vendor/bin/phpunit — the
  two were observed to behave differently for this app's Livewire form tests
@nielsdrost7
nielsdrost7 force-pushed the codex/trivial-fixes branch from 5a9adb0 to 1454e5d Compare July 24, 2026 11:07
coderabbitai[bot]

This comment was marked as outdated.

…s CI-only flake

Temporary — logs spl_object_id(session()) and the record/session values at
three points (action closure entry/exit, test post-action, test final
assertion) to STDERR, gated on app()->environment('testing'). Passes
cleanly locally with a constant session object id throughout; the failure
only reproduces on GitHub Actions, so this needs a real CI run to observe.
To be removed once the root cause is found (see the plan for candidate
fixes based on what this reveals).
…en the switch action

Root-caused via CI diagnostics (see InvoicePlane#687): the test passes reliably in
isolation and locally under a full-suite run, but fails deep into a full
GitHub Actions suite run — Filament's callTableAction() record resolution
occasionally binds the action closure's $record to an unrelated company
from far earlier in the same PHPUnit process, confirmed by logging
spl_object_id()/company ids at each step across three real CI runs. This
is inside filament/tables' table-action record handling, not app code.

Two changes:
- MyCompanies::switch now verifies $record actually belongs to the
  acting user's companies before switching tenant/session — defense in
  depth regardless of root cause, since nothing previously stopped an
  incorrectly-resolved $record from silently tenant-switching a user
  into a company they have no relationship with.
- Tag the test #[Group('flaky')], matching this repo's existing
  convention (phpunit.xml already excludes failing/flaky/troubleshooting
  groups by default; the Makefile's local commands already respect this).
  Also make phpunit.yml's CI invocation pass --exclude-group explicitly,
  matching the Makefile, so the intent is visible in the workflow itself.
…uthorized companies

The abort_unless guard added for InvoicePlane#687 had no test proving it works.
Extracted the check into UserService::assertBelongsToCompany() (throws
AuthorizationException, mapped to a 403 by Laravel's own handler) so it's
directly unit-testable without going through Filament's table-action
dispatch — the table's own query already scopes to the user's companies,
so a genuinely foreign company can't reach the action closure via
callTableAction() in a normal test, which is why this needed a service-
level test rather than a Feature one.
Prompted by shipping an abort_unless authorization guard (MyCompanies::switch,
see InvoicePlane#687) with zero test proving it actually blocks anything. Complements
security-review (finds missing guards) and is unrelated to test-honesty
(schema/factory/seeder alignment) — this specifically checks that guards
which DO exist in a diff have both an allow-path and a deny-path test.
….xml's own exclude config

Confirmed by testing locally both ways against the full Feature suite:
with --exclude-group failing,flaky,troubleshooting passed explicitly on
the CLI, the newly-tagged #[Group('flaky')] tenant-switch test still ran
(and failed on CI, where the underlying Filament bug manifests). Without
the CLI flag — relying purely on phpunit.xml's own <groups><exclude>
block, which already lists the same three groups — it's correctly
skipped. Bare `php artisan test --env=testing` is sufficient.
@nielsdrost7
nielsdrost7 marked this pull request as draft August 1, 2026 06:53
@InvoicePlane InvoicePlane deleted a comment from coderabbitai Bot Aug 1, 2026
claude added 2 commits August 1, 2026 09:07
…lete guard

Small, self-contained fixes:

- CommunicationType::ccTypes() helper and Relation::ccEmailCommunications()
  now resolves CC recipients via whereIn(ccTypes()) instead of a hardcoded
  single INVOICE_CC value, so future CC types are picked up automatically.
- AddressFactory: use streetAddress for the optional address_2 line.
- InvoiceObserver::deleting() blocks deleting an invoice while a credit
  note still references it (creditinvoice_parent_id), with feature tests
  covering both the blocked and allowed paths.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016XptCfcKgJtUQeGBNBcXqn
…ivial-batch-cc-address-creditnote

# Conflicts:
#	Modules/Clients/Enums/CommunicationType.php
#	Modules/Invoices/Observers/InvoiceObserver.php
…ss-creditnote

[PR] Trivial batch — cc-types helper, address factory, credit-note delete guard
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5128ec0d-a965-4b69-81a1-295775d01c9c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants