Testing and troubleshooting

Run focused tests in Docker

Run from the Atlas repository root:

docker exec -u www-data -w /var/www its-internal-app-its-internal-app-1 \
  php artisan test tests/Feature/Filament/SentimentTrainingPermissionsTest.php \
  tests/Feature/Filament/TicketSentimentPermissionsTest.php --do-not-cache-result

The result-cache option avoids writing a PHPUnit cache file when the mounted repository root is not writable by the container’s web user.

Tests use in-memory SQLite, not the live development PostgreSQL database. The test bootstrap rejects a non-SQLite database. If cached configuration interferes, clear local config and rerun; never remove the test database guard.

docker exec -u www-data -w /var/www its-internal-app-its-internal-app-1 \
  php artisan config:clear

Tests that exercise external integrations must fake every outbound request, prevent stray requests, and set their own configuration. Do not rely on local .env credentials or make real Autotask, OAuth, or Foundry calls from tests.

For tenant-related changes:

docker exec -u www-data -w /var/www its-internal-app-its-internal-app-1 \
  php artisan test tests/Feature/Tenancy/TenantSchemaAuditTest.php --do-not-cache-result

docker exec -u www-data -w /var/www its-internal-app-its-internal-app-1 \
  php artisan tenancy:audit-schema

Diagnose the right layer

SymptomCheck first
Page works, queued sync or analysis never finishesQueue worker status and logs; PHP-FPM running is insufficient.
Worker repeatedly enters FATALStartup errors, database connectivity, file ownership, and worker HOME; rebuild an outdated image if necessary.
Worker runs but does not process a jobConnection, database and queue name must match the dispatching app.
Scheduler runs locally but tickets do not sync periodicallyAutotask recurring schedules are production-only; use a deliberate local sync.
Ticket sync succeeds but sentiment is missingAnalysis switches, Foundry configuration, note content, and skipped-analysis logs. Sync alone does not guarantee a sentiment result.
Critique is missing despite training permissionsTicket-read/company access, View:TicketSentiment, Create feedback permission, and an existing analysis.
Record is missing for one userActive MSP, company scope, and server-side policy; do not bypass scoping.
UI changes are not visibleRun Vite or rebuild frontend assets.
Logs/views fail with permission errorsRun app commands as www-data; ask the environment owner to correct existing ownership rather than widening permissions.

Manual ticket-sync command

For an approved development environment, the direct command is:

docker exec -u www-data -e HOME=/var/www -w /var/www \
  its-internal-app-its-internal-app-1 php artisan autotask:sync-tickets

This calls the live Autotask integration and iterates all configured MSP organizations. Review the environment and import scope before running it; prefer a scoped UI action for a single ticket. It runs the direct sync itself, but any queued follow-up, including sentiment analysis, still needs a worker.

Source references

These guides summarize the app implementation and its source documentation. Check the checked-out revision when behaviour differs: