Repository navigation
feat(park): add fire-equipment maintenance and cost reporting - #310
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c63d60f3f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| error: (error: unknown) => { | ||
| if (store.command() === command) | ||
| patchState(store, { commandCallState: errorCallState(toStoreError(error)) }); |
There was a problem hiding this comment.
Reject stale procurement errors after an organization switch
When an in-flight command for organization A fails after the reused procurement route has switched to organization B, this branch only checks command identity and writes A's error into B's store, unlike the success branch's scopeVersion and organization checks. Because the command is retained and the page's retry action re-executes it, B's workspace becomes locked and the user can resend a mutation against A while viewing B; fence errors with the captured organization and scope version before updating state.
Useful? React with 👍 / 👎.
…anagement # Context FireGuard now supports the full fire-equipment park lifecycle: identify equipment, schedule independent controls and maintenance, retain execution evidence, repair or replace assets, and analyze internal maintenance costs. FireGuard branding remains unchanged. - Companion frontend: DevSkyLex/fireguard-web#310. - Commercial invoicing, taxes and payments remain in the external ERP. Billing continues to own the SaaS subscription. ## Change Summary - Enrich equipment dossiers, optional internal customers, organization-managed equipment types, archive-aware park queues and idempotent replacement with retained history. - Introduce independent operation plans, fixed calendar anchors, occurrence reservation, explicit result validation and single-engine migration from historical schedules. - Add service requests, corrective work, quantitative inventory, procurement, exact valuations, current/frozen costs and immutable versioned ERP exports. - Address review findings around campaign scope, historic identity, partial returns, archive-page memory, financial allocation, direct equipment and supplier filters. ## Review Guide ### Modules / Areas Equipment, Facility, Maintenance, Inspection, Intervention, Organization and Onboarding; new Customer, ServiceRequest, Inventory, Procurement, MaintenanceCost and MaintenanceExport modules. ### Main Files / Entry Points Module contracts and `MODULE.md` files, explicit main-manager wiring in `config/modules`, API resources and DTOs, the canonical `openapi.json`, and twenty additive migrations under `migrations/main`. ### Reviewer Focus - [x] Business logic correctness - [x] Authorization / permissions - [x] Tenant / organization isolation - [x] API contract / serialization - [x] Persistence / migrations / Doctrine mapping - [x] Entity manager wiring (auth vs main database) - [x] Architecture / layer boundaries - [x] MODULE.md updated - [x] Query / collection performance - [x] Regression tests ## Functional Impact - [x] User-visible behavior changed - [x] Public API or response shape changed - [x] Database schema or migration impact Existing routes, equipment type codes, QR identities, historical campaigns and offline command identities are retained. A realized unfavorable control does not close its anomalies; creating work does not complete an occurrence. Published dossiers retain their original identity and evidence. Unknown historic cost attribution remains incomplete. ## Risk And Rollback - [x] Cross-organization scope involved - [x] Persistence / transaction / data lifecycle changed Dedicated financial permissions protect costs and exports. Inventory facts survive shortage without negative stock or implicit partial debit. Return valuation restores exactly the remaining original value. Export corrections append compensating adjustments without rewriting retained artifacts. Deploy using the existing development workflow, which backs up both databases and files before migration. An application rollback must use a compatible previously validated image; the additive schema is retained. Failed migrations require the documented coordinated recovery or a forward fix, not an automatic destructive schema rollback. ## Validation ### Local Validation - Full isolated PostgreSQL suite: **15,413 tests, 121,258 assertions**. - PHPStan, uncached PHP CS Fixer, both Deptrac configurations, Symfony container/YAML lint and auth/main schema validation passed. - Cold OpenAPI export matches the retained contract; frontend contract audit and 54 contract tests passed. - Real regressions cover mixed validated/skipped task costs, historic unknown allocation, direct material identity, calendar timezones, archival, campaign scope, replay, return bounds and supplier state. - Metadata pages over 31 retained large exports transfer no artifact payloads and allocate approximately **105 KiB**, instead of loading more than 400 MiB of archive bytes. ### CI Validation - [x] Standard PR checks cover this change. - [x] Development deployment additionally requires successful CI and SonarQube on the exact integrated develop SHA. ## Deployment Notes - [x] Migration order matters - [x] Manual post-deploy check required Use `develop` and the existing Deploy VPS workflow. Keep `reset_development_fixtures=false`. The twenty new migrations belong to main; preserve the workflow's auth-then-main ordering, backups, RBAC synchronization and transport initialization. New operation plans are prepared and activated explicitly; the release does not automatically switch an organization's preventive engine. Deploy API before the companion frontend, then verify workflow health checks. ## Known Gaps Brand renaming, customer portal, cross-organization collaboration, sensors and a vendor-specific ERP connector remain deferred. General building and industrial maintenance remain outside scope.
Context
Make the fire-equipment Park the main FireGuard workflow: equipment dossiers, optional internal customers and separate queues for unavailable equipment, upcoming controls and unresolved anomalies. Operators and service providers use the same permission-controlled flows.
9d5e63a6e602175d3e66bc433d2fa69e281d05e2with its verified fingerprint.Change Summary
Review Guide
Features / Areas
Organization Park, equipment, customers, maintenance schedules, service requests, inventory, procurement, maintenance costs/exports, intervention execution, onboarding, offline storage and deployment.
Main Files / Entry Points
Owning FEATURE.md contracts; public feature APIs/routes; SignalStore slices; durable command repositories/coordinator; time journal/prefetch/cache; native Spartan forms/sheets; canonical contract fixture and browser mocks.
Reviewer Focus
Functional Impact
FireGuard is retained. API permissions govern access; internal costs stay in dedicated financial workflows and outside ordinary customer reports.
Risk And Rollback
Preserve pending command journals and original replay identities. Page-key v2 intentionally ignores unverifiable old partial time pages; legacy complete snapshots still filter beneficiaries before paging. A rollback image must continue to understand retained intentions, or those intentions must be resolved before rollback. Keep the compatible backend and the reviewed SSH trust gate.
Validation
Local Validation
publishedAttype now includes null to match the existing backend contract; the normalized API fingerprint is unchanged.CI Validation
9af5b797f72edf1cadb50a5d7206c6d8f89f3d72: all 16 executed jobs succeeded, including full Angular tests, Chromium, Mobile Chrome, Mobile Safari, SSR, translations, canonical contracts, lint and strict production build. Sonar PR is skipped by the existing workflow; integrated develop Sonar remains required.Deployment Notes
Deploy the companion API first.
VPS_SSH_KNOWN_HOSTSis configured in the development environment of both repositories from the operator's existing known_hosts entry, matching the public key shown by the usual SSH session. Existing API/Mercure endpoints, Basic Auth and noindex checks remain in the deployment workflow.Known Gaps
cce71cfdf25bae7c8de75e6eee933e81dcb2563c. All corresponding PR checks passed. Direct Sonar confirmed 171 of 173 issues removed; the final two have code fixes with preserved mapping bodies and passing tests/review. Fresh integrated API Sonar and development deployment remain release prerequisites.