In CDAP 5.0 we added support to add metadata to custom entities (non-cdap entities) this allows user to add metadata to any cdap entity too (before CDAP 5.0 it was limited to few CDAP entities). For example now a user can add metadata to ProgramRunId too.
Before CDAP 5.0 RunIds did not have any metadata associated with them directly although we did supported getMetadata call on RunIds which used to aggregate all the metadata of entities associated with that run (dataset, application etc) and return all of them.
In CDAP 5.0 and later we will have to support this aggregation behavior but an open product question is whether user should be able to add metadata directly to a run or not. If they can then ideally the retrieve call should return aggregate metadata for all the entities associated with the run including the metadata directly associated with the run itself.
Deprecated the aggregation of metadata annotated with all the entities (application, programs, dataset, streams) associated in a run. From this release onwards metadata for program runs behaves like any other entity where a metadata can be directly annotated to it and retrieved from it. For backward compatibility, to achieve the new behavior an additional query parameter 'runAggregation' should be set to false while making the REST call to retrieve metadata of program runs.
Discussing the changes which will be required to resolve this as of now.
After discussion with and and also looking through the our existing code base we did not find any usage of metadata for runId where the aggregation of involved entities is serving a use case.
Discussed with and that we will deprecate this behavior in 5.0 and remove it in coming releases. From 5.0 RunId for metadata will behave like any other entity.
For detailed context of the issue and the changes please see description here: