Skip to content

#153 - deprecate Know Your Class and Section feature - #155

Open
ndigvijay wants to merge 2 commits into
pesu-dev:devfrom
ndigvijay:deprecate-kycas
Open

#153 - deprecate Know Your Class and Section feature#155
ndigvijay wants to merge 2 commits into
pesu-dev:devfrom
ndigvijay:deprecate-kycas

Conversation

@ndigvijay

@ndigvijay ndigvijay commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

📌 Description

This PR removes the deprecated knowYourClassAndSection feature because the corresponding PESU Academy endpoint, /Academy/a/getStudentClassInfo, no longer works.

The removal includes:

  • Removing knowYourClassAndSection from the authentication request schema.
  • Removing knowYourClassAndSection from the authentication response schema.
  • Removing the upstream API request and response parsing logic.
  • Removing the KYCAS response model and dedicated exception.
  • Removing KYCAS-only profile fields.
  • Removing related README and OpenAPI documentation.
  • Removing benchmark CLI and payload support.
  • Removing obsolete unit, functional, and integration tests.

Requests containing knowYourClassAndSection are now treated like any other unknown request field and return a 400 validation response.

ℹ️ Fixes / Related Issues
Fixes: 153
Related: N/A

🧱 Type of Change

  • 🐛 Bug fix – Non-breaking fix for a functional/logic error
  • ✨ New feature – Adds functionality without breaking existing APIs
  • ⚠️ Breaking change – Introduces backward-incompatible changes (API, schema, etc.)
  • 📝 Documentation update – README, docstrings, OpenAPI tags, etc.
  • 🧪 Test suite change – Adds/updates unit, functional, or integration tests
  • ⚙️ CI/CD pipeline update – Modifies GitHub Actions, pre-commit, or Docker build
  • 🧹 Code quality / Refactor – Improves structure, readability, or style (no functional changes)
  • 🐢 Performance improvement – Speeds up auth, scraping, or reduces I/O
  • 🕵️ Debug/logging enhancement – Adds or improves logging/debug support
  • 🔧 Developer tooling – Scripts, benchmarks, local testing improvements
  • 🔒 Security fix – Addresses auth/session/data validation vulnerabilities
  • 🧰 Dependency update – Updates libraries in requirements.txt, pyproject.toml

🧪 How Has This Been Tested?

  • Unit Tests (tests/unit/)
  • Functional Tests (tests/functional/)
  • Integration Tests (tests/integration/)
  • Manual Testing

⚙️ Test Configuration:

  • OS: macOS
  • Python: 3.14.6 via uv
  • Docker build tested

Testing performed:

  • uv run pytest -m 'not secret_required'
    • 63 tests passed.
    • 11 secret-dependent tests were deselected because the required TEST_* credentials were unavailable.
  • Relevant request-model and integration tests:
    • 31 tests passed.
    • 6 secret-dependent tests were deselected.
  • uv run ruff check .
    • All checks passed.
  • Generated OpenAPI schemas were inspected to confirm knowYourClassAndSection is absent from both request and response models.
  • Repository searches confirmed there are no remaining references to the removed feature.

✅ Checklist

  • My code follows the CONTRIBUTING.md guidelines
  • I've performed a self-review of my changes
  • I've added/updated necessary comments and docstrings
  • I've updated relevant docs (README or endpoint docs)
  • No new warnings introduced
  • I've updated tests for the removed behavior
  • All tests pass locally (scripts/run_tests.py)
  • I've run linting and formatting (pre-commit run --all-files)
  • Docker image builds and runs correctly
  • Changes are backwards compatible (if applicable)
  • Feature flags or .env vars updated (if applicable)
  • I've tested across multiple environments (if applicable)
  • Benchmarks still meet expected performance (scripts/benchmark/benchmark_requests.py)

🛠️ Affected API Behaviour

  • app/app.py – Modified /authenticate route logic
  • app/pesu.py – Updated scraping or authentication handling

🧩 Models

  • app/models/request.py – Input validation or request schema changes
  • app/models/response.py – Authentication response formatting
  • app/models/profile.py – Profile extraction logic

🐳 DevOps & Config

  • Dockerfile – Changes to base image or build process
  • .github/workflows/*.yaml – CI/CD pipeline or deployment updates
  • pyproject.toml / requirements.txt – Dependency version changes
  • .pre-commit-config.yaml – Linting or formatting hook changes

📊 Benchmarks & Analysis

  • scripts/benchmark/benchmark_requests.py – Removed support for the deprecated request flag
  • scripts/benchmark/analyze_benchmark.py – Benchmark result analysis changes
  • scripts/run_tests.py – Custom test runner logic or behavior updates

📸 Screenshots / API Demos

Example response when a client continues to send the removed field:

{
  "status": false,
  "message": "Could not validate request data - body.knowYourClassAndSection: Extra inputs are not permitted"
}
The generated OpenAPI request and response schemas no longer include knowYourClassAndSection.
🧠 Additional Notes
This is a breaking API change.
Clients must remove knowYourClassAndSection from authentication requests and stop expecting it in authentication responses. Direct Python callers must also stop passing the know_your_class_and_section argument to PESUAcademy.authenticate().
The normal profile response continues to provide supported fields such as semester and section.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the deprecated Know Your Class and Section (KYCAS) feature end-to-end from the PESUAuth API because the upstream PESU Academy endpoint no longer works, and updates tests/docs/tooling accordingly.

Changes:

  • Removes the knowYourClassAndSection request flag and the corresponding response payload/model/exception.
  • Deletes all KYCAS scraping/parsing logic from PESUAcademy.authenticate() and associated tests.
  • Updates docs and benchmark tooling to drop KYCAS references and CLI support.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/unit/test_request_model.py Removes request-model tests that covered the now-removed KYCAS request flag; retains extra-field rejection coverage.
tests/unit/test_pesu.py Drops unit tests and imports related to KYCAS fetch/parsing behavior; minor formatting tweaks.
tests/integration/test_app_integration.py Removes integration coverage for KYCAS request/response behavior and validation.
tests/functional/test_authenticate_functional.py Removes functional tests that exercised KYCAS behavior.
scripts/benchmark/util.py Removes KYCAS payload flag from benchmark request construction.
scripts/benchmark/benchmark_requests.py Removes KYCAS CLI flag and propagation into benchmark requests.
README.md Removes KYCAS from API request/response documentation and examples.
app/pesu.py Removes KYCAS constants and the KYCAS fetch path from authenticate().
app/models/response.py Removes the KYCAS field from the response schema.
app/models/request.py Removes the KYCAS field from the request schema so it becomes a forbidden extra input.
app/models/kycas.py Deletes the KYCAS response model.
app/models/init.py Removes KYCAS model export from the models package.
app/exceptions/authentication.py Removes the dedicated KYCAS fetch exception type.
app/docs/authenticate.py Removes OpenAPI examples and error examples related to KYCAS.
app/app.py Stops passing the removed KYCAS flag through the /authenticate route into PESUAcademy.authenticate().

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread README.md
| `fields` | Yes | `list[str]` | `None` | Which fields to fetch from the profile information. If not provided, all fields will be fetched |
| **Parameter** | **Optional** | **Type** | **Default** | **Description** |
| ------------- | ------------ | ----------- | ----------- | ----------------------------------------------------------------------------------------------- |
| `username` | No | `str` | | The user's SRN or PRN |

@achyu-dev achyu-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants