Skip to content

Conversation

@iGufrankhan
Copy link
Contributor

@iGufrankhan iGufrankhan commented Jan 11, 2026

Description
Fix crash in /requests/report/wait/ caused by calling a missing function requestReports.
Remove the call and safely return data from report_requests.

This PR fixes #3563

Notes for Reviewers
requestReports was never defined or imported.
Endpoint now uses:
return jsonify(report_requests.get(id, {}))
Prevents NameError and KeyError.

Signed commits

  • Yes, I signed my commits.

Signed-off-by: iGufrankhan <gufrankhankab123@gmail.com>
Copilot AI review requested due to automatic review settings January 11, 2026 19:54
Copy link
Contributor

Copilot AI left a comment

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 fixes a crash in the /requests/report/wait/<id> endpoint caused by calling an undefined requestReports function. The fix removes the erroneous function call and safely returns data from the report_requests dictionary.

Changes:

  • Added import for report_requests from augur.api.view.init
  • Removed call to undefined requestReports(id) function
  • Changed dictionary access from report_requests[id] to report_requests.get(id, {}) to prevent KeyError

def wait_for_report_request(id):
requestReports(id)
return jsonify(report_requests[id])
return jsonify(report_requests.get(id, {}))
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

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

Returning an empty dictionary when the report ID is not found may not be appropriate API design. Clients cannot distinguish between a missing report and an actual empty report result. Consider returning a 404 status code or an error response when the report ID doesn't exist in report_requests, which would provide clearer feedback to API consumers.

Suggested change
return jsonify(report_requests.get(id, {}))
if id not in report_requests:
return jsonify({
"error": "Report request not found",
"report_id": id
}), 404
return jsonify(report_requests[id])

Copilot uses AI. Check for mistakes.
def wait_for_report_request(id):
requestReports(id)
return jsonify(report_requests[id])
return jsonify(report_requests.get(id, {}))
Copy link
Contributor

Choose a reason for hiding this comment

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

If this value doesnt exist, doesnt that mean we are always going to be returning an empty dict?

I wonder if its better to completely remove the endpoint in that case if all its ever going to do is return an empty dict

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MoralCode at first i think so
that if it gone always return empty then why not completely remove this endpoint but

The route already exists and is being called by the UI
Removing it now could break the UI or other code that still expects it
I didn’t remove the endpoint in this PR because it may still be referenced by the UI , and I wanted to keep the fix minimal and safe
i agree for
removing is the best option lets me check if remove this endpoint
code is not gone break
let me first verify it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

