Lookback API: Why changes to workitems do not update results of my query?

Document ID : KB000057534
Last Modified Date : 14/02/2018
Show Technical Document Details

Issue

A user is working with AppSDK2 code where SnapshotStore is created to access historic data from Lookback API. See Lookback API manual here.
The find object of the store includes "__At": "current"
?

Resolution

There is an example of a find object in Lookback API query in the manual that shows a usage of "__At": "current" .
"__At": "current" limits the query results to current snapshots of matching artifacts.

Whenever an AppSDK2 code does not return expected results please try to hit Lookback API endpoints directly in the browser to see if you get the same results. This removes the custom code as a factor.
It is also often useful to test your queries by hitting the endpoints directly before writing a single line of your code.
(Note: Custom coding and debugging of custom code is outside of Support's scope).

In this example a direct endpoint equivalent to the user's query in the code:

Ext.create('Rally.data.lookback.SnapshotStore', {
???? autoLoad: true,
???? hydrate: ['Project', 'Release', 'ScheduleState'],
???? find: {
??????? '_TypeHierarchy': 'HierarchicalRequirement',
??????? '__At': 'current',
??????? 'Children': null,
??????? '_ProjectHierarchy': myProjectOID,
??????? 'Release': {"$in": arrayOfOIDsOfMyReleases}
??? },
??? fetch: ['FormattedID','Name','ScheduleState', 'PlanEstimate','Release'],
});


looks like this:

https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/12352608129/artifact/snapshot/query.js?&fields=["FormattedID","Name","ScheduleState","PlanEstimate","Release"]&hydrate=["Release", "ScheduleState"]&find={"_TypeHierarchy":"HierarchicalRequirement","_ProjectHierarchy":12352608219,"Children":null,"Release":{"$in":[19388416256,19388416258,19388416262]},"__At": "current"}

In case you want to follow along, make sure to replace (a) workspace ObjectID 12352608129 with the valid workspace ObjectID in your subscription (b) array of ObjectIDs in the "Release":{"$in":[19388416256,19388416258,19388416262]with valid ObjectIDs of your releases before pasting the URL in your browser's address bar.

In this example the query returns result fragment of which is shown in screenshots below:

User-added image

The TotalResult count is 4.
If we make a change to one of the artifacts whose snapshots are included in the result, for example, if we change the ScheduleState of user story US24267?shown in the screenshot above and reload the browser page where we hit this endpoint directly we will still see 4 snapshots, but the snapshot for story US24267 now shows ScheduleState of Completed.

User-added image

In the next step we remove "__At": "current" from the find object. The modified endpoint looks like this:

https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/12352608129/artifact/snapshot/query.js?&fields=["FormattedID","Name","ScheduleState","PlanEstimate","Release"]&hydrate=["Release", "ScheduleState"]&find={"_TypeHierarchy":"HierarchicalRequirement","_ProjectHierarchy":12352608219,"Children":null,"Release":{"$in":[19388416256,19388416258,19388416262]}}

This time the TotalResultCount is 23. It is expected that there has been many more snapshots of the stories that match the query criteria than the current snapshots allowed in by "__At": "current".
Here is a fragment of the results:

User-added image

Next, we change ScheduleState of a story US1578 shown in the screenshot above. We want to see if the TotalResultCount changes to 24. We reload the browser page where we hit this endpoint directly and see that the number of snapshots has been incremented to 24, and includes a new snapshot where story US1578 was moved from Completed to Accepted:

User-added image
....

User-added image


?