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

♻️ Refactor SSW Rules Widget #1438

Closed
7 of 10 tasks
JackDevAU opened this issue Sep 4, 2024 · 11 comments
Closed
7 of 10 tasks

♻️ Refactor SSW Rules Widget #1438

JackDevAU opened this issue Sep 4, 2024 · 11 comments
Assignees
Labels
Type: Refactor A code quality improvement e.g. Tech debt

Comments

@JackDevAU
Copy link
Member

JackDevAU commented Sep 4, 2024

Cc: @bradystroud @babakamyljanovssw @adamcogan

Hi Team,

Pain

Our current SSW Rules Widget relies on Azure Functions and a CosmosDB table, which adds unnecessary complexity and maintenance overhead to our system. The current issues we are facing is due to the builds and Azure Functions being out of sync and not storing all the data required.

What code could be improved?

  • The SSW Rules Widget codebase, specifically the parts that interact with Azure Functions to fetch rules.
  • A Single consistent retrieval method(s) that return the latest Rules information. Function is used and exported from the widget and used inside Rules + Widget.

Acceptance Criteria

  • Add new fields title, uri, isArchived to history.json
  • Refactor to use the history.json api instead of the Azure Functions
  • Remove all Azure Functions previously used for fetching rules
  • Remove the unnecessary table from CosmosDB
  • Ensure all existing functionality is maintained
  • Update documentation to reflect new architecture
  • Performance benchmarks show no degradation
  • Implement GitHub API integration to fetch GitHub user information
  • All tests pass, including new tests for GitHub API integration
  • Implement caching mechanism to optimise GitHub API calls (optional - might not be needed)

More Information

  • We'll need GitHub API credentials or tokens for authentication
  • Consider implementing a fallback mechanism in case of GitHub API unavailability
  • Ensure rate limiting considerations are accounted for in the new implementation

Screenshots

Image
Figure: Current Widget Architecture Flow

Image
Figure: Planned Widget Architecture Flow

Thanks!

@babakamyljanovssw
Copy link
Member

Update

PRs drafted to add new fields to history.json

SSWConsulting/SSW.Rules.Functions#59
#1440

@babakamyljanovssw
Copy link
Member

Update:

Drafted PR on SSW.Rules.Widget repo to refactor so it uses history.json and commits.json

SSWConsulting/SSW.Rules.Widget#55

@babakamyljanovssw
Copy link
Member

Update:

PRs to update widget version for SSW.Rules and SSW.People projects

@babakamyljanovssw
Copy link
Member

cc: @bradystroud @JackDevAU

Update:

We are going to wait for 1 week and then proceed with removing unnecessary tables from CosmosDB

@babakamyljanovssw
Copy link
Member

Update:

Drafted PR to remove unused Azure Functions for widget and entity context

SSWConsulting/SSW.Rules.Functions#83

@babakamyljanovssw
Copy link
Member

Update:

The UpdateLatestRules functions wasn't being used after last time I checked which is good and can be removed safely, but the GetLatestRules function was called a few times.

image
Figure: A few calls made to function after last check

Not sure where it is being called from, this function was being used in widget, but we have updated widget to new version to use history.json.

I checked the request logs for this function before widget upgrade and after widget upgrade for the 7 day period:

  • 1400 logs are returned before widget upgrade
  • 7 logs are returned after widget upgrade

Currently investigating where these calls are made from

@babakamyljanovssw
Copy link
Member

Update

I couldn't find from where the GetLatestRules are being called yet. The calls are not frequent as it is used to be after recent changes to widget's data source. Currently I'm working on #1448 as top priority.

This work still in progress

@babakamyljanovssw
Copy link
Member

✅ GetLatestRules and UpdateLatestRules functions were removed

@babakamyljanovssw
Copy link
Member

babakamyljanovssw commented Oct 14, 2024

Implement GitHub API integration to fetch GitHub user information

All tests pass, including new tests for GitHub API integration

Implement caching mechanism to optimize GitHub API calls (optional - might not be needed)

All above tasks are not required, as we don't need to call GitHub API to get user info because commits.json already has user information and widget is using it to get latest rules updated by specified user.
For more info look at this PR - SSWConsulting/SSW.Rules.Widget#55

@babakamyljanovssw
Copy link
Member

✅ Done - removed LatestRules container from cosmos db

Image
Figure: current cosmos db containers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Refactor A code quality improvement e.g. Tech debt
Projects
None yet
Development

No branches or pull requests

2 participants