Skip to content

Add API.md documenting all JS API endpoints#24

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/errorssetup-local-dev-and-populate-db
Draft

Add API.md documenting all JS API endpoints#24
Copilot wants to merge 4 commits into
mainfrom
copilot/errorssetup-local-dev-and-populate-db

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 26, 2026

Documents every REST API endpoint called from JavaScript (both .js files and inline <script> blocks in templates), listing the source location, calling function, HTTP method, and parameters.

Endpoints covered (15 total)

  • most_common_problems.js/api/1.0/most-common-problems/, /api/1.0/create-bug-report/, /api/1.0/package-version-is-most-recent/, /api/1.0/release-package-version-pockets/, /api/1.0/reports-state/, /api/1.0/binary-package-versions/, /api/1.0/system-image-versions/
  • mean_time_between_failures.js/api/1.0/average-crashes/
  • retracers.js/api/1.0/retracers-average-processing-time/, /api/1.0/retracers-results/, /api/1.0/instances-count/
  • bucket.html/api/1.0/average-instances/, /api/1.0/versions, /api/1.0/instances, /api/1.0/create-bug-report/
  • user.html/api/1.0/reports-for-system

Copilot AI added 3 commits May 26, 2026 20:23
The instance API endpoint (/api/1.0/instance/) uses APIAuthentication
which references config.api_keys, but this attribute was not defined in
the config module, causing an AttributeError crash.

JS usage: Not called directly from JavaScript in the project.
The endpoint is used by external API consumers with API key auth.

Curl test: curl http://127.0.0.1:8000/api/1.0/instance/?format=json&id=<oopsid>
Before fix: 500 AttributeError: module 'errortracker.config' has no attribute 'api_keys'
After fix: 401 Unauthorized (expected for unauthenticated requests)
…t response

The is_valid_source_version() function in launchpad.py called .keys()
on the return value of json_request(), which returns an empty string ""
when the Launchpad API is unreachable. Calling .keys() on a string
causes an AttributeError crash.

JS usage: Not called directly from JavaScript. Used by external consumers
to find new crash buckets between package versions.

Curl test: curl 'http://127.0.0.1:8000/api/1.0/package-version-new-buckets/?format=json&package=pkg&previous_version=1.0&new_version=2.0'
Before fix: 500 AttributeError: 'str' object has no attribute 'keys'
After fix: 404 NotFound (expected when LP API is unreachable)
…rison

The config.lp_use_staging is set to True (boolean) but was compared
with "True" (string), which always evaluates to False. This caused
all Launchpad API requests to use production URLs instead of staging
URLs when staging was configured.

This affects multiple API endpoints that query Launchpad:
- binary-package-versions (JS: most_common_problems.js calls /api/1.0/binary-package-versions/)
- most-common-problems (JS: most_common_problems.js calls /api/1.0/most-common-problems/)
- versions (JS: bucket page uses /api/1.0/versions/)
- reports-state (JS: most_common_problems.js POSTs to /api/1.0/reports-state/)
- package-version-is-most-recent (JS: most_common_problems.js POSTs)
- release-package-version-pockets (JS: most_common_problems.js POSTs)
- package-rate-of-crashes
- package-version-new-buckets
- create-bug-report
Copilot AI changed the title Fix broken API endpoints in the errors app Fix three crashes in errors app API endpoints May 26, 2026
Copilot finished work on behalf of Hyask May 26, 2026 20:26
Copilot AI requested a review from Hyask May 26, 2026 20:26
Copilot AI changed the title Fix three crashes in errors app API endpoints Add API.md documenting all JS API endpoints May 26, 2026
Copilot finished work on behalf of Hyask May 26, 2026 20:49
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.

2 participants