Scenario bundle acronym uniqueness is not enforced, and the rejection answers HTTP 200
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- backend-api-design, databases
Línea de trabajo
Start with the browser create and update paths in factsheet/views.py, then read factsheet/helper.py and factsheet/oekg/connection.py to understand the current comparison and graph access. Compare them with oekg/acronyms.py and the server-minted UID work in #2477. Done means browser-created bundles follow the REST API's uniqueness, conflict response, and UID behavior without duplicate or merged records.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
1. The comparison compares two different things
factsheet/views.py:167-171:
for s, p, o in oekg.triples((None, RDF.type, OEO.OEO_00020227)):
study_acronym = oekg.value(s, DC.acronym)
if str(clean_name(acronym)) == str(study_acronym):
Duplicate_study_factsheet = True
The left side is normalised, the right side is the raw stored value. clean_name
(factsheet/helper.py) replaces spaces, hyphens, %, Ö/ö, /, :, ( and ) with
underscores or expansions — but bundles are stored with dc:acronym set to the unmodified input.
So for an existing bundle with acronym NEP 2037, a second create with the same acronym compares
"NEP_2037" == "NEP 2037" → False, and the duplicate is created. The check only ever fires for
acronyms containing none of the replaced characters.
Effect: acronym uniqueness is silently unenforced for a large share of real acronyms.
The update path has its own copy of the same comparison (:625-634).
2. When it does fire, it answers 200
response = JsonResponse("Factsheet exists", safe=False, content_type="application/json")
No status code, so Django sends 200 OK. A rejected create is indistinguishable from a successful
one for any client that checks status codes rather than parsing the body string. It should be a
409 Conflict.
3. It is an O(bundles) graph scan per create
The check iterates every OEO_00020227 in the graph and issues an oekg.value() per bundle. With
SPARQLUpdateStore as transport (factsheet/oekg/connection.py) each of those is its own HTTP round
trip to Fuseki. A single ASK would answer the same question in one request.
4. Adjacent: the client-supplied uid is unvalidated
uid = request_body["uid"]
study_URI = URIRef("https://openenergyplatform.org/ontology/oekg/" + uid)
A client-supplied string is concatenated straight into the IRI namespace — no UUID check, no
character check. Note the create checks the acronym for duplicates but never the uid, so a
POST carrying an existing uid with a different acronym writes its triples into the existing
bundle's URI: a silent merge.
Suggested fix
- Compare like with like — normalise both sides, or store the normalised form alongside and compare
that. Decide which is canonical and write it down. - Answer 409 on a duplicate.
- Replace the scan with a single
ASK. - Mint the uuid server-side rather than validating a client-supplied one — that closes the
surface instead of policing it.
This is already built and merged for the REST API: oekg/acronyms.py (#2471) holds the whole
acronym promise, and the server mints the uid (#2477). The fix here is to route the browser's create
through the same code rather than to write a second answer.
Why it matters beyond the browser
The API depends on acronym uniqueness being real: a stateless modelling pipeline re-identifies its
bundle with GET /api/v0/scenario-bundles/?acronym=…, so an unenforced acronym makes re-import pick
the wrong bundle or create duplicates. Academy notebook #2464 teaches exactly that pattern.
Found while charting the OEKG REST API (WF-10, "Idempotent re-import for the modelling pipeline").
Verified still present on develop (f21a6a3b7) on 2026-09-21; line numbers are from that commit.
- Lenguaje dominante
- Python
- Estrellas
- 65
- Forks
- 28
- Merge medio
- 4 d 7 h
- PR fusionados (30 d)
- 25
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de OpenEnergyPlatform/oeplatform
-
API bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
OpenEnergyPlatform/oeplatform#2580 ·
Los mantenedores suelen responder en 3 días
-
Redesign the database page to support dataset creationPosiblemente ocupada @bmlancien la tomó hace 4 días. Abiertodata-upload
OpenEnergyPlatform/oeplatform#2762 · 1 comentario · 3 asignados ·
Los mantenedores suelen responder en 3 días
-
Improve navigation links in Core Features and Integrated WorkflowsPosiblemente ocupada @tomi-rli la tomó hace 19 días. AbiertoHomepage
OpenEnergyPlatform/oeplatform#2746 · 1 asignado ·
Los mantenedores suelen responder en 3 días
-
Enhance the new OEP homepagePosiblemente ocupada @jh-RLI la tomó hace 19 días. AbiertoHomepage
OpenEnergyPlatform/oeplatform#2745 · 2 asignados ·
Los mantenedores suelen responder en 3 días
-
Display child nodes in the OEO Viewer Graph ViewPosiblemente ocupada @jh-RLI la tomó hace 23 días. Abiertooeo viewer
OpenEnergyPlatform/oeplatform#2739 · 1 asignado ·
Los mantenedores suelen responder en 3 días
Todos los issues de OpenEnergyPlatform/oeplatform
Issues similares
-
[dbt] exported dataset keys reference physical columnsPosiblemente ocupada @WilliamKelley la tomó hoy. Abiertoneeds-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/ossie-converters#251 ·
Los mantenedores suelen responder en 2 días
-
cli difficulty: easy enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
desec-io/desec-stack#1312 ·
Los mantenedores suelen responder en 14 días
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
aws/aws-durable-execution-sdk-python#977 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
flashinfer-ai/flashinfer#9803 ·
Los mantenedores suelen responder en 1 día