Skip to content

Just develop to master - #282

Draft
nielsdrost7 wants to merge 245 commits into
masterfrom
develop
Draft

Just develop to master#282
nielsdrost7 wants to merge 245 commits into
masterfrom
develop

Conversation

@nielsdrost7

@nielsdrost7 nielsdrost7 commented Dec 29, 2025

Copy link
Copy Markdown
Collaborator

┌─────┬─────────────────────────────────────────────────────────────────────┬──────────────────────┐
│ # │ Issue │ Fix │
├─────┼─────────────────────────────────────────────────────────────────────┼──────────────────────┤
│ │ database/migrations/2025_06_03_142408_create_sessions_table.php │ Deleted the │
│ 1 │ duplicated Modules/Core's sessions migration — crashed │ duplicate │
│ │ RefreshDatabase and cascaded 300 failures │ │
├─────┼─────────────────────────────────────────────────────────────────────┼──────────────────────┤
│ │ UserService::updateUser(array $validatedInput, $userToUpdate) — │ Swapped to │
│ 2 │ parameter order was reversed from every caller (updateUser($record, │ updateUser(User │
│ │ $data)). Would throw "call to fill() on array" at runtime │ $user, array $data) │
├─────┼─────────────────────────────────────────────────────────────────────┼──────────────────────┤
│ 3 │ Invoice::mailQueue() declared return type Builder but returns │ Fixed to HasMany │
│ │ HasMany │ │
├─────┼─────────────────────────────────────────────────────────────────────┼──────────────────────┤
│ │ Invoice::activities(), attachments(), clientAttachments() all │ Removed all three │
│ 4 │ returned null. clientAttachments() also referenced non-existent │ dead methods │
│ │ $this->status_text and unqualified 'Attachment' string │ │
├─────┼─────────────────────────────────────────────────────────────────────┼──────────────────────┤
│ 5 │ Same dead methods in Quote │ Removed │
├─────┼─────────────────────────────────────────────────────────────────────┼──────────────────────┤
│ │ DeleteBulkAction on UsersTable had no super_admin guard — bulk │ Added │
│ 6 │ delete could wipe all super admins │ reject(super_admin) │
│ │ │ before delete │
├─────┼─────────────────────────────────────────────────────────────────────┼──────────────────────┤
│ 7 │ Modules/Quotes/Listeners/QuoteWasUpdatedListenerTest.php — test │ Moved to │
│ │ file in wrong directory, PHPUnit never found it │ Tests/Feature/ │
└─────┴─────────────────────────────────────────────────────────────────────┴──────────────────────┘

What was extracted to branches

┌─────────────────────────────────────────────────────────────┬────────────────────────────────────┐
│ Orphan │ Branch │
├─────────────────────────────────────────────────────────────┼────────────────────────────────────┤
│ app/Mason/Bricks/ + app/Mason/Collections/ (17 files, │ feature/130-report-builder │
│ survived a "remove" commit) │ (already existed) │
├─────────────────────────────────────────────────────────────┼────────────────────────────────────┤
│ Entire DocumentGroup subsystem (model, resource, service, │ │
│ factory, seeder, migration, observer, tests — 14 files, │ feature/document-groups-cleanup │
│ unregistered dead code, Numbering is the canonical │ (new) │
│ replacement) │ │
└─────────────────────────────────────────────────────────────┴────────────────────────────────────┘

Remaining known issues (not blocking tests, need dedicated work)

  • 44 tests tagged #[Group('failing')] — most are markTestSkipped(). Legitimate tracking, but several
    should now actually pass (duplicate-number tests) and need un-tagging. SettingsTest (9 tests) is
    all-skipped due to a Filament 5 blade rendering issue.
  • FileUpload::make('attachments') in InvoiceForm — bound to a field with no backing relation. Won't
    crash at render time, but upload would silently do nothing.
  • QuoteService::createQuote — $quoteTotal is computed but ignored; 'quote_total' =>
    $data['quote_total'] ?? 0 uses raw i Jump to bottom (ctrl+End) ↓ correctly uses the computed value.

@InvoicePlane InvoicePlane deleted a comment from coderabbitai Bot Dec 29, 2025
@InvoicePlane InvoicePlane deleted a comment from coderabbitai Bot Dec 29, 2025
@nielsdrost7

This comment was marked as outdated.

This comment was marked as outdated.

Copilot AI added a commit that referenced this pull request Dec 29, 2025
Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
nielsdrost7 added a commit that referenced this pull request Dec 29, 2025
…ts (#287)

* Initial plan

* Apply code review fixes from PR #282

Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
@InvoicePlane InvoicePlane deleted a comment from coderabbitai Bot Dec 29, 2025
nielsdrost7

This comment was marked as outdated.

nielsdrost7

This comment was marked as outdated.

This comment was marked as outdated.

cat updated-packages.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Create Pull Request

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@copilot

Error: GitHub Actions is not permitted to create or approve pull requests.

nielsdrost7 and others added 30 commits August 15, 2026 09:46
…lake

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).
…h action

