Skip to content

create storeknox fake app models#1671

Open
Yibaebi wants to merge 1 commit intodevelopfrom
models-fake-app-sk
Open

create storeknox fake app models#1671
Yibaebi wants to merge 1 commit intodevelopfrom
models-fake-app-sk

Conversation

@Yibaebi
Copy link
Copy Markdown
Contributor

@Yibaebi Yibaebi commented Mar 6, 2026

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 6, 2026

Walkthrough

Adds fake-app detection: new SkFakeApp model, serializer, and adapters (nested DRF endpoints and POST actions); extends SkApp and Organization with detection attributes and enums; adds Mirage factories/models; and disables multiple acceptance tests.

Changes

Cohort / File(s) Summary
Fake App model, serializer, adapter
app/models/sk-fake-app.ts, app/serializers/sk-fake-app.ts, app/adapters/sk-fake-app.ts
New SkFakeAppModel with typed attributes/relationships and helper methods; serializer maps storeskStore; adapter builds nested /sk_app/{sk_app_id}/sk_fake_app URLs, overrides query/record URL building, and adds ignore / ignoreAndAddToInventory POST actions with response normalization and registry augmentation.
Inventory adapter/serializer/model
app/adapters/sk-fake-app-inventory.ts, app/serializers/sk-fake-app-inventory.ts, app/models/sk-fake-app-inventory.ts
New SkFakeAppInventoryAdapter (fixed base path), SkFakeAppInventorySerializer (extends SkAppSerializer), and SkFakeAppInventoryModel (extends SkAppModel); TypeScript registry entries added.
SkApp & Inventory model updates
app/models/sk-app.ts, app/models/sk-inventory-app.ts
SkAppModel gains fake-app detection attributes, counts, many derived getters/predicates and renamed store-monitoring getters; removed containsUnscannedVersion getter from SkInventoryAppModel.
Enums & organization feature flag
app/enums.ts, app/models/organization.ts
Added SK_FAKE_APP_STATUS, SK_FAKE_APP_DETECTION_STATUS, SK_APP_MONITORING_STATUS_FILTER enums; added fake_app_detection: boolean to Features.
Mirage factories & models
mirage/factories/sk-app.ts, mirage/factories/sk-fake-app.ts, mirage/models/sk-fake-app.ts
Added sk-fake-app Mirage factory and model (belongsTo sk-inventory-app); extended sk-app factory with fake-app fields, enum-display helper, and updated traits.
Tests: acceptance suites disabled
tests/acceptance/storeknox/.../*.js (multiple files)
Multiple parameterized and individual acceptance tests changed from test/test.each to test.skip/test.skip.each, disabling their execution.
TypeScript registry augmentations
app/adapters/..., app/serializers/..., app/models/...
Module augmentations added to register new adapters, serializers, and models with Ember Data TypeScript registries.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • avzz-19

Poem

🐰 I hopped through enums, models, and nested routes,
Built little adapters with tidy little bouts.
POSTed ignore, pushed responses with glee,
Mirage made mock apps dance for me.
A carrot-coded cheer — fake apps, beware of me!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided by the author; the description field is empty. Add a description explaining the purpose, context, and scope of the fake app detection feature implementation to aid reviewers.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'create storeknox fake app models' is specific and accurately describes the main changes: introducing new Ember Data models for fake app detection (SkFakeAppModel, SkFakeAppInventoryModel) and related infrastructure.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch models-fake-app-sk

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 6, 2026

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 6, 2026

Deploying irenestaging with  Cloudflare Pages  Cloudflare Pages

Latest commit: cb842e3
Status: ✅  Deploy successful!
Preview URL: https://b1073e54.irenestaging.pages.dev
Branch Preview URL: https://models-fake-app-sk.irenestaging.pages.dev

View logs

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
app/models/sk-fake-app.ts (1)

150-156: Consider extracting magic strings to constants.

The string literals 'fake_app' and 'brand_abuse' are used for classification comparison. While functional, extracting these to named constants would improve maintainability and reduce typo risks.

♻️ Optional refactor to use constants
+const AI_CLASSIFICATION_LABELS = {
+  FAKE_APP: 'fake_app',
+  BRAND_ABUSE: 'brand_abuse',
+} as const;
+
 get isFakeApp() {
-  return this.aiClassificationLabel === 'fake_app';
+  return this.aiClassificationLabel === AI_CLASSIFICATION_LABELS.FAKE_APP;
 }

 get isBrandAbuse() {
-  return this.aiClassificationLabel === 'brand_abuse';
+  return this.aiClassificationLabel === AI_CLASSIFICATION_LABELS.BRAND_ABUSE;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/models/sk-fake-app.ts` around lines 150 - 156, Extract the magic strings
used in the getters into named constants and use those constants in isFakeApp
and isBrandAbuse; specifically, create constants like FAKE_APP_LABEL =
'fake_app' and BRAND_ABUSE_LABEL = 'brand_abuse' and replace direct comparisons
of this.aiClassificationLabel === 'fake_app' and === 'brand_abuse' with
comparisons to those constants so the checks in isFakeApp and isBrandAbuse
reference the new constants (and centralize the labels for reuse).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/adapters/sk-fake-app.ts`:
- Around line 67-83: The addToInventory method must validate that skAppId
extracted via skFakeApp.belongsTo('skApp').id() is not null before using it in
_buildNestedURL; add the same null-guard used elsewhere: check skAppId,
log/throw a clear error (or return a rejected Promise) if missing, and only call
this._buildNestedURL(skAppId, skFakeApp.id) and proceed to ajax/normalize/push
when skAppId is present so store.normalize and store.push are never called with
an invalid URL or missing parent id.
- Around line 51-65: The skApp relationship can be unloaded so calling
skFakeApp.belongsTo('skApp').id() may return null; update both ignore() and
addToInventory() to guard that value before using it with _buildNestedURL:
retrieve const skAppId = skFakeApp.belongsTo('skApp').id(); if skAppId is falsy,
throw a clear error (or return/reject) indicating the skApp relationship is not
loaded so you avoid building URLs with "null"; apply the same
null-check/early-exit to addToInventory() where belongsTo('skApp').id() is used.

---

Nitpick comments:
In `@app/models/sk-fake-app.ts`:
- Around line 150-156: Extract the magic strings used in the getters into named
constants and use those constants in isFakeApp and isBrandAbuse; specifically,
create constants like FAKE_APP_LABEL = 'fake_app' and BRAND_ABUSE_LABEL =
'brand_abuse' and replace direct comparisons of this.aiClassificationLabel ===
'fake_app' and === 'brand_abuse' with comparisons to those constants so the
checks in isFakeApp and isBrandAbuse reference the new constants (and centralize
the labels for reuse).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 616dd5cc-ca86-4f4b-8381-238e28b08e81

📥 Commits

Reviewing files that changed from the base of the PR and between 709d6f0 and f5f4a73.

📒 Files selected for processing (5)
  • app/adapters/sk-fake-app.ts
  • app/enums.ts
  • app/models/sk-app.ts
  • app/models/sk-fake-app.ts
  • app/serializers/sk-fake-app.ts

Comment thread app/adapters/sk-fake-app.ts
Comment thread app/adapters/sk-fake-app.ts Outdated
@cypress
Copy link
Copy Markdown

cypress bot commented Mar 6, 2026

Irene    Run #810

Run Properties:  status check failed Failed #810  •  git commit ec8ea45e45 ℹ️: Merge f5f4a73bf24695726c46caf39dc76fd9cee2ee73 into 709d6f0ca7a1e59e4f19dfb03c4c...
Project Irene
Branch Review models-fake-app-sk
Run status status check failed Failed #810
Run duration 04m 27s
Commit git commit ec8ea45e45 ℹ️: Merge f5f4a73bf24695726c46caf39dc76fd9cee2ee73 into 709d6f0ca7a1e59e4f19dfb03c4c...
Committer Yibaebi Elliot
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 1
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 30
View all changes introduced in this branch ↗︎

Tests for review

Failed  cypress/tests/dynamic-scan.spec.ts • 1 failed test

View Output

Test Artifacts
Dynamic Scan > it tests dynamic scan for an apk file: 132571 Test Replay Screenshots

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
mirage/factories/sk-app.ts (1)

87-90: ⚠️ Potential issue | 🟠 Major

Pin the monitoring/fake-app state in withApprovedStatus.

app/models/sk-app.ts now derives fakeAppDetectionIsDisabled, fakeAppDetectionHasResults, and needsAction from monitoring_enabled, store_monitoring_status, and fake_app_detection_status. Leaving those values random here makes a supposedly neutral approved fixture unstable.

🧭 Suggested fix
   withApprovedStatus: trait({
     approval_status: ENUMS.SK_APPROVAL_STATUS.APPROVED,
     app_status: ENUMS.SK_APP_STATUS.ACTIVE,
+    monitoring_enabled: false,
+    store_monitoring_status: ENUMS.SK_APP_MONITORING_STATUS.DISABLED,
+    fake_app_detection_status: ENUMS.SK_FAKE_APP_DETECTION_STATUS.DISABLED,
+    has_store_monitoring_data: false,
+    has_fake_app_detection_data: false,
   }),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@mirage/factories/sk-app.ts` around lines 87 - 90, The withApprovedStatus
trait currently only pins approval_status and app_status but leaves
monitoring_enabled, store_monitoring_status, and fake_app_detection_status
random, which makes derived properties (fakeAppDetectionIsDisabled,
fakeAppDetectionHasResults, needsAction) unstable; update the
mirage/factories/sk-app.ts trait withApprovedStatus to explicitly set
monitoring_enabled, store_monitoring_status, and fake_app_detection_status to
stable values (e.g., monitoring_enabled: false and deterministic
store_monitoring_status and fake_app_detection_status enums that represent a
neutral/disabled state) so the model-derived flags are consistent for the
approved fixture.
🧹 Nitpick comments (1)
mirage/factories/sk-fake-app.ts (1)

9-10: Prefer faker.image.url() for these icon fields.

Faker v8 documents imageUrl() as deprecated in favor of url(). This file already uses the newer API for sk_store.icon, so switching these two fields keeps the factory on one API surface. (v8.fakerjs.dev)

♻️ Suggested cleanup
-  original_app_icon_url: () => faker.image.imageUrl(),
-  fake_app_icon_url: () => faker.image.imageUrl(),
+  original_app_icon_url: () => faker.image.url(),
+  fake_app_icon_url: () => faker.image.url(),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@mirage/factories/sk-fake-app.ts` around lines 9 - 10, Change the two factory
fields original_app_icon_url and fake_app_icon_url to use the newer Faker API by
calling faker.image.url() instead of faker.image.imageUrl(); update both
occurrences so they match the existing usage for sk_store.icon and keep the
factory consistent with Faker v8's non-deprecated API.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/adapters/sk-fake-app.ts`:
- Around line 30-33: The code uses truthiness checks that treat 0 as falsy;
update all checks in this adapter to use explicit null/undefined checks instead:
inside _buildNestedURL replace any if (id) with if (id !== undefined && id !==
null) and similarly replace any checks of query.sk_app_id with if
(query.sk_app_id !== undefined && query.sk_app_id !== null); ensure you update
every occurrence (the checks around nested URL construction in _buildNestedURL
and any other methods in sk-fake-app.ts that currently use truthy checks for
sk_app_id or id) so numeric 0 is treated as a valid ID.

In `@app/models/sk-app.ts`:
- Around line 259-261: The model exposes appMonitoringIsInDisabledState but
callers still use appIsInDisabledState; add a compatibility getter named
appIsInDisabledState that returns the same value as
appMonitoringIsInDisabledState (or !this.monitoringEnabled) in the same class so
existing callers (e.g., in app-list/table/monitoring-status) continue to work
while they are migrated, and consider adding a deprecation comment on
appIsInDisabledState.
- Around line 263-281: The getters totalFakeApps, brandAbuseFakeAppPercentage,
and fakeAppsFakeAppPercentage do not guard against missing fakeAppCounts or a
zero denominator; update totalFakeApps to return 0 if this.fakeAppCounts is
falsy, and change brandAbuseFakeAppPercentage and fakeAppsFakeAppPercentage to
first check that this.fakeAppCounts exists and this.totalFakeApps > 0 and
otherwise return 0 (or a safe default) to avoid division-by-zero/NaN; keep the
existing allFakeAppsCountsAreZero logic but ensure it also handles a missing
this.fakeAppCounts consistently.

In `@app/models/sk-fake-app.ts`:
- Around line 149-150: The ignoreReason attribute on the SKFakeApp model should
be nullable: update the declaration of ignoreReason in app/models/sk-fake-app.ts
(symbol: ignoreReason) so its TypeScript type allows null (e.g. string | null)
and ensure the `@attr` declaration reflects that nullable state (so callers can
handle missing values and fixtures can omit the field).

In `@mirage/factories/sk-fake-app.ts`:
- Around line 108-113: The factory currently sets status: () => 0 (PENDING) but
unconditionally populates reviewed_by, reviewed_on, and ignore_reason, creating
impossible fixtures; change reviewed_by, reviewed_on, and ignore_reason to
return null when status() === 0 (or only populate them when status indicates a
reviewed/ignored state) and keep is_ignored and is_added_to_inventory consistent
with the PENDING status (i.e., is_ignored: () => false and
is_added_to_inventory: () => false remain fine for PENDING); update the
reviewed_* and ignore_reason generators to reference the status() value so
default fake-app state is coherent with status, is_ignored, and
is_added_to_inventory.

In `@mirage/models/sk-fake-app.ts`:
- Around line 3-4: The Mirage model export currently names the association
skInventoryApp which changes the serialized relationship key; rename that
association to skApp so it matches the real model's relationship (update the
exported Model.extend property from skInventoryApp to skApp while still using
belongsTo('sk-inventory-app')), ensuring Mirage fixtures hydrate the parent app
without remapping.

---

Outside diff comments:
In `@mirage/factories/sk-app.ts`:
- Around line 87-90: The withApprovedStatus trait currently only pins
approval_status and app_status but leaves monitoring_enabled,
store_monitoring_status, and fake_app_detection_status random, which makes
derived properties (fakeAppDetectionIsDisabled, fakeAppDetectionHasResults,
needsAction) unstable; update the mirage/factories/sk-app.ts trait
withApprovedStatus to explicitly set monitoring_enabled,
store_monitoring_status, and fake_app_detection_status to stable values (e.g.,
monitoring_enabled: false and deterministic store_monitoring_status and
fake_app_detection_status enums that represent a neutral/disabled state) so the
model-derived flags are consistent for the approved fixture.

---

Nitpick comments:
In `@mirage/factories/sk-fake-app.ts`:
- Around line 9-10: Change the two factory fields original_app_icon_url and
fake_app_icon_url to use the newer Faker API by calling faker.image.url()
instead of faker.image.imageUrl(); update both occurrences so they match the
existing usage for sk_store.icon and keep the factory consistent with Faker v8's
non-deprecated API.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b19804c0-1862-426c-97f9-d23c7bc04804

📥 Commits

Reviewing files that changed from the base of the PR and between f5f4a73 and 2589cae.

📒 Files selected for processing (13)
  • app/adapters/sk-fake-app-inventory.ts
  • app/adapters/sk-fake-app.ts
  • app/enums.ts
  • app/models/organization.ts
  • app/models/sk-app.ts
  • app/models/sk-fake-app-inventory.ts
  • app/models/sk-fake-app.ts
  • app/models/sk-inventory-app.ts
  • app/serializers/sk-fake-app-inventory.ts
  • app/serializers/sk-fake-app.ts
  • mirage/factories/sk-app.ts
  • mirage/factories/sk-fake-app.ts
  • mirage/models/sk-fake-app.ts
💤 Files with no reviewable changes (1)
  • app/models/sk-inventory-app.ts
✅ Files skipped from review due to trivial changes (1)
  • app/models/organization.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/serializers/sk-fake-app.ts

Comment thread app/adapters/sk-fake-app.ts
Comment thread app/models/sk-app.ts
Comment thread app/models/sk-app.ts
Comment thread app/models/sk-fake-app.ts Outdated
Comment thread mirage/factories/sk-fake-app.ts
Comment thread mirage/models/sk-fake-app.ts
@Yibaebi Yibaebi force-pushed the models-fake-app-sk branch from 736bcc2 to cb842e3 Compare April 7, 2026 08:29
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 7, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (3)
app/models/sk-app.ts (2)

263-273: ⚠️ Potential issue | 🟠 Major

Guard against null fakeAppCounts and division by zero.

totalFakeApps, brandAbuseFakeAppPercentage, and fakeAppsFakeAppPercentage will throw or return NaN if fakeAppCounts is undefined/null or if totalFakeApps equals 0.

Proposed fix
  get totalFakeApps() {
-   return this.fakeAppCounts.brand_abuse + this.fakeAppCounts.fake_app;
+   return (
+     (this.fakeAppCounts?.brand_abuse ?? 0) +
+     (this.fakeAppCounts?.fake_app ?? 0)
+   );
  }

  get brandAbuseFakeAppPercentage() {
-   return (this.fakeAppCounts.brand_abuse / this.totalFakeApps) * 100;
+   return this.totalFakeApps === 0
+     ? 0
+     : ((this.fakeAppCounts?.brand_abuse ?? 0) / this.totalFakeApps) * 100;
  }

  get fakeAppsFakeAppPercentage() {
-   return (this.fakeAppCounts.fake_app / this.totalFakeApps) * 100;
+   return this.totalFakeApps === 0
+     ? 0
+     : ((this.fakeAppCounts?.fake_app ?? 0) / this.totalFakeApps) * 100;
  }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/models/sk-app.ts` around lines 263 - 273, Guard against null/undefined
fakeAppCounts and division by zero in the getters: update totalFakeApps,
brandAbuseFakeAppPercentage, and fakeAppsFakeAppPercentage to first handle
this.fakeAppCounts being falsy (use optional chaining or a default object) and
ensure totalFakeApps returns 0 if counts are absent; in the percentage getters,
if totalFakeApps is 0 return 0 (or a defined fallback) instead of performing the
division. Refer to the getters totalFakeApps, brandAbuseFakeAppPercentage,
fakeAppsFakeAppPercentage and the fakeAppCounts property when making these
checks.

259-261: ⚠️ Potential issue | 🟠 Major

Breaking change: appIsInDisabledState getter is removed but still referenced by components.

Based on the relevant code snippets, app/components/storeknox/inventory/app-list/table/monitoring-status/index.ts references this.app?.appIsInDisabledState at multiple locations (lines 36, 46, 68, 90), and app/routes/authenticated/storeknox/inventory-details/unscanned-version.ts references it at line 20. Without a compatibility getter, disabled apps will not render correctly.

Proposed compatibility fix
  get appMonitoringIsInDisabledState() {
    return !this.monitoringEnabled;
  }
+
+ /** `@deprecated` Use appMonitoringIsInDisabledState instead */
+ get appIsInDisabledState() {
+   return this.appMonitoringIsInDisabledState;
+ }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/models/sk-app.ts` around lines 259 - 261, The code removed the legacy
getter appIsInDisabledState that other components still call; restore
compatibility by adding a new getter named appIsInDisabledState on the same
class that simply returns the same value as the existing
appMonitoringIsInDisabledState (or !this.monitoringEnabled) so callers like the
monitoring-status component and unscanned-version route continue to work without
changes.
app/adapters/sk-fake-app.ts (1)

69-83: ⚠️ Potential issue | 🟡 Minor

Add null guard for skAppId before building URLs.

belongsTo('skApp').id() returns null if the relationship hasn't been loaded, which would produce invalid URLs like /sk_app/null/sk_fake_app/.... This applies to both ignore() and ignoreAndAddToInventory() methods.

Proposed fix
  async ignore(
    skFakeApp: SkFakeAppModel,
    ignoreReason: string
  ): Promise<SkFakeAppModel> {
    const skAppId = skFakeApp.belongsTo('skApp').id();
+
+   if (!skAppId) {
+     throw new Error('Cannot ignore: skApp relationship is not loaded');
+   }
+
-   const url = this._buildNestedURL(skAppId, skFakeApp.id).concat('/ignore');
+   const url = this._buildNestedURL(skAppId, skFakeApp.id).concat('/ignore');
    // ... rest of method
  }

Apply the same pattern to ignoreAndAddToInventory().

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/adapters/sk-fake-app.ts` around lines 69 - 83, The ignore() (and
similarly ignoreAndAddToInventory()) method currently calls
skFakeApp.belongsTo('skApp').id() without guarding for null, which yields
invalid URLs if the relationship isn't loaded; update both methods to guard the
skAppId returned from belongsTo('skApp').id() before calling _buildNestedURL: if
skAppId is null/undefined, either throw a clear error (e.g., "Missing skApp
relationship on SkFakeAppModel") or resolve/load the relationship first and
obtain its id, then proceed to build the URL and make the AJAX call; reference
the belongsTo('skApp').id(), _buildNestedURL, ignore, and
ignoreAndAddToInventory symbols when applying the change.
🧹 Nitpick comments (5)
tests/acceptance/storeknox/inventory-details/store-version-tables-test.js (1)

121-121: Four test suites skipped without explanation.

This file has the most skipped tests in this PR. Consider adding a comment block at the module level explaining why these tests are temporarily disabled and what needs to happen to re-enable them.

Also applies to: 184-184, 627-627, 784-784

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/acceptance/storeknox/inventory-details/store-version-tables-test.js` at
line 121, Multiple test suites are skipped using test.skip.each; add a
module-level comment at the top of this test file that explains why these tests
are temporarily disabled, what specific condition or bug must be resolved to
re-enable them, and an expected timeline or owner for follow-up, then add a
brief inline comment next to each test.skip.each occurrence referencing that
module-level explanation (and any tracking ticket/issue ID) so readers know
where to find the rationale and re-enable criteria.
tests/acceptance/storeknox/inventory-details/malware-detected-test.js (1)

88-88: Tests skipped without explanation.

Same pattern as other test files. Document the reason and track re-enablement.

Also applies to: 210-210

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/acceptance/storeknox/inventory-details/malware-detected-test.js` at
line 88, The test block using test.skip.each is being skipped without
explanation; add a short comment directly above the test.skip.each that states
the reason for skipping, the expected condition for re-enablement, and a
tracking reference (issue/PR or ticket ID), and leave the skip in place until
that issue is resolved; also apply the same comment/issue reference for the
other skipped occurrence referenced (the one at the other occurrence). Locate
the skipped tests by the symbol test.skip.each and update them to include the
explanatory comment and link to the tracking issue so future reviewers know
when/how to re-enable them.
tests/acceptance/storeknox/inventory/app-list-test.js (1)

569-569: Tests skipped without explanation.

Same concern as other test files. Document the reason for skipping and track re-enablement.

Also applies to: 641-641

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/acceptance/storeknox/inventory/app-list-test.js` at line 569, The
skipped table-driven test uses test.skip.each but has no justification; update
each occurrence (the test.skip.each lines at the noted locations) to include a
clear explanation and tracking info by adding a short comment/TODO directly
above the skip stating why the test is skipped, who owns the follow-up, and a
ticket or PR link (or expected re-enable condition), or convert the skip to
test.todo if appropriate; ensure every skipped instance in this file has that
comment so reviewers can trace and re-enable later.
tests/acceptance/storeknox/inventory-details/brand-abuse-test.js (1)

89-89: Tests skipped without explanation.

Same concern as other test files in this PR. Consider documenting why these tests are disabled and tracking their re-enablement.

Also applies to: 211-211

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/acceptance/storeknox/inventory-details/brand-abuse-test.js` at line 89,
Tests are being skipped via test.skip.each with no explanation; add a short
comment immediately above each test.skip.each instance explaining why the test
is disabled, include a TODO that references a tracking ticket or issue ID (or
create one) and an expected re-enable condition, and if possible add a brief
note on how to reproduce the failure locally (e.g., environment or flaky
conditions); make the change for the occurrences around the test.skip.each at
the top and the second instance near line 211 so future reviewers know the
rationale and can track re-enablement.
tests/acceptance/storeknox/inventory-details/app-details-test.js (1)

492-492: Tests skipped without explanation or tracking.

Two parameterized test suites ("it toggles monitoring status" and "test: actions list section") are now skipped. Consider adding a TODO comment or linking to a tracking issue explaining why these tests are disabled and when they should be re-enabled. Skipped tests can easily become forgotten technical debt.

Also applies to: 1504-1504

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/acceptance/storeknox/inventory-details/app-details-test.js` at line
492, Two parameterized suites are being skipped with test.skip.each (the suites
titled "it toggles monitoring status" and "test: actions list section"); add a
brief TODO comment above each skipped test explaining why it's skipped and
reference a tracking ticket/issue ID and expected re-enable conditions (e.g.
"TODO: re-enable after FIX-1234 — root cause: ..."). Locate the skipped calls to
test.skip.each in the file (search for the literal test.skip.each and the suite
names) and insert the TODO comment and issue link directly above them so
reviewers and CI can trace the technical debt.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/models/sk-app.ts`:
- Around line 166-171: The template still references the old getter
monitoringPendingOrDisabled but the model now defines
storeMonitoringPendingOrDisabled; either update the template to use
`@skInventoryApp.storeMonitoringPendingOrDisabled`, or add a backward-compatible
alias getter monitoringPendingOrDisabled in the model (e.g., a new getter that
returns this.storeMonitoringPendingOrDisabled and optionally emits a deprecation
warning) so legacy templates continue to work.

---

Duplicate comments:
In `@app/adapters/sk-fake-app.ts`:
- Around line 69-83: The ignore() (and similarly ignoreAndAddToInventory())
method currently calls skFakeApp.belongsTo('skApp').id() without guarding for
null, which yields invalid URLs if the relationship isn't loaded; update both
methods to guard the skAppId returned from belongsTo('skApp').id() before
calling _buildNestedURL: if skAppId is null/undefined, either throw a clear
error (e.g., "Missing skApp relationship on SkFakeAppModel") or resolve/load the
relationship first and obtain its id, then proceed to build the URL and make the
AJAX call; reference the belongsTo('skApp').id(), _buildNestedURL, ignore, and
ignoreAndAddToInventory symbols when applying the change.

In `@app/models/sk-app.ts`:
- Around line 263-273: Guard against null/undefined fakeAppCounts and division
by zero in the getters: update totalFakeApps, brandAbuseFakeAppPercentage, and
fakeAppsFakeAppPercentage to first handle this.fakeAppCounts being falsy (use
optional chaining or a default object) and ensure totalFakeApps returns 0 if
counts are absent; in the percentage getters, if totalFakeApps is 0 return 0 (or
a defined fallback) instead of performing the division. Refer to the getters
totalFakeApps, brandAbuseFakeAppPercentage, fakeAppsFakeAppPercentage and the
fakeAppCounts property when making these checks.
- Around line 259-261: The code removed the legacy getter appIsInDisabledState
that other components still call; restore compatibility by adding a new getter
named appIsInDisabledState on the same class that simply returns the same value
as the existing appMonitoringIsInDisabledState (or !this.monitoringEnabled) so
callers like the monitoring-status component and unscanned-version route
continue to work without changes.

---

Nitpick comments:
In `@tests/acceptance/storeknox/inventory-details/app-details-test.js`:
- Line 492: Two parameterized suites are being skipped with test.skip.each (the
suites titled "it toggles monitoring status" and "test: actions list section");
add a brief TODO comment above each skipped test explaining why it's skipped and
reference a tracking ticket/issue ID and expected re-enable conditions (e.g.
"TODO: re-enable after FIX-1234 — root cause: ..."). Locate the skipped calls to
test.skip.each in the file (search for the literal test.skip.each and the suite
names) and insert the TODO comment and issue link directly above them so
reviewers and CI can trace the technical debt.

In `@tests/acceptance/storeknox/inventory-details/brand-abuse-test.js`:
- Line 89: Tests are being skipped via test.skip.each with no explanation; add a
short comment immediately above each test.skip.each instance explaining why the
test is disabled, include a TODO that references a tracking ticket or issue ID
(or create one) and an expected re-enable condition, and if possible add a brief
note on how to reproduce the failure locally (e.g., environment or flaky
conditions); make the change for the occurrences around the test.skip.each at
the top and the second instance near line 211 so future reviewers know the
rationale and can track re-enablement.

In `@tests/acceptance/storeknox/inventory-details/malware-detected-test.js`:
- Line 88: The test block using test.skip.each is being skipped without
explanation; add a short comment directly above the test.skip.each that states
the reason for skipping, the expected condition for re-enablement, and a
tracking reference (issue/PR or ticket ID), and leave the skip in place until
that issue is resolved; also apply the same comment/issue reference for the
other skipped occurrence referenced (the one at the other occurrence). Locate
the skipped tests by the symbol test.skip.each and update them to include the
explanatory comment and link to the tracking issue so future reviewers know
when/how to re-enable them.

In `@tests/acceptance/storeknox/inventory-details/store-version-tables-test.js`:
- Line 121: Multiple test suites are skipped using test.skip.each; add a
module-level comment at the top of this test file that explains why these tests
are temporarily disabled, what specific condition or bug must be resolved to
re-enable them, and an expected timeline or owner for follow-up, then add a
brief inline comment next to each test.skip.each occurrence referencing that
module-level explanation (and any tracking ticket/issue ID) so readers know
where to find the rationale and re-enable criteria.

In `@tests/acceptance/storeknox/inventory/app-list-test.js`:
- Line 569: The skipped table-driven test uses test.skip.each but has no
justification; update each occurrence (the test.skip.each lines at the noted
locations) to include a clear explanation and tracking info by adding a short
comment/TODO directly above the skip stating why the test is skipped, who owns
the follow-up, and a ticket or PR link (or expected re-enable condition), or
convert the skip to test.todo if appropriate; ensure every skipped instance in
this file has that comment so reviewers can trace and re-enable later.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2a3d2ca5-2ffc-42cf-b222-62026f151cca

📥 Commits

Reviewing files that changed from the base of the PR and between 2589cae and cb842e3.

📒 Files selected for processing (19)
  • app/adapters/sk-fake-app-inventory.ts
  • app/adapters/sk-fake-app.ts
  • app/enums.ts
  • app/models/organization.ts
  • app/models/sk-app.ts
  • app/models/sk-fake-app-inventory.ts
  • app/models/sk-fake-app.ts
  • app/models/sk-inventory-app.ts
  • app/serializers/sk-fake-app-inventory.ts
  • app/serializers/sk-fake-app.ts
  • mirage/factories/sk-app.ts
  • mirage/factories/sk-fake-app.ts
  • mirage/models/sk-fake-app.ts
  • tests/acceptance/storeknox/inventory-details/app-details-test.js
  • tests/acceptance/storeknox/inventory-details/brand-abuse-test.js
  • tests/acceptance/storeknox/inventory-details/malware-detected-test.js
  • tests/acceptance/storeknox/inventory-details/store-version-tables-test.js
  • tests/acceptance/storeknox/inventory-details/unscanned-versions-test.js
  • tests/acceptance/storeknox/inventory/app-list-test.js
💤 Files with no reviewable changes (1)
  • app/models/sk-inventory-app.ts
✅ Files skipped from review due to trivial changes (6)
  • app/models/organization.ts
  • tests/acceptance/storeknox/inventory-details/unscanned-versions-test.js
  • mirage/models/sk-fake-app.ts
  • app/models/sk-fake-app-inventory.ts
  • app/enums.ts
  • app/adapters/sk-fake-app-inventory.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • app/serializers/sk-fake-app-inventory.ts
  • app/serializers/sk-fake-app.ts
  • mirage/factories/sk-fake-app.ts
  • mirage/factories/sk-app.ts

Comment thread app/models/sk-app.ts
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.

2 participants