Skip to content

feat(park): add fire-equipment maintenance and cost reporting - #310

Merged
DevSkyLex merged 10 commits into
developfrom
feat/fire-equipment-maintenance-web
Oct 8, 2026
Merged

DevSkyLex merged 10 commits into
developfrom
feat/fire-equipment-maintenance-web

Conversation

@DevSkyLex

@DevSkyLex DevSkyLex commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

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.

Change Summary

  • Add equipment identity/catalogue, customers, traceable replacement, independent preventive plans, service requests, procurement, inventory, private costs and versioned ERP exports.
  • Preserve exact accepted intentions in account-bound journals; recover expense/rate and repair-conversion commands with their original UUID/body before accepting conflicting declarations.
  • Fence equipment and schedule responses by their captured organization/selection. Campaign/override admission is scoped by organization and preserves already accepted writes.
  • Bound time pages/history, request beneficiary-only scope explicitly, reject unverifiable/foreign cached pages and retain legacy complete snapshots and physical pending facts.
  • Protect real dirty drafts and pending writes while allowing session-expiration navigation. Require explicit UTC offset for repeated local hours.
  • Keep locale navigation on the current origin and require independently reviewed VPS SSH host keys.

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

  • Ownership, SignalStore request states and organization/actor/session fences
  • Exact replay and recovery after route destruction or acknowledgement failure
  • API alignment, beneficiary scope and bounded paging/history
  • SSR/private data boundaries and navigation guards
  • Responsive/keyboard behavior and EN/FR/ES catalogues
  • Regression and release impact

Functional Impact

  • User-visible workflow, public feature APIs and routes changed
  • Backend contract expectations and translation catalogues changed
  • Offline persistence and deployment trust changed

FireGuard is retained. API permissions govern access; internal costs stay in dedicated financial workflows and outside ordinary customer reports.

Risk And Rollback

  • Organization scope, offline intentions, SSR and deployment involved

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

  • Complete final Angular suite: 9,144 tests in 789 files passed.
  • Format, authored documentation, standard/type-aware lint, architecture tests and strict EN/FR/ES production build passed.
  • 54 contract tests and canonical OpenAPI drift check passed at the exact pinned API commit. The export source publishedAt type now includes null to match the existing backend contract; the normalized API fingerprint is unchanged.
  • Final browser matrix: 33/34 passed before a harness animation race was corrected. The remaining reserve-selection scenario then passed on Chromium and WebKit using a normal click before typing, with unchanged confirmation/identity assertions.
  • Six fresh SSR cases passed, covering private maintenance routes and explicit financial dossier reads. Captures were inspected on desktop/mobile and light/dark examples.
  • The full SSR suite passed 28/28 on Chromium/WebKit with no retries after correcting the fixture's Mercure response to a persistent SSE stream. The native protocol regression failed on the old 204 response and passed 4/4 on the correction; smoke assertions and guards are unchanged.
  • Component HMR is disabled only for the E2E development server. A controlled reload reproduced cancelled Angular replacement-module imports; four final Chromium/mobile runs passed without retry, with a stronger business-screen assertion.
  • Regression suites cover recovery across real Router teardown, permission/selection changes, two retained cost intentions, A/B campaign concurrency, explicit DST folds and old polluted cache refusal.
  • Six offline tests of the actual SSH host-trust shell step passed.

CI Validation

  • All standard PR checks must pass on the current head
  • Final-head CI passed on 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.
  • Development deployment also requires successful integrated API/develop CI and Sonar on the exact source revision.

Deployment Notes

  • New environment secret and manual post-deploy checks required

Deploy the companion API first. VPS_SSH_KNOWN_HOSTS is 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

  • The final compatible API is merged into develop at 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.
  • New-head PR Sonar checks are skipped by the existing workflow; integrated develop Sonar is a separate release gate.
  • Brand renaming, portals, cross-organization collaboration, sensors and vendor-specific ERP integration remain deferred.
  • Browser scenarios do not exercise every paged-history expansion or recovery race; focused integration/unit tests provide that evidence.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T09:39:49.963758Z 6c63d60 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added area:auth Authentication, session, MFA, or trusted-device UI area:organization Organization or onboarding feature changes area:facility Facility feature changes area:equipment Equipment feature changes area:inspection Inspection or checklist feature changes area:intervention Intervention workflow or offline mode changes area:core Core infrastructure: HTTP, config, request-state, routing area:i18n Translation catalog changes area:tests Unit, integration, or end-to-end test changes area:docs Documentation changes area:config Build, tooling, or environment configuration changes risk:security Security-sensitive change risk:api-contract API contract, model, or data-access risk size:xl Very large PR: 800 changed lines or more state:ready Ready for review labels Oct 7, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +454 to +456
error: (error: unknown) => {
if (store.command() === command)
patchState(store, { commandCallState: errorCallState(toStoreError(error)) });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

DevSkyLex added a commit to DevSkyLex/fireguard-api that referenced this pull request Oct 7, 2026
…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.
@github-actions github-actions Bot added area:github GitHub workflows, templates, or repository automation risk:delivery Docker image, workflow, or deployment risk labels Oct 8, 2026
@DevSkyLex
DevSkyLex merged commit 1c72fab into develop Oct 8, 2026
22 checks passed
@DevSkyLex
DevSkyLex deleted the feat/fire-equipment-maintenance-web branch October 9, 2026 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:auth Authentication, session, MFA, or trusted-device UI area:config Build, tooling, or environment configuration changes area:core Core infrastructure: HTTP, config, request-state, routing area:docs Documentation changes area:equipment Equipment feature changes area:facility Facility feature changes area:github GitHub workflows, templates, or repository automation area:i18n Translation catalog changes area:inspection Inspection or checklist feature changes area:intervention Intervention workflow or offline mode changes area:organization Organization or onboarding feature changes area:tests Unit, integration, or end-to-end test changes risk:api-contract API contract, model, or data-access risk risk:delivery Docker image, workflow, or deployment risk risk:security Security-sensitive change size:xl Very large PR: 800 changed lines or more state:ready Ready for review type:dependencies npm dependency updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant