Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge latest Guardian changes as of 18-04-2024 #270

Merged
merged 37 commits into from
Apr 18, 2024

Conversation

Conalb97
Copy link

What does this change?

This change pulls in the latest Guardian changes into the BBC's version of the Grid, so as to bring it up to date and to pull in our changes that have been approved by the Guardian.

How should a reviewer test this change?

The changes in this PR have already been tested and approved by the Guardian. A quick sense check on the commits that this PR brings in would be good.

Tested? Documented?

  • sense checked by reviewer

andrew-nowak and others added 30 commits March 1, 2024 19:09
...and fix byline I broke in previous commit, yeah, I dont know how to pretend I haven't
…this UGLY repetition of js bits will need to be removed
…I don’t like the hardcoding of 'label', but elementName is missing (bug?)
…yet another repetition, will remove once I know how
… to support a send to capture syndication.

Still need to make changes to the syndication endpoint itself and test via postman
Added syndicated parameter to syndication metadata in the SyndicationUsageRequest.

Builders in UsageGroup and UsageIdBuilder were amended to include new syndicatedBy parameter
Currently, the usage status update successfully updates dynamoDB but not ElasticSearch.

In order for ElasticSearch to be updated, the correct message, containing an updated UsageNotice must be published to Thrall, via kinesis. Thrall will then process this message and run a script that will update ElasticSearch.

The 'plumbing' for flow has been added, all that is left is to implement the functionality to update ElasticSearch
Further additions to the ElasticSearch file, specifically the UpdateSingleUsageMessage function.

Attempted to pass usageId and usageParameters in as two tuples as 'prepareUpdateRequest' suggests that the 'params' input can have variable arguments, but was getting a syntax error. Instead choosing to just pass in usageParameters and accessing the usageId from there (if this works can remove usageId from previous functions).

Some modification to the script still required I think, tested with current changes and usage status is still not updating.
It seems like the painless script is very particular with how it is written, but currently this works without an error.

The script is not complete though as the parameters are being sent as Options, which painless doesn't know how to handle, so it doesn't work as expected
Params are still being sent through as Options, some difficulty in fixing this.

Seems that root cause is that the play framework doesn't know how to serialise/deserialise a 'UsageNotice' as Read/Write implicits have not been defined for it. There are a few potential options to fix this.

1. Add the required implicits to UsageNotice (perhaps not desirable as would be repeated code from Usages class)
2. Refactor ThrallMessageSender to make use of Usage (or potentially MediaUsage so that we use a class it knows how to handle)
3. Copy the pattern used for the 'updateUsage' existing method, clearly can handle params properly there as they are used in that function
4. Least desirable, get the update working for the status only case which involves just two parameters, which can be unwrapped from options fairly easily, but wouldn't be applicable for generic case
Completed the work that allows for an individual usage status to be updated. The issue with Options being passed into the painless script turned out to not be the source of my problems, I was actually accessing the parameters incorrectly, with this resolved the script worked without any issues.

Also cleaned up the code changes, renaming functions and parameters, so they are accurate and removing various print statements added for debugging.
Added 'lastModified' update to the update usage status painless script
Use of 'queryByUsage' meant that a Future[Status] was returned by this endpoint instead of the 'Result' type, required 'Authentication.request'. A placeholder return status was originally included so that this wouldn't block development, but once the desired functionality was achieved a permanent solution was desired.

This solution was to make the endpoint explicitly asynchronous, by using 'async.auth', by default this corrected the success case and the failure case was solved by wrapping the output in a Future[]
…aptureSyndication

Conal/imagedam 1593 send to capture syndication
The `push-pr` workflow (added in guardian#4240) hasn't been triggering CI as it was created to do, this should fix it...
@AndyKilmory
Copy link

looks fine to me

@Conalb97 Conalb97 merged commit 28c36e9 into main Apr 18, 2024
1 check passed
@Conalb97 Conalb97 deleted the conal/merge_guardian_changes-180424 branch April 18, 2024 13:22
@Conalb97 Conalb97 restored the conal/merge_guardian_changes-180424 branch April 18, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants