Skip to content

Service Layer Progress

Ed Mozley edited this page Jul 5, 2026 · 18 revisions

Service Layer β€” progress tracker

Rollout status of the service-layer refactor: collapsing each module's duplicated UI + REST API write logic into one shared service, module by module, behind a before/after parity harness.

Strategy: prove the pattern on the smallest, lowest-risk module first; do tickets last (biggest, most integrations). Each module is its own revertable commit; nothing ships unless the harness proves the API is byte-identical.

Per-module status

Module Status Adapter lines removed Parity Notes
Service Status βœ… Done (#718) 474 removed / 75 kept (9 files) βœ… byte-identical Pilot. Established the primitives + pattern.
Morning Checks ⬜ Planned β€” β€” Candidate next (small, low risk).
Software ⬜ Planned β€” β€” Candidate next (small, low risk).
Forms ⬜ Planned β€” β€”
Calendar ⬜ Planned β€” β€” NaΓ―ve server-local datetimes β€” good UTC candidate.
Contracts ⬜ Planned β€” β€”
Knowledge ⬜ Planned β€” β€”
Tasks ⬜ Planned β€” β€”
CMDB ⬜ Planned β€” β€”
Network Mapper ⬜ Planned β€” β€”
Assets ⬜ Planned β€” β€”
Changes ⬜ Planned β€” β€”
Problems ⬜ Planned β€” β€”
Service Status settings βœ… folded into pilot β€” n/a Incident-statuses + impact-levels are UI-only; moved into the service.
Tickets ⬜ Last β€” β€” Biggest payoff, most integrations β€” deliberately last.

Line savings β€” the honest picture

The first module is roughly line-neutral: it pays a one-time cost (the shared ActorContext + ServiceError primitives, ~105 lines) and its service includes UI-only logic that was never duplicated. The thousands of lines of net removal arrive as the larger, heavily-mirrored modules migrate β€” tickets above all.

Lines
One-time primitives (includes/service_context.php) +105 (paid once, for all modules)
Service Status: adapter logic removed βˆ’474
Service Status: adapters kept (thin) +75
Service Status: service (incl. UI-only ops) +390

Convergence log

Where a module's UI and API already behaved differently, we converge to the API's behaviour (the API is the external contract; it stays identical, the UI shifts to match). Record each convergence here so nothing is a silent surprise.

Service Status (#718):

  • Create timestamps: server-local β†’ UTC (SLA-correct; same bug class as Forms #701).
  • Empty description: "" β†’ null.
  • Affected-service validation: silently-skip unknowns β†’ strict 422.
  • Incident status: name-only β†’ name or id.
  • UI deletes: idempotent β†’ 404 on missing (matches the API).

Deferred / follow-up work

  • Display-layer UTC parsing β€” storage is now consistently UTC, but module JS parses "Y-m-d H:i:s" as local (new Date(...)), so UTC data can render an hour off. Needs a parse-as-UTC helper across every timestamp-rendering module (service-status, calendar, morning-checks are known offenders). See issue #2.
  • Webhook events from the write path β€” once a module is on its service, emitting lifecycle events (for outbound webhooks) is one line from the single write path, firing identically for UI, API and automation. This is the webhooks "wider event catalogue" phase.

How each module is done

  1. Read the complete surface β€” every UI endpoint and the API resource for the module.
  2. Enumerate the UI-vs-API divergences; agree the convergence.
  3. Build/adapt the parity harness; capture golden-before on untouched code.
  4. Extract <Module>Service; repoint the API write handlers + the UI endpoints at it.
  5. Run the harness after; require the API byte-identical, UI converged as designed.
  6. Ship as one commit. Update this page.

See Service Layer β€” architecture for the conventions and the full list of knotty issues.

FreeITSM

Getting Started

Modules

Multi-tenancy (planned)

Blue sky thinking

Bugs resolved

Links

Clone this wiki locally