Root-caused via CI diagnostics (see #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 #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.
….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.
…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
- Add all V1 import/migration utilities (MigrationContext, V1MigrationManager, migrators)
- Add Docker infrastructure (docker-compose.yml, Dockerfile, init scripts, Makefile)
- Add test automation scripts (PARALLEL_TESTING_SETUP.md, run-pr-tests.sh)
- Add documentation (AGENTS.md, CLAUDE.md, .github/DOCKER.md, README updates)
- Consolidates shared infrastructure from feature branches to reduce PR bloat

This allows feature branches to focus on their specific changes without carrying
infrastructure/V1 migration code that appears identically across all branches.
…685)

- V1 migration system (MigrationContext, V1MigrationManager, 8 entity migrators)
- Docker infrastructure (docker-compose, Dockerfiles, Makefile)
- Test automation (PARALLEL_TESTING_SETUP.md, run-pr-tests.sh)
- Documentation (AGENTS.md, CLAUDE.md, .github/DOCKER.md)

This consolidates shared infrastructure that appeared identically across all feature branches.
…ource

The provider registrations for the new company panel resources (#235, #243)
were added but the use statements were missing.
- SendReminderActionTest: use morph map alias 'invoice' instead of full class name
- UserService::assertBelongsToCompany: accept Company|int, check for elevated roles, use translation
- MyCompanies: show all companies for elevated users, not just attached ones

These tests were failing because of API changes and permission model assumptions.
MyCompanies switch action now catches AuthorizationException and shows
a warning notification instead of crashing, allowing graceful error handling
when a user attempts to switch to a company they don't have access to.
Timed individual test classes and marked those taking >14 seconds:
- InvoicePdfAndCreditNoteTest (27.4s) - PDF generation is slow
- RecurringInvoicesTest (21.7s) - Complex database operations
- SendReminderActionTest (19.1s) - Mail queue + fixtures
- EditInvoiceHeaderActionsTest (18.3s) - Multiple Livewire interactions
- V1MigrationTest (14.9s) - Data migration from v1
- EditQuoteHeaderActionsTest (14.5s) - Multiple Livewire interactions

These can now be excluded with: make test-fast
…ze phase comments

- ProjectsTest: added #[Test] and #[Group('crud')] to it_fails_to_create_project_without_required_starts_at
- ProjectsTest: fixed field name typo (starts_at → start_at) and factory call
- ProjectsTest: capitalized 5 phase comments (/* arrange */ → /* Arrange */ etc)
- RecurringInvoicesTest: capitalized 13 phase comments

Claude-Session: https://claude.ai/code/session_01Bmuv2rzHXTy6sw2oUV72e9
Based on individual test timing analysis (441 tests):
- it_filters_numberings_by_current_company_id (8.2s)
- it_falls_back_to_a_default_subject_and_blank_body_without_a_template (6.9s)
- it_hides_the_action_without_the_email_invoices_permission (6.7s)
- it_inserts_a_note_template_into_the_notes_field (6.2s)
- it_confirms_deleted_category_is_no_longer_findable (5.4s)

Tests marked across 5 test files (9 instances total).
Makefile already excludes slow tests by default.

Claude-Session: https://claude.ai/code/session_01Bmuv2rzHXTy6sw2oUV72e9
Resolved test name collisions by renaming duplicate methods:
- ExpenseCategoriesTest: it_confirms_deleted_category_is_no_longer_findable
  → it_confirms_deleted_expense_category_is_no_longer_findable
- SendReminderActionTest: it_falls_back_to_a_default_subject_and_blank_body_without_a_template
  → it_falls_back_to_a_default_reminder_subject_and_blank_body_without_a_template
- SendReminderActionTest: it_hides_the_action_without_the_email_invoices_permission
  → it_hides_send_reminder_action_without_the_email_invoices_permission
- QuotesTest: it_inserts_a_note_template_into_the_notes_field
  → it_inserts_a_note_template_into_the_quote_notes_field

Primary instances (one per test name) retained in: Products, Invoices (Email), Invoices (Invoice)

Claude-Session: https://claude.ai/code/session_01Bmuv2rzHXTy6sw2oUV72e9
Lower slow test threshold from 5s to 3s and mark 10 additional tests:
- it_updates_an_invoice_through_a_modal (4.6s)
- it_shows_create_invoice_action_only_for_customer_relations (4.3s)
- it_shows_create_quote_action_for_all_relation_types (4.3s)
- it_hides_delete_action_when_relation_has_linked_records (4.2s)
- it_hides_the_convert_action_for_converted_quotes (4.3s)
- it_generates_a_pdf_document (4.3s)
- it_shows_the_preview_modal_on_the_edit_page (4.2s)
- it_prefills_the_modal_from_the_companys_invoice_email_template (4.3s)
- it_shows_create_credit_note_on_sent_invoice (4.3s)
- it_shows_all_header_actions_on_draft_quote (4.2s)

Total slow tests now: 15 tests (up from 5).

Claude-Session: https://claude.ai/code
- Fix CompanyUserResource to use Filament v5 Schema API instead of deprecated Forms API
- Update composer.json: laravel/pint from dev-feat/blade to ^1.13 (stable)
- Run composer update to resolve dependencies
- Apply pint formatting fixes

Claude-Session: https://claude.ai/code
Fixed 2 phpstan errors:
- Relation::ccEmailCommunications() removed incorrect MorphMany return type (actual return is Builder)
- LoginResponseTest::dispatchResponse() removed incorrect RedirectResponse return type

Updated phpstan.neon to ignore Filament v5 schema/component classes that are not resolvable by phpstan.

Claude-Session: https://claude.ai/code
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.

8 participants