Commit Graph
35 Commits
Author SHA1 Message Date
Jeppe Bandopenhands 5441fea665 fix(api): simplify XLVask Selvvask surface by removing AI autopilot pipeline (#367)
## Summary

Removes the XLVask autopilot / automation / MiniMax / OpenAI pipeline
and the related module config, CLI, cron, and migration scaffolding. The
Selvvask view (Superuser -> Fakturaer -> Periode -> Selvvask) is reduced
to a single read-only listing of usage logs plus operator-driven ignore
/ unignore / accept / reject endpoints gated on the
`review_xlvask_usage_order` permission.

See `inventory/self-serve-inventory.md` for the full surface map.

## Test plan

- [x] `vendor/bin/pest --testsuite=Unit` -> **1266 passed**, 1 unrelated
pre-existing failure (`BirdControlPlaneActivationTest`, needs
`PLENO_REPO_ROOT_FOR_TESTS`).
- [x] `php -l` on every modified PHP file -> no syntax errors.
- [x] Grep validation -> zero production-code references to removed
surfaces (`xlvask_autopilot_service`, `xlvask_automation_service`,
`xlvask_automation_policy_service`, `EnsureXLVaskAutomationSchema`,
`runScheduledAutomationIfReady`, `processAutopilotQueue`, `MiniMax`,
`minimax`, ...).
- [ ] Qodana + Tests workflows green on this PR.

Co-authored-by: openhands <openhands@all-hands.dev>

---------

Co-authored-by: openhands <openhands@all-hands.dev>
2026-08-12 20:02:30 +02:00
Jeppe B ab6c3ba5b6 Fix route permission instance calls (#344)
## Root cause

`route_t::hasPermission()` and `requirePermission()` are instance
methods. Route code was invoking them with `self::`; the new XL Vask
hall-scope helper made that call from a genuinely static context,
causing PHP to throw:

`Non-static method routes\\xlvaskUsageLogsRoute::hasPermission() cannot
be called statically`

## Changes

- Invoke route permission methods through `$this` across all 273
executable legacy calls in 45 route classes.
- Make `xlvaskUsageLogsRoute::allowedHallIdsForUser()` an instance
helper and update all 13 callers.
- Preserve the existing all-scope and own-scope hall selection rules.
- Add a token-aware regression test that rejects executable
`self::hasPermission()` and `self::requirePermission()` calls, while
ignoring comments.
- Add focused XL Vask tests for global scanner hall scope and
group-limited own scope.
- Update affected route contract assertions to the instance-call form.

## Verification

- PHP lint: all 53 changed PHP files
- Focused PHPStan: changed XL Vask route and both new regression tests —
clean
- Focused regression slice: 58 passed, 748 assertions
- Full local unit suite: 1,300 passed, 9,442 assertions (1 unrelated
existing warning, 1 environment skip)
- Full local API suite: 285 passed, 11,704 assertions
- Exact-SHA GitHub Tests workflow: all 7 jobs passed (unit, API,
integration, legacy, edge gateway, and supporting checks)
- Independent exact-SHA QA gate: PASS, no findings
- Independent exact-SHA security gate: PASS, no findings
- Independent exact-SHA reviewer gate: PASS, no findings
- Remote comparison: exactly one commit ahead of
`40b104abed7723a7d1b7028190ecda0e7aeef829`; all 53 remote blob hashes
matched the reviewed worktree

## Delivery state

Draft only for human review. No merge or deployment is included. Qodana
is skipped while the PR remains draft and is therefore not represented
as a passed gate.
2026-08-04 16:04:41 +02:00
Jeppe B 40b104abed Add governed XL Vask AI invoice automation (#343) 2026-08-04 11:32:49 +02:00
Jeppe B 6d888a455d Automate XL-Vask invoice-period resolution (#340)
Deploy the revision-aware XL-Vask import and guarded autopilot infrastructure. Automatic actions remain fail-closed pending production readiness, calibration, dry-run, and canary gates.
2026-08-03 15:33:55 +02:00
Jeppe B 32a5b99204 Resolve remaining backend full-scan Qodana findings (#315)
Fix the two High findings exposed by the first full master Qodana scan after the broader remediation.
2026-07-17 06:24:47 +02:00
Jeppe Bundgaard 0cca597fdc Fix XLVask usage import dates
Fix XLVask usage-log import metadata and period-scoped Selvvask automation.
2026-07-06 23:49:28 +02:00
Jeppe B fdb073f17f Merge pull request #204 from copenhagentruckwash/fix-unauthenticated-sync-usage-endpoint
Enforce permission on XLVask sync-usage route
2026-06-01 22:50:42 +02:00
Jeppe B 20fcd4ac16 Protect XLVask sync-usage route with permission check 2026-06-01 22:50:33 +02:00
Jeppe Bundgaard 70080086da Add unit tests for Redis namespace safety, MotorAPI cache functionality, and configuration classes, alongside implementation of xlvask_automation_service
- Added tests to ensure Redis namespace safety for `db_object_t` and `users_o`.
- Implemented `MotorApiCachedResultTest` to validate metadata caching behavior.
- Introduced configuration classes for `xlvask_automatic_order_attachment_enabled` and `xlvask_automatic_order_creation_enabled`.
- Developed `xlvask_automation_service` with supporting features for usage log evaluation, suggestion building, and order automation.
2026-05-12 00:22:27 +02:00
Jeppe Bundgaard 16198f49e6 Refactor XL Vask module for better null handling and primary item validation
- Improved null safety by updating product ID retrieval logic in parsers and usage logs.
- Enhanced primary wash item selection with stricter checks for valid product types.
- Adjusted import date modifier in `importUsageLogs` for extended range (`-7 day`).
- Streamlined product and user association in order creation with additional validations.
- Removed redundant checks and refined permission handling in import tasks.
2025-07-21 16:47:05 +02:00
Jeppe Bundgaard e057b225a6 Make importUsageLogs and getUsageLogsFromXLVask accept dynamic date modifiers 2025-07-16 13:59:08 +02:00
Jeppe Bundgaard 648a58b724 Add import usage logs functionality to XL Vask module 2025-07-16 10:38:06 +02:00
Jeppe Bundgaard f74a904738 Add import vehicles functionality to XL Vask module 2025-07-15 15:01:03 +02:00
Jeppe Bundgaard 026942f772 Add import customers functionality to XL Vask module 2025-07-15 14:25:40 +02:00
Jepp9350 0f8ec71ffe Enhance orders_o: add wash ID, timestamp creation, and detailed debug logging for mismatched totals. Add new parsers (xlvask_parser_ikke_b_rster_mellom_bil_og_trailer, xlvask_parser_s_be_dysebom_tak) and integrate into xlvask_helpers. Set memory limit in moduleXLVaskRoute. 2025-07-06 19:31:07 +02:00
Jepp9350 29aa63bb08 Add vehicle type handling in customer_vehicles_o, including vehicle type retrieval, setting, and creation in XLVask. Extend route logic to support vehicle type updates and auto-start on LPR configurations, incorporating enhanced validation and permission checks. Refactor and streamline helper classes for consistency and functionality expansion. 2025-06-19 15:01:22 +02:00
Jepp9350 9d431d55d8 Refactor vehicle synchronization logic in XLVask helpers, update instantiation, and remove legacy customer creation code. 2025-06-18 15:39:27 +02:00
Jepp9350 9bcf52a046 Remove obsolete and commented-out legacy code in XLVask customer creation route. 2025-06-18 15:02:28 +02:00
Jepp9350 177767c499 Remove debugging statements and refine XLVask customer creation logic. 2025-06-18 14:36:35 +02:00
Jepp9350 b068d499ca Reinstate modules_xlvask_sync_usage permission check in XLVask debug task route. 2025-06-17 20:09:24 +02:00
Jepp9350 cc0d1861cc Add updateCustomer method to XLVask endpoints, enhance cache handling for customer retrieval and management, and refine customer property definitions in helper class. 2025-06-17 20:05:03 +02:00
Jepp9350 43f0cd3a25 Ensure vehicleId is set before deleting vehicle and update route logic for vehicle fetching and debugging. 2025-06-17 19:08:52 +02:00
Jepp9350 3b4232a308 Add deleteVehicle method to XLVask endpoints and update route logic to use it 2025-06-17 18:49:32 +02:00
Jepp9350 67b178b002 Add vehicle management utilities for XLVask, implement updateVehicle method, refine endpoint logic, and introduce helper class for vehicle operations. 2025-06-17 18:42:20 +02:00
Jepp9350 9a92f14637 Add support for XLVask vehicle management helpers, implement GUID generation, vehicle type handling, and createVehicle method in endpoints. Extend route logic and refine class imports. 2025-06-17 17:16:13 +02:00
Jepp9350 6e6ab047ec Add XLVask customer creation logic, extend user and helper classes, and integrate Slack notifications for failed API requests. 2025-06-17 12:24:14 +02:00
Jepp9350 ce95304fae Reinstate permission check for sync-usage task in Module XLVask route. 2025-06-16 15:09:30 +02:00
Jepp9350 39e24465c4 Add multiple XLVask parsers, extend department and order selection logic, and add usage synchronization endpoint 2025-06-10 14:52:47 +02:00
Jepp9350 af75d38af9 Add new cron task for XLVask module with synchronization logic in Cron.php and tasks helper functions 2025-06-03 14:08:59 +02:00
Jepp9350 79469914ec Refactor xlvask customer property handling with improved default value mapping and data type conversions 2025-06-03 12:57:11 +02:00
Jepp9350 1b2c573629 Enhance xlvask customer handling with nullable properties, default values, and data type conversion 2025-06-03 12:37:06 +02:00
Jepp9350 b0173193f2 Add task helpers and cron job support for xlvask module with user synchronization endpoint integration 2025-06-03 09:09:50 +02:00
Jepp9350 b837f572af Add handling for forced prices, arrays, and improved type checks
Introduced support for forced pricing in `addItemToOrder` and added stricter validation for array inputs in SQL queries. Enhanced JSON handling in type validation and improved code reuse with new objects. Added new endpoint `/modules/xlvask/related-orders` to fetch related orders by wash IDs.
2025-05-22 22:51:05 +02:00
Jepp9350 d00bfef583 Add 'product' support to department time bookings
This update incorporates the 'product' parameter into the department time bookings API, supporting its addition, update, and validation processes. Additionally, composer dependencies are updated with several new libraries, enhancing functionality and compatibility.
2025-05-19 15:16:58 +02:00
Jepp9350 023b6992b6 Add xlvask module API integration
Introduced xlvask module with request handling, endpoints, and route mappings. Implemented functionalities to fetch usage logs, vehicles, and customers from the API, along with basic authentication support. Includes error handling and configuration setup for seamless integration.
2025-05-08 14:03:13 +02:00