Skip to content

feat(descriptors): share the core FleetOps resource identity descriptors with every extension - #86

Merged
roncodes merged 1 commit into
release/v0.2.3from
feat/shared-resource-descriptors
Oct 9, 2026
Merged

roncodes merged 1 commit into
release/v0.2.3from
feat/shared-resource-descriptors

Conversation

@roncodes

@roncodes roncodes commented Oct 9, 2026

Copy link
Copy Markdown
Member

What change does this PR introduce?

Moves the resource identity descriptors for the eight resources every extension can see through this package's models into this package, so they are available wherever the models are:

  • addon/utils/resource-descriptors/shared.js builds descriptors for driver, vehicle, customer, contact, place, order, vendor and fleet. They are the same descriptors FleetOps registers today, minus the FleetOps-only openers.
  • addon/utils/resource-descriptors/helpers.js holds the building blocks (first, relation, photo, fact, dateLabel, ...) without importing anything from @fleetbase/ember-ui, which already depends on this package. engineOpener and engineInstalled are new: opening a resource loads the FleetOps engine on demand through the universe extension manager and hands the record to its action service, so the FleetOps bundle is only fetched when someone clicks.
  • addon/utils/placeholder-images.js is the styled placeholder set, moved from FleetOps verbatim.
  • The thin <Key::Pill>, <Key::Summary>, <Cell::KeyIdentity> and <SelectOption::Key> wrappers for those eight keys move here, so they resolve inside any engine that depends on this package.
  • instance-initializers/register-shared-resource-descriptors.js registers the descriptors with ember-ui's resource-registry service on every host and engine boot, but only for keys nobody has registered yet. FleetOps registers richer versions of the same keys when it boots and a later engine must not replace them.

A companion FleetOps PR deletes the moved wrappers and placeholder set there, re-exports the helpers, and builds its own driver, vehicle, customer, contact, place, order, vendor and fleet descriptors from the shared ones with its panel openers. The two are safe to land in either order: FleetOps keeps working on the published fleetops-data until its PR lands, and this package has no FleetOps dependency.

Why was this change needed?

Storefront, and any other extension, lists drivers, customers and places but cannot invoke FleetOps' identity cells, pills or summaries: an engine's components only exist in its own namespace. Duplicating them in each extension was ruled out, and eagerly loading the FleetOps engine from Storefront costs its whole bundle just to get descriptor data. Putting the descriptors and wrappers in the package every extension already depends on gives them the same rendering on a deep link, with no engine load until a click.

Other information

Validation, run locally:

pnpm exec eslint addon app tests --ext .js        # clean
pnpm exec ember-template-lint addon tests         # clean
COVERAGE=true pnpm exec ember test                # 1103 tests, 0 failures
node scripts/check-coverage.js                    # gate passed: 155 files at 100% statements, branches, functions, lines

New tests: unit coverage of the helpers, the eight descriptors, the placeholder images and the initializer, plus a rendering test that stubs ember-ui's generic components and proves every wrapper resolves and passes its resource type through.

Documentation: the README gains a "Shared resource descriptors" section. The extension developer docs in fleetbase/fleetbase.io should mention that these descriptors and wrappers come from this package; no API behaviour or fleetbase/postman spec changes.

Follow-up: the package will likely be renamed to @fleetbase/fleetops-shared in a separate PR, with a final fleetops-data release that re-exports every module under the old paths.

…e, order, vendor and fleet identity descriptors with every extension

The resource identity descriptors for the resources every extension can see
through this package's models now live here, together with the thin pill,
summary, identity-cell and select-option wrappers that name the resource type
for ember-ui's generic components, and the styled placeholder silhouettes they
fall back to.

An instance initializer registers the descriptors whenever the host or an
engine boots, filling in only keys nobody has registered, so a Storefront or
Ledger table renders a driver as an identity cell on a deep link without
loading the FleetOps engine. Opening a resource loads FleetOps on demand and
hands the record to its action service, so the engine bundle is only fetched
on click. FleetOps replaces these with its own openers when it boots.

Covered at 100% by unit tests for the helpers, descriptors, placeholder images
and initializer, and a rendering test that proves every wrapper resolves and
passes its resource type through.
@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (5914e85) to head (d5e74ab).

Additional details and impacted files
@@                Coverage Diff                @@
##           release/v0.2.3       #86    +/-   ##
=================================================
  Coverage          100.00%   100.00%            
=================================================
  Files                 116       120     +4     
  Lines                2936      3123   +187     
  Branches              698       765    +67     
=================================================
+ Hits                 2936      3123   +187     
Flag Coverage Δ
fleetops-data 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...itializers/register-shared-resource-descriptors.js 100.00% <100.00%> (ø)
addon/utils/placeholder-images.js 100.00% <100.00%> (ø)
addon/utils/resource-descriptors/helpers.js 100.00% <100.00%> (ø)
addon/utils/resource-descriptors/shared.js 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5914e85...d5e74ab. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@roncodes
roncodes merged commit 46dcae2 into release/v0.2.3 Oct 9, 2026
5 checks passed
@roncodes
roncodes deleted the feat/shared-resource-descriptors branch October 9, 2026 09:03
@roncodes

roncodes commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

Follow-up commits since opening:

  • fc72c01 / 4af3b7a: utils/identity-stub.js (buildIdentityStub) moves here from FleetOps so other extensions can build a stand-in record for a relation a row only knows by name; covered by its own unit tests. refactor(descriptors): build the shared resource descriptors from fleetops-data fleetops#379 re-exports it.
  • fb5aaa1: typeLabel('fleet-ops:contact') now reads "Contact" instead of "Fleet ops" (the Storefront customer pill surfaced this, since Storefront orders carry that customer type), and extensionManager() guards the universe service's lazy manager lookup, which throws on a host without one.

Validation on the final commit: 1107 tests, 0 failures. Every eligible file under addon/ is still at 100% on all four metrics. One caveat for the local gate run: after a pnpm install from the console workspace, the coverage report in this checkout also instruments @fleetbase/ember-core files resolved from the console's pnpm store, which drags the global percentages down to about 57% even though no file under addon/ has a gap. The three earlier gate runs on this branch, before that reinstall, passed at 100% with 155 and 156 eligible files. CI installs this package on its own and should not see those files; if it does, the coverage excludes pattern needs **/node_modules/** rather than */node_modules/**.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant