Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

(FAF149) Module dependency computation enhancement#700

Open
odain-cbd wants to merge7 commits intosupport/3.2
base:support/3.2
Choose a base branch
Loading
fromfaf/moduledependency-enhancement

Conversation

odain-cbd
Copy link
Contributor

@odain-cbdodain-cbd commentedFeb 25, 2025
edited
Loading

This PR brings few optimizations in dependency computation. It also enhances iTop feedback when there are module dependency issues: modules with less missing dependencies are printed first.

Usually modules dependencie issues are due to one missing module. it is hard to find it out when unresolved cascading dependencies are displayed in a "random" order.

Example (BEFORE)

Error: The following modules have unmet dependencies:Combodo XXX(id: combodo-xxx/1.0.5) depends on: ❌ combodo-www/1.0.0 + ❌  itop-yyy/1.0.8+✅ combodo-zzz/1.0.0,iTop XXX(id: itop-yyy/1.0.8) depends on: ❌ itop-xxx/0.0.1+ ✅ itop-zzz/1.0.1,...

Example (with PR enhancement): Now iTop XXX will come first.

iTop XXX(id: itop-yyy/1.0.8) depends on: ❌ itop-xxx/0.0.1+ ✅ itop-zzz/1.0.1,Combodo XXX(id: combodo-xxx/1.0.5) depends on: ❌ combodo-www/1.0.0 + ❌  itop-yyy/1.0.8+✅ combodo-zzz/1.0.0,...

jbostoen reacted with thumbs up emojipiRGoif reacted with rocket emoji
@odain-cbdodain-cbd added enhancementNew feature or request core SetupRelated to the setup process (install / upgrade) labelsFeb 25, 2025
@odain-cbdodain-cbd self-assigned thisFeb 25, 2025
@CombodoApplicationsAccountCombodoApplicationsAccount added the internalWork made by Combodo labelFeb 25, 2025
@odain-cbdodain-cbd changed the titleModule dependency computation enhancement(FAF149) Module dependency computation enhancementFeb 25, 2025
@odain-cbdodain-cbd requested a review fromdflavenMarch 6, 2025 15:34
Copy link
Member

@eespieeespie left a comment

Choose a reason for hiding this comment

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

seems ok for me

Copy link
Contributor

@rquetiezrquetiez left a comment

Choose a reason for hiding this comment

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

As this method is hard to test manually, changing it means covering it completely. I have added a few suggestions, but it will require an additional review (interactive) to make sure 100% of the rules are covered.


\ModuleDiscovery::SortModulesByCountOfDepencenciesDescending($aOngoingDependencies);

$this->assertEquals($aExpectedKeys, array_keys($aOngoingDependencies));
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather have $aOngoingDependencies and $aExpectedKeys shown explicitely as PHP arrays, thus documenting the input and output of the tested method. We could even inline intermediate variables like this:

$this->assertEquals(    [3,2,1],array_keys(\ModuleDiscovery::SortModulesByCountOfDepencenciesDescending(        [1 => [2],2 => [3],3 => [],        ]    )););

Moreover, I wonder if this is meaningful to test this internal method. This could be the case to explore corner cases. If so, then other cases should be added. Otherwise, the tests implemented after that one should be sufficient to cover this method, and the test ofSortModulesByCountOfDepencenciesDescending should be removed.

$this->assertEquals($aExpectedKeys, array_keys($aOngoingDependencies));
}

public function testOrderModulesByDependencies_CheckMissingDependenciesAreCorrectlyOrderedInTheException()
Copy link
Contributor

Choose a reason for hiding this comment

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

Function naming: "correctly" could be clarified. Alternatively, this could be clarified in the assertion message.

$this->expectExceptionMessage($sExpectedMessage, 'Modules with fewest count of missing dependencies should reported first');

{
$aModule = $aModules[$sId];
$aDepsWithIcons = [];
$aDeps=$aDependencies[$sId];
Copy link
Contributor

Choose a reason for hiding this comment

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

Coding convention

\ModuleDiscovery::OrderModulesByDependencies($aModules, true);
}

public function testOrderModulesByDependencies_ResolveOk()
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverage for successful cases could be completed by added the following [corner] cases:

  1. No dependency at all
  2. Several dependencies on a given module

];
$this->assertEquals($aExpected, array_keys($aResult));
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverage for failing cases could be improved by testing:

  1. Circular reference
  2. bAbortOnMissingDep = false. What is the expected behavior then?

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

@rquetiezrquetiezrquetiez requested changes

@eespieeespieeespie approved these changes

@dflavendflavenAwaiting requested review from dflaven

Assignees

@odain-cbdodain-cbd

Labels
coreenhancementNew feature or requestinternalWork made by CombodoSetupRelated to the setup process (install / upgrade)
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@odain-cbd@eespie@rquetiez@CombodoApplicationsAccount

[8]ページ先頭

©2009-2025 Movatter.jp