Modular logistics and supply chain operating system (LSOS)
JavaScript driver-appfleet-managementfreight-managementinfrastructureinventory-managementlast-mile-deliverylogisticsondemandopen-sourceorder-managementroute-optimizationsupply-chain-managementtracking-and-monitoringtransport-management-systemtransportationwarehouse-management
fix(console): make the lint suite pass, and report coverage without gating
Ronald A. Richardson879e1dc46029
diff --git a/.github/workflows/console.yml b/.github/workflows/console.ymlindex 7cc617a2..4dbc728f 100644--- a/.github/workflows/console.yml+++ b/.github/workflows/console.yml@@ -83,22 +83,28 @@ jobs:name: console-coveragefail_ci_if_error: false- # Coverage gate. Long-term target is 100% (scripts/coverage-check.mjs); the- # threshold ratchets up as the suite grows.+ # Coverage gate — reports the numbers, does not block this release.#- # 35 is the floor the suite currently holds. Measured locally at 392/392:- # lines 44.06% · statements 43.57% · functions 40.22% · branches 36.18%- # The check applies the threshold to ALL FOUR metrics, so branches is the- # binding constraint — 40 would fail today despite lines being at 44%.+ # Measured locally at 577/577 passing:+ # lines 70.02% · statements 69.84% · functions 68.69% · branches 71.54%+ # scripts/coverage-check.mjs applies the threshold to ALL FOUR metrics, so+ # functions is the binding constraint — 70 would fail today despite lines+ # being at 70.02%. 65 is the floor the suite comfortably holds.#- # Until this commit the console produced no coverage report at all (no babel- # instrumentation, no sendCoverage hook, and a scoped-modulePrefix path- # mismatch), so this gate has never actually evaluated anything. It stays- # continue-on-error for one release so the first real CI report can be- # observed; drop that line to make it a required, blocking check.- - name: Enforce coverage threshold+ # Deliberately still continue-on-error. Coverage produced no report at all+ # until recently (no babel instrumentation, no sendCoverage hook, and a+ # scoped-modulePrefix path mismatch dropping every file), and the Lint step+ # ahead of it was failing, so this gate has never once evaluated real data in+ # CI. Watch one green run before making it blocking.+ #+ # 100% remains the long-term target but is deferred: several files cannot be+ # covered as written — four use later(() => window.location.reload()), and+ # report.js has static methods calling getOwner() on the class, which returns+ # undefined. Reaching 100% needs those addressed (an injectable reload,+ # repairing or removing the dead statics) rather than more tests.+ - name: Report coverage thresholdcontinue-on-error: true- run: pnpm run coverage:check -- --fail-under=35+ run: pnpm run coverage:check -- --fail-under=65- name: Build (production)run: npx ember build --environment productiondiff --git a/console/.eslintignore b/console/.eslintignoreindex 9385391f..722f2232 100644--- a/console/.eslintignore+++ b/console/.eslintignore@@ -11,3 +11,9 @@# ember-try/.node_modules.ember-try/++# generated by lib/fleetbase-extensions-generator at build time — linting these is+# pointless because the generator rewrites them on every build, and whether they exist+# at lint time depends on whether a build has run (they are gitignored)+/app/router.js+/app/extensions/diff --git a/console/.stylelintignore b/console/.stylelintignoreindex a0cf71cb..f3cd85d5 100644--- a/console/.stylelintignore+++ b/console/.stylelintignore@@ -6,3 +6,8 @@# addons/.node_modules.ember-try/++# coverage report output (generated by ember-cli-code-coverage, gitignored).+# .eslintignore already excludes it; stylelint needs telling separately, otherwise+# `pnpm lint` passes or fails depending on whether a coverage run happened first.+/coverage/diff --git a/console/app/components/impersonator-tray.js b/console/app/components/impersonator-tray.jsindex f5fa8a6d..0533b83d 100644--- a/console/app/components/impersonator-tray.js+++ b/console/app/components/impersonator-tray.js@@ -1,5 +1,4 @@import Component from '@glimmer/component';-import { tracked } from '@glimmer/tracking';import { inject as service } from '@ember/service';import { action } from '@ember/object';import { later } from '@ember/runloop';diff --git a/console/app/components/onboarding/form.js b/console/app/components/onboarding/form.jsindex 00274c95..d8db66cf 100644--- a/console/app/components/onboarding/form.js+++ b/console/app/components/onboarding/form.js@@ -1,7 +1,7 @@import Component from '@glimmer/component';import { inject as service } from '@ember/service';import { tracked } from '@glimmer/tracking';-import { action, getProperties } from '@ember/object';+import { getProperties } from '@ember/object';import { isBlank } from '@ember/utils';import { task } from 'ember-concurrency';import OnboardValidations from '../../validations/onboard';diff --git a/console/app/components/onboarding/verify-email.js b/console/app/components/onboarding/verify-email.jsindex 72636d77..a2d0deaa 100644--- a/console/app/components/onboarding/verify-email.js+++ b/console/app/components/onboarding/verify-email.js@@ -1,9 +1,7 @@import Component from '@glimmer/component';import { inject as service } from '@ember/service';import { tracked } from '@glimmer/tracking';-import { action } from '@ember/object';-import { later, next } from '@ember/runloop';-import { not } from '@ember/object/computed';+import { next } from '@ember/runloop';import { task } from 'ember-concurrency';export default class OnboardingVerifyEmailComponent extends Component {diff --git a/console/app/controllers/console/admin/organizations/index.js b/console/app/controllers/console/admin/organizations/index.jsindex 5c25056d..6677eba1 100644--- a/console/app/controllers/console/admin/organizations/index.js+++ b/console/app/controllers/console/admin/organizations/index.js@@ -82,7 +82,22 @@ export default class ConsoleAdminOrganizationsController extends Controller {** @var {Array}*/- queryParams = ['query', 'name', 'page', 'limit', 'sort', 'country', 'status', 'owner_email', 'onboarding_completed', 'billing_status', 'created_at', 'needs_attention', 'missing_owner', 'inactive_status'];+ queryParams = [+ 'query',+ 'name',+ 'page',+ 'limit',+ 'sort',+ 'country',+ 'status',+ 'owner_email',+ 'onboarding_completed',+ 'billing_status',+ 'created_at',+ 'needs_attention',+ 'missing_owner',+ 'inactive_status',+ ];get actionButtons() {return [diff --git a/console/app/controllers/onboard/verify-email.js b/console/app/controllers/onboard/verify-email.jsindex af6180dd..7b763379 100644--- a/console/app/controllers/onboard/verify-email.js+++ b/console/app/controllers/onboard/verify-email.js@@ -1,9 +1,6 @@import AuthVerificationController from '../auth/verification';import { inject as service } from '@ember/service';import { tracked } from '@glimmer/tracking';-import { action } from '@ember/object';-import { later } from '@ember/runloop';-import { not } from '@ember/object/computed';import { task } from 'ember-concurrency';export default class OnboardVerifyEmailController extends AuthVerificationController {diff --git a/console/app/models/report.js b/console/app/models/report.jsindex 8a52f02e..4e007d6e 100644--- a/console/app/models/report.js+++ b/console/app/models/report.js@@ -1,8 +1,8 @@-import Model, { attr, belongsTo, hasMany } from '@ember-data/model';+import Model, { attr } from '@ember-data/model';import { computed } from '@ember/object';import { isArray } from '@ember/array';import { getOwner } from '@ember/application';-import { isPresent, isEmpty } from '@ember/utils';+import { isPresent } from '@ember/utils';import { format, formatDistanceToNow } from 'date-fns';export default class ReportModel extends Model {@@ -34,7 +34,6 @@ export default class ReportModel extends Model {@attr('raw') tags;@attr('raw') options;@attr('raw') meta;- @attr('string') status;/** @dates */@attr('date') created_at;@@ -75,7 +74,7 @@ export default class ReportModel extends Model {return format(this.created_at, 'yyyy-MM-dd HH:mm');}- @computed('query_config.columns.length', 'query_config.table.name') get hasValidConfig() {+ @computed('query_config.{columns.length,table.name}') get hasValidConfig() {return (isPresent(this.query_config) &&isPresent(this.query_config.table) &&@@ -311,12 +310,8 @@ export default class ReportModel extends Model {const owner = getOwner(this);const fetch = owner.lookup('service:fetch');- try {- const response = await fetch.post(this.id ? `reports/${this.id}/execute` : 'reports/execute-query', { query_config: this.query_config });- return response;- } catch (error) {- throw error;- }+ const response = await fetch.post(this.id ? `reports/${this.id}/execute` : 'reports/execute-query', { query_config: this.query_config });+ return response;}// API methods for interacting with the new backend@@ -324,58 +319,42 @@ export default class ReportModel extends Model {const owner = getOwner(this);const fetch = owner.lookup('service:fetch');- try {- const response = await fetch.post('reports/execute-query', { query_config: this.query_config });- return response;- } catch (error) {- throw error;- }+ const response = await fetch.post('reports/execute-query', { query_config: this.query_config });+ return response;}async export(format = 'csv', options = {}) {const owner = getOwner(this);const fetch = owner.lookup('service:fetch');- try {- const response = await fetch.post(`reports/${this.id}/export`, {- format,- options,- });+ const response = await fetch.post(`reports/${this.id}/export`, {+ format,+ options,+ });- return response;- } catch (error) {- throw error;- }+ return response;}async validate() {const owner = getOwner(this);const fetch = owner.lookup('service:fetch');- try {- const response = await fetch.post('reports/validate-query', {- query_config: this.query_config,- });+ const response = await fetch.post('reports/validate-query', {+ query_config: this.query_config,+ });- return response;- } catch (error) {- throw error;- }+ return response;}async analyze() {const owner = getOwner(this);const fetch = owner.lookup('service:fetch');- try {- const response = await fetch.post('reports/analyze-query', {- query_config: this.query_config,- });+ const response = await fetch.post('reports/analyze-query', {+ query_config: this.query_config,+ });- return response;- } catch (error) {- throw error;- }+ return response;}// Static methods for direct query operations@@ -383,89 +362,61 @@ export default class ReportModel extends Model {const owner = getOwner(this);const fetch = owner.lookup('service:fetch');- try {- const response = await fetch.post('reports/execute-query', {- query_config: queryConfig,- });+ const response = await fetch.post('reports/execute-query', {+ query_config: queryConfig,+ });- return response;- } catch (error) {- throw error;- }+ return response;}static async exportQuery(queryConfig, format = 'csv', options = {}) {const owner = getOwner(this);const fetch = owner.lookup('service:fetch');- try {- const response = await fetch('reports/export-query', {- query_config: queryConfig,- format,- options,- });+ const response = await fetch('reports/export-query', {+ query_config: queryConfig,+ format,+ options,+ });- return response;- } catch (error) {- throw error;- }+ return response;}static async validateQuery(queryConfig) {const owner = getOwner(this);const fetch = owner.lookup('service:fetch');- try {- const response = await fetch.post('reports/validate-query', { query_config: queryConfig });- return response;- } catch (error) {- throw error;- }+ const response = await fetch.post('reports/validate-query', { query_config: queryConfig });+ return response;}static async analyzeQuery(queryConfig) {const owner = getOwner(this);const fetch = owner.lookup('service:fetch');- try {- const response = await fetch.post('reports/analyze-query', { query_config: queryConfig });- return response;- } catch (error) {- throw error;- }+ const response = await fetch.post('reports/analyze-query', { query_config: queryConfig });+ return response;}static async getTables() {- try {- const { tables } = await fetch.get('reports/tables');- return tables;- } catch (error) {- throw error;- }+ const { tables } = await fetch.get('reports/tables');+ return tables;}static async getTableSchema(tableName) {const owner = getOwner(this);const fetch = owner.lookup('service:fetch');- try {- const { schema } = await fetch.get(`reports/tables/${tableName}/schema`);- return schema;- } catch (error) {- throw error;- }+ const { schema } = await fetch.get(`reports/tables/${tableName}/schema`);+ return schema;}static async getExportFormats() {const owner = getOwner(this);const fetch = owner.lookup('service:fetch');- try {- const { formats } = await fetch.get('reports/export-formats');- return formats;- } catch (error) {- throw error;- }+ const { formats } = await fetch.get('reports/export-formats');+ return formats;}// Utility methods for frontend displaydiff --git a/console/app/routes/auth/forgot-password.js b/console/app/routes/auth/forgot-password.jsindex b7ff18b5..51dac9a7 100644--- a/console/app/routes/auth/forgot-password.js+++ b/console/app/routes/auth/forgot-password.js@@ -1,5 +1,4 @@import Route from '@ember/routing/route';-import removeBootLoader from '../../utils/remove-boot-loader';export default class AuthForgotPasswordRoute extends Route {queryParams = {diff --git a/console/app/services/onboarding-orchestrator.js b/console/app/services/onboarding-orchestrator.jsindex 6fd34bbf..b0a2f5f9 100644--- a/console/app/services/onboarding-orchestrator.js+++ b/console/app/services/onboarding-orchestrator.js@@ -138,7 +138,7 @@ export default class OnboardingOrchestratorService extends Service {if (!this.flow || !this.flow.paths) return null;// Determine path based on context or current step- for (const [pathId, pathDef] of Object.entries(this.flow.paths)) {+ for (const pathDef of Object.values(this.flow.paths)) {if (pathDef.steps && pathDef.steps.some((s) => s.id === this.current?.id)) {return pathDef;}diff --git a/console/app/utils/router-refresh-patch.js b/console/app/utils/router-refresh-patch.jsindex c9ca4c51..e4d6d9c8 100644--- a/console/app/utils/router-refresh-patch.js+++ b/console/app/utils/router-refresh-patch.js@@ -1,3 +1,7 @@+// This utility exists specifically to patch Ember's private router microlib, so reaching+// for _routerMicrolib is the entire point — the public router service does not expose the+// refresh implementation that needs fixing.+/* eslint-disable ember/no-private-routing-service */import { debug } from '@ember/debug';/*** Fleetbase Router Refresh Bug Fix Utility@@ -37,8 +41,6 @@ export function patchRouterRefresh(application) {return;}- const originalRefresh = router._routerMicrolib.refresh.bind(router._routerMicrolib);-router._routerMicrolib.refresh = function (pivotRoute) {const previousTransition = this.activeTransition;const state = previousTransition ? previousTransition[this.constructor.STATE_SYMBOL] : this.state;diff --git a/console/ember-cli-build.js b/console/ember-cli-build.jsindex e8e9cc7b..163fa922 100644--- a/console/ember-cli-build.js+++ b/console/ember-cli-build.js@@ -4,7 +4,6 @@const EmberApp = require('ember-cli/lib/broccoli/ember-app');const Funnel = require('broccoli-funnel');const writeFile = require('broccoli-file-creator');-const mergeTrees = require('broccoli-merge-trees');const toBoolean = require('./config/utils/to-boolean');module.exports = function (defaults) {diff --git a/console/lib/fleetbase-extensions-generator/index.js b/console/lib/fleetbase-extensions-generator/index.jsindex 27505343..a0c504c9 100644--- a/console/lib/fleetbase-extensions-generator/index.js+++ b/console/lib/fleetbase-extensions-generator/index.js@@ -35,7 +35,7 @@ module.exports = {`;},- included(app) {+ included() {this._super.included.apply(this, arguments);console.log('\n' + '/'.repeat(70));diff --git a/console/lib/fleetbase-extensions-generator/package.json b/console/lib/fleetbase-extensions-generator/package.jsonindex 88b434c0..399ad782 100644--- a/console/lib/fleetbase-extensions-generator/package.json+++ b/console/lib/fleetbase-extensions-generator/package.json@@ -10,6 +10,9 @@},"dependencies": {"broccoli-funnel": "^5.0.2",- "broccoli-merge-trees": "^5.2.1"+ "broccoli-merge-trees": "^5.2.1",+ "chokidar": "4.0.3",+ "fast-glob": "^3.3.2",+ "recast": "^0.23.9"}}diff --git a/console/translations/en-us.yaml b/console/translations/en-us.yamlindex e368bd5f..ddec3f6e 100644--- a/console/translations/en-us.yaml+++ b/console/translations/en-us.yaml@@ -9,6 +9,7 @@ common:update: Updatesave: Savesave-changes: Save Changes+ close-and-save: Close and Savedelete: Deletedelete-selected: Delete Selecteddelete-selected-count: Delete {count} Selected@@ -146,6 +147,7 @@ common:password: Passwordconfirm-password: Confirm Passwordemail: Email+ phone: Phoneusername: Usernameremember-me: Remember Mewelcome: Welcome@@ -786,6 +788,13 @@ console:Received:message: No notifications to display.+modals:+ set-password:+ message: Your account was created from an invitation and does not have a password yet. Set one now to finish securing your account.+ new-password: New Password+ confirm-password: Confirm Password+ help-text: Enter a password at-least 6 characters to continue.+invite:for-users:invitation-message: You've been invited to join {companyName}