annie.core.bugreport¶
Bug reports from the Log tab: what is sent, where to, and how often (service).
The Log tab’s Report button emails an error to Annie’s maintainer. Annie cannot send mail itself, so the report goes to a form-to-email service (Web3Forms) over HTTPS, from the user’s browser, where Annie’s UI runs. The service’s access key decides the recipient, so no email address is stored here; the key is public by design (it can only deliver to that one inbox).
Before anything is sent, the user sees the exact text (build_report()) and may add a
note. Each error can be reported once, and at most MAX_REPORTS_PER_HOUR reports
leave one Annie per hour, so a crash loop cannot flood the inbox.
Attributes¶
The email subject of every report. |
|
Where reports are posted (JSON); the service emails them to the maintainer. |
|
The Web3Forms access key bound to the maintainer's inbox (public by design). |
|
How many reports one Annie process sends per hour at most. |
Functions¶
|
The access key in use: |
|
Whether reports can be sent (an access key is configured); see |
|
The plain text that is sent, exactly as the user previews it. |
|
The JSON body the form-to-email service expects ( |
|
Whether the error with log sequence number |
|
Whether another report fits within |
|
Remember that the error |
|
Forget sent reports (for tests). |
Module Contents¶
- annie.core.bugreport.REPORT_SUBJECT = 'Annie bug report'¶
The email subject of every report.
- annie.core.bugreport.REPORT_URL = 'https://api.web3forms.com/submit'¶
Where reports are posted (JSON); the service emails them to the maintainer.
- annie.core.bugreport.ACCESS_KEY = '2ac1f9d9-3a01-4c94-a74c-87c623e9717f'¶
The Web3Forms access key bound to the maintainer’s inbox (public by design).
It can only deliver to that inbox; if it is ever abused, reset it on web3forms.com and ship the new one in a release.
ANNIE_REPORT_KEYin the environment overrides it (e.g. to test with another inbox); an empty key turns reporting off.
- annie.core.bugreport.MAX_REPORTS_PER_HOUR = 5¶
How many reports one Annie process sends per hour at most.
- annie.core.bugreport.access_key(environ: collections.abc.Mapping[str, str] | None = None, built_in: str | None = None) str[source]¶
The access key in use:
ANNIE_REPORT_KEYif set, else the built-in key.- Parameters:
environ – The environment to read (default: the process environment).
built_in – The key shipped with this release (default
ACCESS_KEY).
- annie.core.bugreport.reporting_available(environ: collections.abc.Mapping[str, str] | None = None, built_in: str | None = None) bool[source]¶
Whether reports can be sent (an access key is configured); see
access_key().
- annie.core.bugreport.build_report(event: annie.core.logbook.LogEvent, note: str, *, version: str) str[source]¶
The plain text that is sent, exactly as the user previews it.
- Parameters:
event – The logged error being reported.
note – What the user was doing (optional; may be empty).
version – The running Annie version.
- Returns:
the note, the error with its full details, and where it happened (Annie, Python and OS versions). Nothing else from the PC is included.
- Return type:
The report
- annie.core.bugreport.payload(text: str, key: str | None = None) dict[str, str][source]¶
The JSON body the form-to-email service expects (
keydefaults to the key in use).
- annie.core.bugreport.already_sent(seq: int) bool[source]¶
Whether the error with log sequence number
seqwas reported already.
- annie.core.bugreport.can_send(now: float | None = None) bool[source]¶
Whether another report fits within
MAX_REPORTS_PER_HOUR.