Memory and snapshot sync route tests pass when the sender's schema version is dropped
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 88/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, node.js
- Ambito
- backend-api-design, testing
Direzione di ricerca
Inizia con server/routes/memory.test.js e server/routes/dataSync.test.js, quindi confronta i relativi casi con le chiamate alle route in server/routes/memory.js e server/routes/dataSync.js. Aggiungi test che passino i dati della versione dello schema ai servizi simulati e verifichino come ciascuna route gestisce una risposta 409 o blockedBySchema. Il lavoro è completo quando le mutazioni di inoltro elencate fanno fallire i test delle route e i casi limite HTTP passano.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Slice audited: federation route tests (test-quality audit, 2026-10-18).
Problem
Two sync routes forward the sender's version envelope to the service gate that refuses or reshapes cross-version payloads (server/lib/schemaVersions.js). Their route tests never send that envelope, so forwarding is untested.
server/routes/memory.js:88-90and:101-103forwardschemaVersiontomemorySync.getChangesSince/applyRemoteChanges, which gate atserver/services/memorySync.js:39and:107.server/routes/memory.test.js:175,:184,:193assertgetChangesSince('10', 50)and:263assertsapplyRemoteChanges(memories); no case sends?schemaVersion=orbody.schemaVersion. Mutation probe: made both handlers always call the two-argument form.
Test Files 2 passed (2) Tests 49 passed (49)
server/routes/dataSync.js:186callsdataSync.applyRemote(category, data, { portosMeta }), the only thing that lets the version gate atserver/services/dataSync.js:1362fire for this route.server/routes/dataSync.test.js:388("leaves the write direction alone — apply is gated by its schema-version check, not this") posts noportosMetaand asserts{ portosMeta: undefined }, the one value that disables the gate it names. Mutation probe: replaced the forwarded value with the constant{ portosMeta: undefined }.
Test Files 1 passed (1) Tests 42 passed (42)
Impact
syncOrchestrator.js:322 pulls GET /api/memory/sync?…&schemaVersion=N from a peer; the serving install uses that to shape rows and to 409 a newer puller. With forwarding lost, rows go out in the legacy shape with no version in the envelope and the puller applies them as version 0. For the snapshot apply route, a newer-schema snapshot posted to an older install is applied ungated, the corruption schemaVersions.js exists to prevent. The service-level gates are covered only in memorySync.db.test.js, which pregate does not run, so the route layer is the only guard in the default CI plan.
Fix (decided)
server/routes/memory.test.js: addGET …?schemaVersion=NassertinggetChangesSincereceived('10', 50, N),POSTwithschemaVersionassertingapplyRemoteChanges(memories, N), and one case where the mocked service rejects with status 409 and the route passes the status through.server/routes/dataSync.test.js:388: replace the assertion. Post a populatedportosMeta: { portosVersion, schemaVersions: { digitalTwin: 99 } }, assert it is forwarded verbatim, and add one case where the mock returnsblockedBySchemaand the route surfaces it in the response.- No production code change.
Scope: small
Acceptance criteria
- Forcing the two-argument calls in
routes/memory.jsfailsroutes/memory.test.js. - Forwarding
{ portosMeta: undefined }unconditionally inroutes/dataSync.jsfailsroutes/dataSync.test.js. - A 409 or
blockedBySchemafrom the mocked service is asserted at the HTTP boundary in each file. - No production code change.
- Lingua principale
- JavaScript
- Stelle
- 38
- Fork
- 32
- Merge medio
- 27m
- PR unite (30g)
- 990
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di atomantic/PortOS
-
LM Studio provider catalogs miss models installed outside PortOSForse già presa @atomantic l’ha presa oggi. Apertain-progress
atomantic/PortOS#15291 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di atomantic/PortOS
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Fei2411/DeepSeek-Bot#1113 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
arfct/timezone.fyi#19 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
fastify/fastify-http-proxy#493 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
eliasstravik/herdr-projects#785 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tensorflow/tfjs#8754 ·