Skip to content

N°10151 - Missing extension.xml in extension disturb setup - #1067

Merged
odain-cbd merged 6 commits into
developfrom
issue/10151-mtp
Oct 12, 2026
Merged

odain-cbd merged 6 commits into
developfrom
issue/10151-mtp

Conversation

@odain-cbd

Copy link
Copy Markdown
Contributor

No description provided.

@odain-cbd odain-cbd self-assigned this Oct 6, 2026
Copilot AI balanced review requested due to automatic review settings October 6, 2026 06:07
@CombodoApplicationsAccount CombodoApplicationsAccount added the internal Work made by Combodo label Oct 6, 2026
@odain-cbd odain-cbd closed this Oct 6, 2026

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.

Copilot review overview

🟢 Approval recommended

The implementation and regression coverage are sound, with only a minor PHPDoc correction noted.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Enables setup to discover extensions without extension.xml by scanning module definitions.

Changes:

  • Reuses recursive extension-map scanning for directory discovery.
  • Handles missing optional documentation URLs.
  • Adds coverage for XML and module-only extensions.
File Description
setup/​extensionsmap.class.inc.php Adds scan-free maps and module-based discovery.
tests/​php-unit-tests/​unitary-tests/​setup/​ExtensionsMapTest.php Tests XML and XML-less extension layouts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

}
}
$oiTopExtensionsMap = new iTopExtensionsMap(bNoScan: true);
$oiTopExtensionsMap->ReadDir($sSearchDir, iTopExtension::SOURCE_REMOTE, bIsRootDir: true);
@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 0/5

[Medium impact] Adjusts extension scanning logic during setup.

The PR should not merge until the landing step preserves current modules and installed records, and extension discovery keeps the parent ID.

Findings

  1. P1 Current remote modules disappear ▶
  2. P1 Missing extensions go unnoticed ▶
  3. P1 Nested modules lose their parent ▶
  4. P1 Extension subdirectories can be skipped ▶
  5. P1 Nested XML can abort deployment ▶
  6. P1 Hidden modules become compilation choices ▶

Summary

The PR lets extension discovery recognize modules without extension.xml and changes which environment the audit landing step reads.

  • Directory listings now include extensions built from module files.
  • Upgrade setup reads the saved config and scans the build environment.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Keep current choices"] --> B["Landing step"]
  B --> C["Parent loads installed records"]
  C --> D["Replace map with build-directory scan"]
  D --> E["Build-only choices without installed records"]
  E --> F["Save selected modules"]
  F --> G["Audit copies files and compiles"]
Loading

Reviews (3) · Last reviewed commit: "N°10151 - fix broken extension with furt..." · Reviewed by Greptile

}
}
$oiTopExtensionsMap = new iTopExtensionsMap(bNoScan: true);
$oiTopExtensionsMap->ReadDir($sSearchDir, iTopExtension::SOURCE_REMOTE, bIsRootDir: true);

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.

P1 Extension subdirectories can be skipped If a -modules directory contains a module.*.php file alongside extension subdirectories, ReadDir returns after reading the module and never visits those subdirectories. The previous scan still read their extension.xml files. Their codes can therefore be missing when hub deployment determines which extensions to add, causing a selected extension to be omitted.

}
}
$oiTopExtensionsMap = new iTopExtensionsMap(bNoScan: true);
$oiTopExtensionsMap->ReadDir($sSearchDir, iTopExtension::SOURCE_REMOTE, bIsRootDir: true);

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.

P1 Nested XML can abort deployment If a deeper directory contains a malformed extension.xml, the new recursive scan opens it and XMLParameters throws. Hub deployment does not handle that exception, so compilation aborts even though the previous immediate-child scan would not have read the file.

