Skip to content

Conversation

@kurtaking
Copy link
Member

@kurtaking kurtaking commented Apr 13, 2025

Hey, I just made a Pull Request!

Previously, the Tech Insights plugin only supported a fixed set of services in the FactRetrieverContext. This change enables plugin consumers to pass additional custom services into their FactRetriever implementations without modifying the core plugin code, improving extensibility while preserving the plugin's API contract.

  • update FactRetrieverContext to accept a generic extension type
  • make FactRetriever interface generic to work with extended context types
  • update FactRetrieverRegistration and FactRetrieverRegistry to support generic typing

Example

type MyCustomFactRetrieverContext = FactRetrieverContext<{
  customService: MyCustomService;
}>;

handler: async ({ discovery, entityFilter, auth, ..., customService }: MyCustomFactRetrieverContext) => {
   ....

   const somethingCustom = customService.doSomething()
   ...   
}

Alternative

We wrap the creation of the FactRetriever with a factory function that takes our internal serviceRefs.

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

Signed-off-by: Kurt King <[email protected]>
@kurtaking kurtaking marked this pull request as ready for review April 13, 2025 07:47
@kurtaking kurtaking requested review from a team, Xantier and punkle as code owners April 13, 2025 07:47
@kurtaking kurtaking requested a review from vinzscam April 13, 2025 07:47
@kurtaking kurtaking self-assigned this Apr 13, 2025
@backstage-goalie
Copy link
Contributor

backstage-goalie bot commented Apr 13, 2025

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage-community/plugin-tech-insights-node workspaces/tech-insights/plugins/tech-insights-node minor v2.3.0

Signed-off-by: Kurt King <[email protected]>
@kurtaking kurtaking force-pushed the tech-insights/fact-retriever-context-generic branch from b023dd4 to fe87271 Compare April 13, 2025 07:50
@kurtaking
Copy link
Member Author

@punkle @Xantier - can I get your input here? Thanks!

@kurtaking kurtaking added the workspace/tech-insights Used to tag tech-insights workspace issues and pull requests label Apr 30, 2025
@Xantier
Copy link
Contributor

Xantier commented May 1, 2025

@kurtaking Looks straightforward, what kind of questions did you have around this?

@kurtaking
Copy link
Member Author

@kurtaking Looks straightforward, what kind of questions did you have around this?

Hey @Xantier, sorry, should have been a bit more specific. I am looking for a review 😁

It feels weird to merge without a +1 from plugin owner unless y'all are okay with merging based on a +1 from any community maintainer.

@kurtaking kurtaking merged commit 375612d into main May 1, 2025
13 checks passed
@kurtaking kurtaking deleted the tech-insights/fact-retriever-context-generic branch May 1, 2025 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

workspace/tech-insights Used to tag tech-insights workspace issues and pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants