equinor / equinor/fusion-framework

context: consider hashing/checksumming JSON.stringify-based query cache keys

Open
#5,118 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
10
Forks
10
Avg merge
19h 40m
Merged PRs (30d)
150

Description

Several `key` functions for context module client configs use `JSON.stringify(args)` as a cache key, with a `// TODO - might cast to checksum` comment marking it as a candidate for improvement:

- `packages/modules/context/src/configurator.ts` (`query` and `related` client keys)
- `packages/modules/context/src/ContextConfigBuilder.ts` (`setContextClient`'s `query` and `related` client keys)

```ts
key: (args) => JSON.stringify(args),
```

Consider hashing/checksumming the serialized args instead of using the raw JSON string directly as the cache key (e.g. for shorter/more stable keys).

_Originally flagged as 4 separate `// TODO` comments while resolving fusion-lint warnings on `fix/sematic-lint`._

Contributor guide

Open the contributing guide

Research direction

Read the four key functions in packages/modules/context/src/configurator.ts and packages/modules/context/src/ContextConfigBuilder.ts, focusing on the query and related client keys and their existing TODO comments. Determine whether replacing JSON.stringify(args) with a checksum is appropriate and define completion as applying one consistent, stable keying approach to all four locations.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.