MainProcess] secondary:7e4c9aa35c4348ea9d2282425d939051@c6c439d5bd54 ready.
augur-1 | 2026-01-12 02:39:27 c6c439d5bd54 augur.api.server[121] ERROR Exception on /repos/views/repo/1 [GET]
augur-1 | Traceback (most recent call last):
augur-1 | File "/augur/.venv/lib/python3.11/site-packages/flask/app.py", line 2073, in wsgi_app
augur-1 | response = self.full_dispatch_request()
augur-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
augur-1 | File "/augur/.venv/lib/python3.11/site-packages/flask/app.py", line 1518, in full_dispatch_request
augur-1 | rv = self.handle_user_exception(e)
augur-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
augur-1 | File "/augur/.venv/lib/python3.11/site-packages/flask_cors/extension.py", line 178, in wrapped_function
augur-1 | return cors_after_request(app.make_response(f(*args, **kwargs)))
augur-1 | ^^^^^^^^^^^^^^^^^^
augur-1 | File "/augur/.venv/lib/python3.11/site-packages/flask/app.py", line 1516, in full_dispatch_request
augur-1 | rv = self.dispatch_request()
augur-1 | ^^^^^^^^^^^^^^^^^^^^^^^
augur-1 | File "/augur/.venv/lib/python3.11/site-packages/flask/app.py", line 1502, in dispatch_request
augur-1 | return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
augur-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
augur-1 | File "/augur/augur/api/view/routes.py", line 226, in repo_repo_view
augur-1 | return render_module("repo-info", title="Repo", repo=repo, repo_id=id)
augur-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
augur-1 | File "/augur/augur/api/view/utils.py", line 224, in render_module
augur-1 | return render_template('index.j2', **args)
augur-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
augur-1 | File "/augur/.venv/lib/python3.11/site-packages/flask/templating.py", line 147, in render_template
augur-1 | return _render(
augur-1 | ^^^^^^^^
augur-1 | File "/augur/.venv/lib/python3.11/site-packages/flask/templating.py", line 128, in _render
augur-1 | rv = template.render(context)
augur-1 | ^^^^^^^^^^^^^^^^^^^^^^^^
augur-1 | File "/augur/.venv/lib/python3.11/site-packages/jinja2/environment.py", line 1291, in render
augur-1 | self.environment.handle_exception()
augur-1 | File "/augur/.venv/lib/python3.11/site-packages/jinja2/environment.py", line 925, in handle_exception
augur-1 | raise rewrite_traceback_stack(source=source)
augur-1 | File "/augur/augur/templates/index.j2", line 44, in top-level template code
augur-1 | {% include '%s.j2' % body ignore missing %}
augur-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
augur-1 | File "/augur/augur/templates/repo-info.j2", line 23, in top-level template code
augur-1 | $.getJSON("{{ url_for('wait_for_report_request', id=repo_id) }}", function(image_data) {
augur-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^
augur-1 | File "/augur/.venv/lib/python3.11/site-packages/flask/helpers.py", line 338, in url_for
augur-1 | return appctx.app.handle_url_build_error(error, endpoint, values)
augur-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
augur-1 | File "/augur/.venv/lib/python3.11/site-packages/flask/helpers.py", line 325, in url_for
augur-1 | rv = url_adapter.build(
augur-1 | ^^^^^^^^^^^^^^^^^^
augur-1 | File "/augur/.venv/lib/python3.11/site-packages/werkzeug/routing.py", line 2315, in build
augur-1 | raise BuildError(endpoint, values, method, self)
augur-1 | werkzeug.routing.BuildError: Could not build url for endpoint 'wait_for_report_request' with values ['id']. Did you mean 'repo_pull_requests_new' instead?
augur-keyman-1 | 2026-01-12 02:39:49,275 - KeyOrchestrator - INFO - ACK; for: 1
augur-keyman-1 | 2026-01-12 02:39:49,276 - KeyOrchestrator - INFO - ACK; for: 1

v View in Docker Desktop o View Config w Enable Watch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see man
if remove the backend endpoint but
the frontend call this
flask give error if it is not present

so what do you think

Copy link
Contributor

@guptapratykshh guptapratykshh Jan 12, 2026

Choose a reason for hiding this comment

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

I recommend updating endpoint logic to return 404 error when report ID is not found.

Comment on lines -237 to -238
requestReports(id)
return jsonify(report_requests[id])
Copy link
Contributor

Choose a reason for hiding this comment

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

can be updated like this -

    if id in report_requests:
        return jsonify(report_requests[id])
    
    return jsonify({
        "error": "Report request not found",
        "report_id": id
    }), 404

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank for suggestion!That makes sense if report generation is still supported.
however as far i know that this he report generation pipeline(like requestReport) has been remove entrity
nothing populate report_requests
that why i changed minimal change so that fromted not get break
Let’s wait for @MoralCode to confirm, since I believe they were involved in removing the report pipeline.

@iGufrankhan
Copy link
Contributor Author

@MoralCode

my recommendation like if you want me to complete removal of this pipeline

then
i have to remove api backend end point and also from the frontend api which is used in templated

backend+frontend removal
no useless api no silent features

second is my approach which we are currently
like return empty
this avoid crashs but keep the useless api
might be misleading in the future

also can you provide the context that why this api removed
i think this removed beacuse project have more efficient sotiuon for this
if yes can you please tell me so that i can think in broader ways

@guptapratykshh
Copy link
Contributor

could you confirm if there is any active use case for this report generation feature? If not, I did support full removal one.

@MoralCode MoralCode added this to the v0.92.0 Release milestone Jan 20, 2026
@sgoggins sgoggins added the add-feature Adds new features label Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-feature Adds new features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NameError: requestReports is not defined in /requests/report/wait/<id> endpoint

4 participants