Map the Hanumanth Nagar (HN) campus to campusCode 3
I maintainer di solito rispondono entro 1 giorno
@nishantjakane ci sta già lavorando.
Dal 3/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
🔄 Updated for v5.0.0 (2026-10-08). Rewritten for 5.0.0 (#241). The campus is no longer worked out from the PRN's digit.
campusis now the campus's institute name exactly as PESU Academy sends it (for examplePES University (Ring Road)), andcampusCodeis mapped from that name byCAMPUS_CODESinapp/pesu.py. #175's safe fallback is built in: an unknown name is returned ascampus, withcampusCode: null, a warning and anunknown_campus_codecount, and the login still succeeds. So an HN student already gets a 200 today, just without a code. What's left is learning HN's exact institute name and mapping it to3. The old dependency on #175 and the"HN"abbreviation no longer apply; the original guide is in the edit history.
🌱 This is a beginner-friendly issue. Add support for the Hanumanth Nagar (HN) campus, whose campus code is 3. It's a small change that shows how a profile travels from PESU Academy's mobile API, through
app/pesu.py, into the response models and out of the API. Ask questions in the comments at any point.
⚠️ Who can take this issue
- Anyone, for the code. The mapping, the model and the tests work fully offline with synthetic profiles.
- But the exact campus name has to come from a real HN profile. If you have an HN account, or know an HN student willing to check theirs, you can verify it yourself (Step 1). If not, ask in the comments: a maintainer will help get it. Don't guess the name: a guess that is slightly wrong maps nothing.
- Wait until you're assigned. Comment to ask for the issue, then wait for a maintainer to assign it to you before writing any code. PRs for unassigned issues are closed without review.
How campuses work now
In app/pesu.py:
# The campus code for each campus's institute name, as PESU writes it. The codes are the campus digit
# in the student's PRN and SRN, which is what this API has always returned. Checked against students
# of both campuses.
CAMPUS_CODES = {"PES University (Ring Road)": 1, "PES University (Electronic City)": 2}
campuscomes from the profile response'sSTUDENT_PHOTO.instituteName(seeStudentPhotoinapp/models/upstream.py), returned as PESU wrote it.campusCodeisCAMPUS_CODES.get(campus), inPESUAcademy._campus_code. An unknown name givesnull, incrementsprofile_parse_errors_total{reason="unknown_campus_code"}and logsUnknown campus name: .... The rest of the profile is returned normally.ProfileModel.campus_codeinapp/models/profile.pyisLiteral[1, 2] | None.
So for an HN student today, campus is whatever PESU calls the HN institute, and campusCode is null.
What you'll change
| File | Change |
|---|---|
app/pesu.py |
Add HN's exact institute name → 3 to CAMPUS_CODES, and update its comment (which campuses it was checked against). |
app/models/profile.py |
Allow Literal[1, 2, 3] for campus_code, and document 3 in its description. Keep strict validation and the camelCase alias. |
tests/unit/test_pesu.py |
Add HN to the parametrized test_the_campus_is_the_institute_name_and_the_code_is_mapped_from_it, and change test_an_unknown_campus_name_is_returned_and_counted, which uses an invented PES University (Hanumanthanagar) as its unknown name: use a name that is obviously fictional instead. |
README.md |
Document 3 in the campusCode row of the ProfileObject table. |
Both the mapping and the model must change together. Adding the mapping alone would make the response fail validation (Literal[1, 2] rejects 3), which the authenticate route turns into a 500.
Step-by-step guide
Step 1: Find HN's exact institute name
This needs a real HN account, used only by its owner:
- Log in to pesu-auth with
profile: true(locally, or onhttps://pesuauth.onrender.com) and readcampusfrom the response. It's exactly the string PESU sends. Also check that the PRN's campus digit is3(PES3...). - Also confirm that the login itself works.
LOGIN_FORMinapp/pesu.pysendsinstId: "1,6,7,14", the PES institutes a login is tried against. If an HN student can't log in at all, that list is the first suspect: say so in the comments, and don't change it without the evidence. - Post only the institute name and whether the login worked in the comments, never any other part of the profile, and never the credentials.
Step 2: Add HN to the mapping and the model
- Add the name from Step 1 to
CAMPUS_CODESwith the value3, and update the comment above it. - Allow exactly
1,2and3inProfileModel.campus_code; don't replace the literal with an unrestricted integer, and don't derive it fromCAMPUS_CODES. - Keep RR (
1) and EC (2) as they are, and keep the unknown-campus behaviour for every other name.
Step 3: Write tests
Use synthetic profiles and the mocked HTTP fixtures in tests/unit/conftest.py (upstream, make_response, login_payload, profile_payload); never commit a real profile.
- All three known names map to
1,2and3, and none of them triggers the warning or theunknown_campus_codecount. - An unknown name (obviously fictional) is still returned as
campuswithcampusCode: null, the warning and one count. - An HN profile validates through
ProfileModelandResponseModel, and/authenticatereturns it with a 200 (tests/unit/test_authenticate_flow.pydrives the whole app with the upstream mocked). -
fields=["campusCode", "campus"]returns both HN fields, and a selection without them omits them. - The published schema allows exactly 1, 2 and 3 (
tests/unit/test_openapi_docs.py).
Then run:
uv run pytest tests/unit -q
uv run python scripts/run_tests.py
Coverage must stay at 100%, lines and branches. Report a run without live credentials as partial.
Step 4: Update the documentation
- The README's
ProfileObjecttable and thecampus_codedescription. - If you add an HN response example to
app/docs/authenticate.py, make it validate (tests/unit/test_openapi_docs.pychecks every documented example). - The agent docs in pesu-dev/skills (
auth/docs/api-contract.md,auth/docs/upstream.md) describe campuses too. Mention it in your PR so a maintainer updates them there; don't editAGENTS.md,.agents/or.github/agents/in this repo.
Step 5: Open your PR
- Bump the minor version in
pyproject.toml(for example5.0.0→5.1.0), then runuv lock, and commit both files. Call out the new campus code in the PR. - Run
uv run pre-commit run --all-filesand fix anything it reports. - Open the PR from your fork, against the
devbranch. - Use a Conventional Commit title, for example
feat: map the Hanumanth Nagar campus to campusCode 3. - Write
Closes #227in the PR description, and say how the institute name was verified.
Done when
- HN's exact institute name was verified from a real profile and is mapped to
3 - An HN profile returns
campusCode: 3with itscampusname, and a 200 - RR (
1) and EC (2) are unchanged, and unknown names still fall back tonullwith the warning and count - The model and the published schema allow exactly 1, 2 and 3
- Tests cover all of the above, and coverage is 100%
- README and model descriptions document
3 - Pre-commit passes, the version and lock file agree, and the PR is from your fork against
dev
Want to go deeper?
The repo has detailed guides in .agents/pesudev-skills/auth/docs/. Run git submodule update --init if the folder is empty. They are being updated for 5.0.0; where they still describe the PRN digit or HTML scraping, the code wins.
- Lingua principale
- Python
- Stelle
- 22
- Fork
- 29
- Merge medio
- 1g 3h
- PR unite (30g)
- 19
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 18 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
-
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 12 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 12 giorni fa. Apertaapi enhancement
pesu-dev/auth#235 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Gather the campus mapping and other shared values into constants modulesForse già presa @edgelordlinux l’ha presa 12 giorni fa. Apertaapi enhancement good first issue pesuacademy student profile tests and ci/cd
pesu-dev/auth#230 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di pesu-dev/auth
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
PolicyEngine/policyengine-us#10262 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
kellyjonbrazil/jc#788 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
`/search.json` ignores the documented `editions.sort` parameterForse già presa @PranavD2905 l’ha presa oggi. ApertaAffects: Server Good First Issue Module: Solr Needs: Triage Theme: Public APIs Theme: Search
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
internetarchive/openlibrary#13989 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug P2: misleading query
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
jeffknupp/association#478 ·