Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add `ETag`/conditional-request support to read-only GET endpoints

Open
#222 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
nodejs, typescript
Domain
api, performance

Research direction

Start with src/discovery/agent-reviews.service.ts or the portfolio list route, and read src/common/cache/cache-invalidation.service.ts to see how mutations are signalled. Add a weak ETag and a 304 path for a matching If-None-Match, with Cache-Control: private on authenticated responses. Done when a test confirms user B never receives user A's cached response and the ETag changes after a mutation.

Written by the indexing model from the issue text.

Description

enhancement help wanted intermediate performance

Problem

No response caching is implemented anywhere in the codebase. There is no ETag, no Cache-Control, and no conditional-request handling (If-None-Match) on any of the roughly 377 routes.

There is a caching service available — src/common/cache/ with cache.service.ts, cache-warming.service.ts, cache-invalidation.service.ts, and cache-stats.service.ts, plus a cacheable.decorator.ts — but that is an in-process/Redis cache for data access, which is a different concern from HTTP response caching.

Good candidates that are currently fully recomputed on every request: agent discovery and reviews (src/discovery/agent-reviews.service.ts), health component status, and portfolio performance endpoints.

Why it matters

Several of these endpoints are read-heavy and change rarely. Without conditional requests every dashboard poll re-serialises the same payload and every client re-downloads it, which is pure waste on both sides and inflates the API's egress costs. For an SDK-driven client polling a portfolio or agent list, this is the difference between a few KB and tens of KB per poll.

Suggested Direction

  1. Start with one endpoint and prove the pattern — GET /api/v1/portfolio/portfolios (list) or the agent reviews endpoint is a good candidate.
  2. Generate a weak ETag from a cheap content fingerprint. If the underlying rows have an updatedAt, prefer a version or hash over serialising the response twice. The cursor-pagination utility in src/common/pagination/ may already have a hashing approach worth reusing.
  3. Handle If-None-Match by returning 304 Not Modified with no body.
  4. Set an appropriate Cache-Control — note that authenticated responses are per-user, so public caching would be a data leak across users. Use private, max-age=... or no-store where responses vary by identity.
  5. Invalidate correctly. If the resource is mutated, the ETag must change. The existing cache-invalidation.service.ts is a natural hook.

Constraints

  • Never cache per-user responses as public. Verify by testing that user B's response is not served to user A — the hardcoded userId = "system" issue in file-upload.controller.ts is a reminder that identity handling here is currently unreliable.
  • Respect Authorization headers: do not serve a cached response to a request that carries credentials unless the entry is explicitly user-scoped.
  • A 304 must carry ETag and must not include a body.
  • Do not add HTTP caching in front of endpoints with existing side effects.

Acceptance Criteria

  • At least one read-only GET endpoint returns an ETag.
  • A matching If-None-Match returns 304 with no body.
  • Cache-Control is set and is private (or no-store) for authenticated responses.
  • A test asserts user A's cached response is never served to user B.
  • The ETag changes after the underlying resource is mutated.
  • The pattern is documented in CONTRIBUTING.md so other endpoints follow it.
Dominant language
TypeScript
Stars
7
Forks
55
Avg merge
1d 17h
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SourceXXL/alian_structure-api

All issues in SourceXXL/alian_structure-api

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.