feat: allowed null values in API models - #18
Conversation
request. Added userId to timesheets and stopped resolving ticket status against the session project when a ticket has no project. Added PHPUnit setup and a Taskfile for running tests.
turegjorup
left a comment
There was a problem hiding this comment.
Approved with comments. Highly recommend fixing.
| fail-fast: false | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 |
|
|
||
| # Matches the PHP version in Dockerfile (itkdev/php8.3-fpm). | ||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 |
There was a problem hiding this comment.
This should run in the projects docker compose stack, not using shivammathur/setup-php
| "require-dev": { | ||
| "illuminate/database": "^11.0", | ||
| "nesbot/carbon": "^2.72.2 || ^3.0", | ||
| "phpunit/phpunit": "^11.0" |
There was a problem hiding this comment.
"PHPUnit 11 and older versions no longer receive bug fixes", Latest is 13, no reason to start on an older version
There was a problem hiding this comment.
changed to phpunit 12, that supports php 8.3 which the current version of leantime runs.
|
Follow-up to my review above. Ran the suite in the compose container first: 14 tests, 45 assertions, OK on PHP 8.3.31. A.
|
Allowed a missing worker name, and stopped returning a whitespace-only name for a worker whose firstname and lastname are both blank. Ticket status labels are looked up once per project instead of once per ticket, and the remaining implicit-nullable parameters are now explicit. Committed composer.lock and pinned illuminate/database and nesbot/carbon to the versions Leantime v3.9.7 locks, so the tests run against the code Leantime itself runs. PHPUnit moved to 12, the newest release that still runs on PHP 8.3. The pull request test job runs in the project's Docker Compose stack, so the PHP version comes from the Dockerfile rather than being repeated in the workflow. Releases no longer ship .claude, .idea or compose.yml.
The container ran as `deploy` (uid 1000) while the CI checkout belongs to the runner's uid, so composer could not create `vendor`. The compose user now comes from COMPOSE_USER, which the workflow sets to the checkout owner; the image carries a `runner` user at that uid, so it still has a writable home. Only `bin/create-release` needs the rsync the Dockerfile adds, so tests and linting run on itkdev/php8.3-fpm directly and no longer build an image. The built image moved to a `php-release` service, used by the release workflow alone.
|
The CONCAT NULL path isn't reachable on a conformant schema — zp_user.username/.firstname/.lastname are all NOT NULL in 3.9.7 (Install.php:684-687), and no migration relaxes them. The reachable bug was blank name parts yielding " ". The nullable model is deliberate defence-in-depth; NULLIF is what actually fixes the observable output. |
Matches how itk-dev/economics does it, and drops a shell step.
Link to ticket
https://leantime.itkdev.dk/#/tickets/showTicket/8000
Description
Relates to itk-dev/economics#325 that handles the null values.
Checklist