Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

adapter.aasx: Failsafe writer adds duplicate parts for conflicting files

Aperta Adatta ai principianti
#671 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 4 giorni

@JavithNaseem-J ci sta già lavorando.

Dal 23/10/2026.

  • #675 di @JavithNaseem-J — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend, databases

Direzione di ricerca

La gestione dei conflitti si trova in sdk/basyx/aas/adapter/aasx.py intorno alle righe 777–796, e l’issue indica test_writing_file_twice come copertura correlata. Leggi il ramo failsafe ed esegui prima quel test; aggiungi copertura per i contenuti dei file in conflitto. Il lavoro è terminato quando la modalità failsafe registra il conflitto e salta la parte in conflitto, preservando il primo file nel pacchetto.

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

Descrizione

bug good-first-issue sdk

When two write_aas() / write_all_aas_objects() calls write a
supplementary file with the same name but different content, the
writer detects the conflict. With failsafe=False it raises
ValueError. With failsafe=True it logs the error but does not skip
the file, and writes the part a second time:

https://github.com/eclipse-basyx/basyx-python-sdk/blob/2773ac069d3163cbbd32c3c634813d38bbe521ad/sdk/basyx/aas/adapter/aasx.py#L777-L796

Steps to reproduce:

def store(sm_id, content):
    sm = model.Submodel(sm_id, submodel_element=[
        model.File("f", "application/pdf", "/aasx/manual.pdf")])
    files = aasx.DictSupplementaryFileContainer()
    files.add_file("/aasx/manual.pdf", io.BytesIO(content),
                   "application/pdf")
    return model.DictIdentifiableStore([sm]), files

with aasx.AASXWriter("dup.aasx", failsafe=True) as w:
    w.write_all_aas_objects("/aasx/a.json", *store("urn:sm:1", b"AAA"))
    w.write_all_aas_objects("/aasx/b.json", *store("urn:sm:2", b"BBB"))
# UserWarning: Duplicate name: 'aasx/manual.pdf'

Expected behavior: In failsafe mode the conflicting file is logged
and skipped, like a missing file a few lines above.

Actual behavior: The ZIP contains aasx/manual.pdf twice. Reading
the package back, both submodels get BBB; the content AAA of
urn:sm:1 is lost.

Environment: develop @ 2773ac06.

Possible fix: Add continue after the logger.error(...) in the
failsafe branch. The fall-through predates #378, which added the
ValueError for the non-failsafe case. test_writing_file_twice
only covers identical content.

Lingua principale
Python
Stelle
106
Fork
59
Merge medio
4g 1h
PR unite (30g)
3

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 eclipse-basyx/basyx-python-sdk

Tutte le issue di eclipse-basyx/basyx-python-sdk

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.