Skip to content

N°9118 - No Safeguard when hub installation fail - #988

Merged
Lenaick merged 2 commits into
developfrom
feature/9118-no-safeguard-when-hub-installation-fail
Aug 4, 2026
Merged

N°9118 - No Safeguard when hub installation fail#988
Lenaick merged 2 commits into
developfrom
feature/9118-no-safeguard-when-hub-installation-fail

Conversation

@Lenaick

@Lenaick Lenaick commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

N°9118 - No Safeguard when hub installation fail

Copilot AI review requested due to automatic review settings July 30, 2026 13:08
@CombodoApplicationsAccount CombodoApplicationsAccount added the internal Work made by Combodo label Jul 30, 2026
Comment thread datamodels/2.x/itop-hub-connector/src/Controller/HubController.php Outdated
@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR strengthens Hub extension installation safeguards.

  • Detects newly downloaded extensions and includes them when compiling the temporary environment.
  • Handles missing extension directories without passing false into array_diff.
  • Adds optional extension directories to extension-map discovery.
  • Extends CompileFrom and its test double to accept additional extension codes.

Confidence Score: 4/5

The PR is not yet safe to merge because label collisions can still silently exclude a requested extension from compilation.

GetExtensionsFromDir maps extension codes to labels, but HubController applies array_diff to the label values and only afterward extracts the surviving keys; consequently, a new extension whose label matches an installed extension never reaches the added-extension list consumed by CompileFrom. The absent-directory failure is fixed because both scan results are normalized to arrays.

Files Needing Attention: datamodels/2.x/itop-hub-connector/src/Controller/HubController.php

Important Files Changed

Filename Overview
datamodels/2.x/itop-hub-connector/src/Controller/HubController.php Adds extension-difference detection and passes added extension codes into compilation, but the previously reported label-based comparison remains outstanding.
setup/extensionsmap.class.inc.php Supports scanning optional extension directories while preserving the existing per-environment extension-map cache.
setup/runtimeenv.class.inc.php Extends CompileFrom to merge explicitly added extension codes into the configured extension choices.
datamodels/2.x/itop-hub-connector/land.php Includes downloaded-extension directories when constructing the extension inventory used by status and installation pages.
tests/php-unit-tests/src/Service/UnitTestRunTimeEnvironment.php Keeps the runtime-environment test double signature compatible with the new CompileFrom parameter.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Move selected downloads] --> B[Scan final modules]
  A --> C[Scan build modules]
  B --> D[Determine added extension codes]
  C --> D
  D --> E[Compile temporary environment]
  E --> F[Validate dependencies]
  F --> G[Install and commit]
Loading

Reviews (3): Last reviewed commit: "Apply suggestion from @greptile-apps[bot..." | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds safeguards so Hub-downloaded extensions are discovered and included during runtime compilation.

Changes:

  • Supports additional extension directories and compile choices.
  • Detects newly downloaded Hub extensions.
  • Loads the backup error-reporting implementation explicitly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
setup/extensionsmap.class.inc.php Scans additional extension directories.
setup/runtimeenv.class.inc.php Accepts added extensions during compilation.
HubController.php Detects and compiles newly downloaded extensions.
land.php Includes downloaded extensions in Hub displays.
UnitTestRunTimeEnvironment.php Aligns the test runtime API.
Comments suppressed due to low confidence (1)

datamodels/2.x/itop-hub-connector/src/Controller/HubController.php:135

  • GetExtensionsFromDir() returns code => label or false, but array_diff() compares the labels and requires arrays. A missing previous modules directory therefore causes a TypeError during the first remote installation, and two different extension codes sharing a label are treated as the same extension. Compare keys and normalize the documented false result.
		$aAddedExtensions = array_diff($aCurrentRemoteExtensions, $aPreviousRemoteExtensions);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread datamodels/2.x/itop-hub-connector/src/Controller/HubController.php Outdated
Comment thread setup/extensionsmap.class.inc.php
Comment thread tests/php-unit-tests/src/Service/UnitTestRunTimeEnvironment.php
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Comment thread datamodels/2.x/itop-hub-connector/src/Controller/HubController.php
@Lenaick Lenaick closed this Jul 30, 2026
@Lenaick Lenaick reopened this Jul 30, 2026
@Lenaick
Lenaick merged commit 9bfe043 into develop Aug 4, 2026
1 of 2 checks passed
@Lenaick
Lenaick deleted the feature/9118-no-safeguard-when-hub-installation-fail branch August 4, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Work made by Combodo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants