FLUID-5246: Grade linkage system is not activated unless there are already dynamic grades on a component

Metadata

Source
FLUID-5246
Type
Bug
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Antranig Basman
Reporter
Antranig Basman
Created
2014-01-09T13:19:20.752-0500
Updated
2014-03-03T11:24:07.485-0500
Versions
N/A
Fixed Versions
  1. 1.5
Component
  1. IoC System

Description

The "grade linkage system" aka "new demands blocks" for FLUID-5212 was found to have a flaw when working with the resolver system implemented in the GPII's LifecycleManager. This implementation was extremely old and even predated FLUID-4392 demands blocks. In fact, the comment above it used to read

// TODO: Use this silly system until demands blocks are fixed via FLUID-4392
// The idea is that users will derive grades from this one which add in
// further resolvers, and then issue a single demands block which replaces
// this class with their own impl. Still doesn't easily allow for multi-dim.
// extension

Since the pull request against the Windows repository required to enable this was never actually yet merged (c. 7 months) it seemed reasonable to modernise this system since demands blocks have been removed from the remainder of the GPII anyway. This is a case where the new "grade linkage system" indeed seems to solve the problem straightforwardly, but unfortunately our current implementation has a bug.

We would like to write, in LifecycleManager.js:

fluid.defaults("gpii.lifecycleManager.standardResolverConfig", {
gradeNames: ["fluid.littleComponent", "fluid.applyGradeLinkage", "autoInit"],
resolvers: {
environment: "gpii.lifecycleManager.environmentResolver"
}
});

and then in Windows registeryResolver/index.js

fluid.defaults("gpii.lifecycleManager.registryResolverConfig", {
gradeNames: ["fluid.littleComponent", "autoInit"],
resolvers: {
registry: "gpii.lifecycleManager.registryResolver"
}
});

fluid.defaults("gpii.lifecycleManager.resolverConfigWithRegistry", {
gradeNames: ["autoInit", "fluid.gradeLinkageRecord"],
contextGrades: ["gpii.lifecycleManager.standardResolverConfig"],
resultGrades: ["gpii.lifecycleManager.registryResolverConfig"]
});

Unfortunately since the relevant FluidIoC.js code looks like this (fluid.computeDynamicGrades):

var resolved = fluid.expandDynamicGrades(that, dynamicGrades);
if (resolved.length !== 0) {
do { // repeatedly collect dynamic grades whilst they arrive (FLUID-5155)
var furtherResolved = fluid.collectDynamicGrades(that, shadow, defaultsBlock, gradeNames, dynamicGrades, resolved);
}
while (furtherResolved.length !== 0);
}

we fail to even kick off the linkage process held within fluid.collectDynamicGrades unless we already find at least one dynamic grade to start with.

Comments

  • Antranig Basman commented 2014-01-09T17:45:42.138-0500

    Merged into trunk at revision 2c9d4c1