Repository navigation
Fix 2FA completion, token refresh, inventory, and news handling - #8
Merged
Merged
Conversation
Maho-Yoshino
left a comment
Member
There was a problem hiding this comment.
Reviewed the diff (alex_pr7_review_fixes -> cleanup-returns), syntax-checked the changed files, ran the test suite on the branch (3/3 pass), and verified the forum ordering change against the live Discourse page. The 2FA rewrite is a solid improvement over the previous Event-based state machine; nothing below blocks the merge, but a few items are worth addressing.
Verified correct:
[A-z]->[A-Za-z]genuinely fixes adjacent-tag parsing (the old class included]/[); droppingre.IGNORECASEis safe.WeakValueDictionary+ per-emailasyncio.Lockworks (confirmedasyncio.Lockis weak-referenceable andsetdefaultexists).compare_digestonbytesis consistent with the sha256 digest._checked_loginstatus handling andint()validation are sound.- The
timeout/shield/wait_for(60)split correctly separates the 15-minute challenge lifetime from the caller's 60s wait.
Inline comments below map each finding to its line.
Maho-Yoshino
added a commit
that referenced
this pull request
Nov 21, 2026
* Beginning * Rename 'app' to 'src' This better fits the whole project's scope, and it is a more standardized name * Finish AGENTS.md migration to new structure * Major dict helper rewrite Now it is less monolithic in design, with separate classes for different actions * more dict util improvements * Hosting files improvements * Endpoints return data cleanup work * Major news utility rework Removed the part, which stores the latest IDs in an external JSON file This code used to be part of [PECK Bot](https://github.com/Order-Of-The-Birb/peck-bot), however the API doesn't require any persistent check for already-sent data Added forum parsing Implemented parralel fetching to speed it up Restructured the code * A lot of fixes + cache module Got tired of writing caches manually * Fix error between brackets on `/v1/clans/sqb/current` * implement cache into news module * Fixes * Marketplace endpoints improvements Also added new functionality while i was at it * Fixes * Fix Swagger UI modify js Now websockets get hidden properly * Implement basis for automated testing * Create pyproject.toml * Update pyproject.toml * Add vehicleParser to ruff ignore * Ruff suggested fixes * Update const.py * Fixing some pytest complaints * Bugfix and raising supported FastAPI version This bugfix allowed us to raise the FastAPI version from 0.136.1 to 0.162.0 * Add basic login tests more to come in the future * Fixing network return model * Added github workflows Automatic linting and pytest running should now work in theory * Testing newly added workflows * More testing Ruff one didnt work because i was stupid * style: apply ruff fixes * Bugfixes Websockets are back again Network.request had return_type at the wrong place, so it raised an error * Fixing routing issue Previous method only did "/news_ws" instead of "/v1/news_ws" * style: apply ruff fixes * Remove redundant nonlocal declaration * Fixing issues proposed by Deepseek * Cleanup * style: apply ruff fixes * More fixes Removed some redundant files Detached the vehicle parser from the code (no longer blocks on startup) Added some more edge case checks Moved the terse key to a string, due to JSON's floating point errors with large numbers added an event setter for providing 2FA codes, now login should work (in theory, cant be sure due to untested code) * Remove unused AuthenticationError import * style: apply ruff fixes * A few more bugfixes * Fix return name of clan search Changes the return to IntString, and from "_id" to "id" * style: apply ruff fixes * Added returning the next bracket * style: apply ruff fixes * Improve localization + get endpoint Improves the localization part of the vehicles processor Adds an endpoint for requesting localization * style: apply ruff fixes * Restructure Restructured routers for ease of finding related files * Linter fixes * Marketplace backend restructuring * Code fixes * Refactoring VehicleParser * Update workflows to stop deprecation notices * Attach HEAD to linting workflow * Make linter only run in PRs Non-PR pushes do not get automatically linted anymore * Remove redundant list from linter * Make tests run on pull requests * Fixing issues * Improving testing response provider structure * Improve network manager Now it doesn't have to generate a new session for each request * Migrating replays logic to updated networkmanager * style: apply ruff fixes * Major whitespace cleanup * error fixing * Added more linting checks * Fix test network manager reference * Deepseek proposed fixes * Implementing fixes * style: apply ruff fixes * Fixes * Return type standardization Now instead of a mix of `response_model` and return annotations, all methods use `response_model` * style: apply ruff fixes * Add return types to endpoints without one + fix some endpoints that don't return dicts * style: apply ruff fixes * Improve pytest harness * Removed unused ServerBearer usage Several endpoints were protected by `ServerBearer` for no reason, as these endpoints did not require any authentication in the backend for use * Fixes * Fixes pt.1 * style: apply ruff fixes * Fixes pt.2 * style: apply ruff fixes * Fixes pt. 3 * Make code required parameter again for 2FA * Fixes pt.4 * style: apply ruff fixes * Fixes pt.5 * Fixes pt.6 * Fix forwarded IPs config * style: apply ruff fixes * Improve contact info display * style: apply ruff fixes * Fix 2FA completion, token refresh, inventory, and news handling (#8) * Fix two-factor login, token refresh, inventory, and news handling * Fix token refresh, 2FA retries, and marketplace and forum responses --------- Co-authored-by: MrMindBlow <49791075+MrMindBlow@users.noreply.github.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.
This PR addresses the nine open findings in the review of #7. It targets
cleanup-returns, so merging it first brings the fixes into #7 for its final review againstmain.Changes
commodityflag tofalse, select forum announcements in publication order, and parse adjacent bracketed news tags individually.Verification
Manually exercised the FastAPI authentication routes with synthetic upstream responses and a temporary SQLite database. Approval before retry returned a token after a single upstream challenge. A disconnected poll renewed its request ID. A failed email exchange returned 502 immediately and allowed a fresh challenge. A rejected server-account code returned 403. The refresh route returned 429, and the background refresh preserved the throttled account and renewed another.
The inventory response model accepted an asset without
commodity. A public forum request confirmed creation order, and a two-tag title produced two distinct tags. Ruff, Python 3.14 compilation, andgit diff --checkpassed. Account-backed Gaijin endpoints were not exercised.