Bundle bindings route repeats full-state parsing and full re-hashing on every request

Aperta
#262 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Start with reference-implementations/dacs-directory/app/api/dacs/bundles/[jobId]/route.ts, then read src/catalog/pagination.ts and test/catalog-binding-pagination.test.ts to understand the current page and cursor behavior. The issue calls for a per-job binding index or cache that avoids loading all scan state and re-hashing and sorting bindings on each page. Update the cost notes in README.md and src/catalog/contracts.ts; done means the existing cursor behavior is preserved and the pagination tests pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

contributors-section minor

Where: reference-implementations/dacs-directory/app/api/dacs/bundles/[jobId]/route.ts:33 (on phase0-completion at the linked commit)

What goes wrong: Every GET /api/dacs/bundles/{jobId} calls loadScanState() (route.ts:33), which reads, parses and normalises the entire stored scan state only to look up one jobId, so the cost grows with the size of the whole state rather than the reply. In addition, every request with limit or cursor (route.ts:37) computes the content hash of every binding stored for the job and sorts them all in keysetPage (src/catalog/pagination.ts), then returns one page, so reading a large job in pages repeats that work on each page. The README (README.md:366-367) and the OpenAPI descriptions (src/catalog/contracts.ts:404-405) already warn that paged reads cost more than a plain read.

Suggested fix: Stop loading the full scan state per request: read only the bundle bindings, for example from a small separately stored or cached index keyed by jobId. Keep each job's bindings in content-hash order in that index (or cache the hash-ordered list per job) so a page is a slice instead of a full re-hash and sort. Keep the existing cursor behaviour (a page starts after the cursor key even if that binding is gone) and its tests in test/catalog-binding-pagination.test.ts. Then update the cost note in README.md:366-367 and src/catalog/contracts.ts:404-405 to match.

Size: Medium

This comes from a code review, not from a failing run, so please confirm it before starting. Send the fix as a pull request to phase0-completion. It merges once tests pass and a maintainer has approved it.

Lingua principale
TypeScript
Stelle
0
Fork
3
Merge medio
20h 26m
PR unite (30g)
119

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DACS-Agent-commerce/Community

Tutte le issue di DACS-Agent-commerce/Community

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.