@odain-cbd odain-cbd reopened this Oct 6, 2026
Comment on lines +412 to +414
foreach ($oiTopExtensionsMap->aExtensionsByCode as $sCode => $oExtension) {
/** @var iTopExtension $oExtension */
$aRes[$sCode] = $oExtension->sLabel;

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.

P1 Hidden modules become compilation choices When a module-only directory contains a module marked visible => false or auto_select, ReadDir adds it to the map but this loop returns its code without checking visibility. Hub compilation then treats that code as an added extension, despite the module being marked as one that should not be offered for selection.

@Hipska

Hipska commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

What is an extension disturb setup?

@odain-cbd odain-cbd closed this Oct 8, 2026
@odain-cbd odain-cbd reopened this Oct 12, 2026
@Hipska

Hipska commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

@odain-cbd what is disturb setup?

iTop upgrade via designer failed with badly packaged extensions. there are further usecases covered and documented in current PR new test.

// should be done at the end
parent::__construct($oWizard, $sCurrentState, false);

$this->oExtensionsMap = iTopExtensionsMap::GetExtensionsMap($this->oRuntimeEnv->GetBuildEnv());

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.

P1 Current remote modules disappear

When a user clicks “Keep current choices,” the build directory has not been prepared yet. This line scans data/production-build-modules rather than data/production-modules. If the build directory is absent, remote extensions disappear from the choices, and selected_modules is overwritten without their modules before the audit starts. The later file copy cannot restore that selection. Use the final environment for this shortcut, or prepare the build files before scanning them.

// should be done at the end
parent::__construct($oWizard, $sCurrentState, false);

$this->oExtensionsMap = iTopExtensionsMap::GetExtensionsMap($this->oRuntimeEnv->GetBuildEnv());

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.

P1 Missing extensions go unnoticed

Replacing oExtensionsMap after the parent constructor drops the installed-extension records that LoadChoicesFromDatabase just loaded. Even when the build files exist, the replacement map has no record of installed extensions missing from disk. “Keep current choices” therefore skips the missing-extension check instead of returning the user to the choices screen. Load the database choices into the replacement map before using it.


// First check if there is an extension.xml file in this directory
if (is_readable($sSearchDir.'/extension.xml')) {
if ($sParentExtensionId === null && is_readable($sSearchDir.'/extension.xml')) {

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.

P1 Nested modules lose their parent

Ignoring a child extension.xml leaves that call’s sExtensionId as null. If the child contains its modules in subdirectories, line 387 passes that null to them. They become standalone extensions instead of joining the outer extension. The outer extension can then have no modules, which makes setup throw “does not have any module associated.” Preserve the inherited parent ID when recursing through an ignored child definition.

@greptile-apps

greptile-apps Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@eespie
eespie self-requested a review October 12, 2026 08:45
@odain-cbd
odain-cbd merged commit 62d7ca4 into develop Oct 12, 2026
@odain-cbd
odain-cbd deleted the issue/10151-mtp branch October 12, 2026 13:40
odain-cbd added a commit that referenced this pull request Oct 12, 2026
* N°10151 - Missing extension.xml in extension disturb setup

* N°10151 - Missing extension.xml in extension disturb setup

* N°10151 - add weird usecase with multi xml files in same extension

* N°10151 - fix module not installed after MTP

* N°10151 - fix broken extension with further extension.xml

* N°10151 - code style
@Hipska

Hipska commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

@odain-cbd why do you ignore me like this? This is disturbing..

Edit: wait, are we now communicating by editing other people's comments? This is even more disturbing..

I still don't understand what you mean with "extension disturb setup" in your title?

@Molkobain

Molkobain commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

@odain-cbd why do you ignore me like this? This is disturbing..

Edit: wait, are we now communicating by editing other people's comments? This is even more disturbing..

I still don't understand what you mean with "extension disturb setup" in your title?

I think/hope this is a mistake from @odain-cbd as his edit looks like a reply to your question. I'll talk about it with him this afternoon (he's off this morning)

@odain-cbd

Copy link
Copy Markdown
Contributor Author

@odain-cbd why do you ignore me like this? This is disturbing..

Edit: wait, are we now communicating by editing other people's comments? This is even more disturbing..

I still don't understand what you mean with "extension disturb setup" in your title?

first i don't ignore you. editing your question was a mistake through github app. because indeed i was trying to answer... sorry for that.

my answer was:
iTop upgrade via designer failed with badly packaged extensions. there are further usecases covered and documented in current PR new test.

Molkobain pushed a commit that referenced this pull request Oct 19, 2026
* N°10151 - Missing extension.xml in extension disturb setup

* N°10151 - Missing extension.xml in extension disturb setup

* N°10151 - add weird usecase with multi xml files in same extension

* N°10151 - fix module not installed after MTP

* N°10151 - fix broken extension with further extension.xml

* N°10151 - code style
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.

6 participants