fix: remove deprecated PUT /admin/users endpoint and add sunset marker pre-commit hook - #6304
Open
prakhar-singh1928 wants to merge 3 commits into
Open
fix: remove deprecated PUT /admin/users endpoint and add sunset marker pre-commit hook#6304prakhar-singh1928 wants to merge 3 commits into
prakhar-singh1928 wants to merge 3 commits into
Conversation
…r pre-commit hook
- Remove deprecated PUT /admin/users/{user_email} endpoint and its
update_user_deprecated function from mcpgateway/routers/email_auth.py
- Inline update_user_delegate body back into update_user (PATCH) as
documented in the delegate's docstring
- Remove Response import no longer needed after endpoint removal
- Remove [#2754]-guarded test blocks from test_email_auth_router.py
including the time-bomb sunset assertion that was blocking the suite
- Remove [#2754]-guarded PUT test block from scripts/test_email_auth_api.py
- Add .github/tools/check_sunset_markers.py pre-commit hook that scans
for [#NNNN] remove/Code to be removed after ... markers and fails fast
at commit time, preventing future time-bombs from entering the codebase
- Register check-sunset-markers hook in .pre-commit-config.yaml
Closes #6270
Signed-off-by: prakhar-singh1928 <prakhar.singh1928@ibm.com>
prakhar-singh1928
requested review from
Lang-Akshay,
brian-hussey,
crivetimihai,
ja8zyjits and
msureshkumar88
as code owners
August 19, 2026 10:58
Signed-off-by: prakhar-singh1928 <prakhar.singh1928@ibm.com>
madhu-mohan-jaishankar
requested changes
Aug 21, 2026
madhu-mohan-jaishankar
left a comment
Collaborator
There was a problem hiding this comment.
don't think we need a pre-commit check just to check sunset markers. Also, the comments may differ tomorrow if somebody writes like "deprecate/code no needed", etc.
Signed-off-by: prakhar-singh1928 <prakhar.singh1928@ibm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
🔗 Related Issue
Closes #6270
Closes #6298
📝 Summary
The deprecated
PUT /admin/users/{user_email}endpoint inmcpgateway/routers/email_auth.pypassed its sunset date, causingtest_admin_get_update_delete_userto fail in CI due to a time-bombassert datetime.now(...) < datetime(2026, ...)inside the test suite.This PR does two things:
Removes the deprecated endpoint.
update_user_deprecatedand itsupdate_user_delegatehelper are deleted. The delegate body was already inlined intoupdate_user(PATCH) as documented in the delegate's own docstring. TheResponseimport that was only needed by the deprecated endpoint is also removed. Associated[#2754]-guarded test blocks are removed from bothtest_email_auth_router.pyandscripts/test_email_auth_api.py.Replaces the broken enforcement pattern. The time-bomb
assertinside a pytest test is inherently fragile — it will always eventually fail in CI regardless of code correctness. It is replaced by a newcheck-sunset-markerspre-commit hook (.github/tools/check_sunset_markers.py) that scans*.pyfiles at commit time for[#NNNN] remove after/[#NNNN] Code to be removed aftermarkers and fails immediately, preventing future sunset time-bombs from entering the codebase.📏 Reviewability
triage🏷️ Type of Change
🧪 Verification
uv run .github/tools/check_sunset_markers.pymake pre-commitmake lintmake testmake coverage✅ Checklist
make black isort pre-commit)📓 Notes
Why a pre-commit hook instead of a test assertion?
A
pytestassertion likeassert datetime.now() < sunset_dateguarantees a future CI failure — it has nothing to do with code correctness and will break the suite even on a green codebase. A pre-commit hook fires at the right moment (before the marker ever lands inmain) and never produces false failures after the fact.Scope of the hook: scans all
*.pyfiles under the repo root, skipping.-prefixed dirs,node_modules,__pycache__,build, anddist. Pattern is case-insensitive and anchored to the[#NNNN]issue reference format used in this codebase.