Check the test payloads against PESU Academy's live response shape
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
- python
- Ambito
- authentication, documentation, testing-qa
Direzione di ricerca
Read CONTRIBUTING.md and docs/upstream.md first, then inspect the parser methods and tests/unit/test_pesu.py. Run the existing test suite before working, using the credential and single-session rules in the issue. Done means the capture script, redacted fixtures, offline parser tests, guard test, refresh README, and requested documentation updates satisfy all acceptance criteria without exposing credentials.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
🔄 Updated for v5.0.0 (2026-10-08). Rewritten for 5.0.0. pesu-auth no longer parses HTML: it reads JSON from PESU Academy's mobile API through pydantic models (#241). The offline tests already run the real parser, the models in
app/models/upstream.py, over payloads shaped like the live responses (LOGIN_PAYLOADandPROFILE_PAYLOADintests/unit/conftest.py), so the original goal is mostly met. What's missing is a check that those hand-written payloads still match what PESU actually sends. The original HTML-fixture proposal is in the edit history.
⚠️ PES University students only. This change needs a live test against PESU Academy with real PESU credentials (see "Tests that need credentials" in
CONTRIBUTING.md). Run the whole suite with your credentials in.envand paste the summary line into your PR. Every run makes real logins to PESU Academy, so run it when you need it, not in a loop.
Summary
pesu-auth's biggest risk is PESU Academy changing its mobile API. The unit tests parse LOGIN_PAYLOAD and PROFILE_PAYLOAD, which were written by hand from the live API's key names and types, with invented values. Nothing checks that they stay like the live API. If PESU renames a key or changes a type, the unit tests keep passing against the old shape. Only the live tests notice, and only for the values they compare. Add a live shape check: compare the structure (keys and value types, never values) of PESU's real responses with the test payloads, so the payloads can't silently drift.
Background
app/models/upstream.pydeclares exactly the fields pesu-auth reads:LoginResponse(mobileJsonObject.login,accessToken) andProfileResponse(MESSAGE, theSTUDENT_INFOfields, andinstituteNameandgenderfromSTUDENT_PHOTO). Everything else is ignored as the response is parsed.tests/unit/conftest.py:LOGIN_PAYLOADandPROFILE_PAYLOADare "shaped like the real responses (key names and types taken from the live API, values invented)". They also contain personal fields the service must never keep (photo, parents, address), so tests can prove those are dropped.- In production, a field PESU stops sending is counted as
profile_parse_errors_total{reason="missing_field"}and a changed type asunexpected_value, and both are returned asnull. That catches drift after it reaches users; this issue catches it in the test suite. - Never commit a real response, even redacted: the profile response holds the student's photo, address, marks and parents' details. A shape check needs no saved data at all.
Proposed change
- A shape helper (in
tests/conftest.pyor a smalltests/shape.py): reduce a JSON value to its structure. Keep keys and the JSON type of each value (str,int,null,object,list), and drop the values themselves. - A live test (
tests/functional/test_upstream_shape.py, markedsecret_required): log in with the.envaccount using the same constants asapp/pesu.py(LOGIN_URL,LOGIN_FORM,MOBILE_HEADERS, thenDISPATCHER_URLandPROFILE_FORMwith the access token). For every field the models read, assert that the live response has it in the same place with the same type as inLOGIN_PAYLOAD/PROFILE_PAYLOAD. A field the account has no value for (nullor"", such as a graduated student'sClassName) matches any type; say so in a comment.- The test must never print, log or put into an assertion message any value: only key paths and type names. Check this with a deliberately failing run.
- Close the client on every path, as
app/pesu.pydoes.
- Report extra keys, but don't fail on them. PESU sends many fields pesu-auth doesn't read. Listing the key paths that appear in the live response but not in the payloads (names only) helps whoever updates the payloads next.
- Document it in
CONTRIBUTING.md's testing section: what to do when the shape test fails (update the payloads intests/unit/conftest.pyand, if a field pesu-auth reads changed, the models), and that the payloads must never hold real values.
Review note for maintainers
Check the test's output on a failing run: it must contain key paths and type names only.
Acceptance criteria
- A live test fails if any field the models read is missing from PESU's response or has a different type than in the test payloads
- No response value appears in test output, logs or assertion messages, and no response is saved to disk
- Extra keys are reported by name without failing
-
CONTRIBUTING.mdexplains how to act on a failure
How to contribute
- Wait until you're assigned. Comment to ask for this issue, then wait for a maintainer to assign it to you before writing any code. PRs for unassigned issues are closed without review.
- Read
CONTRIBUTING.mdfirst. It covers forking, setting up withuv, and running the tests. - Branch from
devin your fork, and open the PR againstdevwith a Conventional Commit title andCloses #217in the description. - Bump the minor version in
pyproject.tomland runuv lock(CI checks this).uv run pre-commit run --all-filesmust pass, and coverage must stay at 100%. - Update the README,
app/docs/and comments in the same PR as the behaviour they describe. - Never log, print, store or echo a password or token, including in tests, PR descriptions and screenshots.
- Lingua principale
- Python
- Stelle
- 22
- Fork
- 29
- Merge medio
- 22h 1m
- PR unite (30g)
- 20
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
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 pesu-dev/auth
-
Check the README for dead links and fix the misleading Docker Hub badgeForse di nuovo libera @knownshah l’ha presa 17 giorni fa e non c’è nessuna pull request aperta. Apertadocumentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
pesu-dev/auth#220 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Run the same checks locally and in CI: pre-commit hooks in CI, and hooks that match CIForse già presa @achyu-dev l’ha presa 1 giorno fa. Apertabug tests and ci/cd
pesu-dev/auth#250 · 2 assegnatari ·
I maintainer di solito rispondono entro 1 giorno
-
bug documentation enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 54/100
I maintainer di solito rispondono entro 1 giorno
-
Commit SHA should be used instead of tag git based deployForse già presa @aditeyabaral l’ha presa 11 giorni fa. Apertabug
pesu-dev/auth#236 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Private Functions in `app.py` needs to be in separate fileForse già presa @aditeyabaral l’ha presa 11 giorni fa. Apertaapi enhancement
pesu-dev/auth#235 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di pesu-dev/auth
Issue simili
-
md/asciidoc/csv: an explicit `encoding="utf-8"` keeps a leading BOM, the auto-detect path drops itAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
docling-project/docling#4846 ·
I maintainer di solito rispondono entro 1 giorno
-
area/sessions comp/dashboard comp/desktop comp/gateway comp/tui duplicate P2 sweeper:risk-session-state type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NousResearch/hermes-agent#138914 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bot-triaged module: activation checkpointing module: inductor oncall: pt2 triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
[oblt-aw][autodoc] Update PR Actions Detective E2E prerequisites and fix dashboard-format table typoApertadocumentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
elastic/oblt-aw#2382 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno