fix(wavey-gist): use new files-snapshot payload for create endpoint - #326
Merged
Conversation
Wavey Gist's create endpoint now rejects the legacy
{title, markdown} fields with HTTP 400. Switch to the
files-snapshot format documented at https://gist.wavey.info/llms.txt:
{ title, files: { README.md: { content: ... } } }
README.md is picked as the primary file by the API, so the
rendered page opens with our content. response.raise_for_status()
turns the API's 400 into a requests.HTTPError; the existing
try/except already swallowed it and the caller fell through to
"Couldn't post full report". The bug was invisible until the
silent failure showed up in production alerts.
Live-validated against the production WAVEY_GIST_API_KEY
(Status 201, gist renders with title and primary README.md).
Tests:
- test_successful_upload: assert legacy 'markdown' field is gone
and content is now in files[README.md].content
- test_no_title_sends_raw_content: reworked to match
- test_http_error_returns_empty: new, covers the 400-on-legacy-
payload failure mode that caused this incident
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.
Summary
utils/wavey_gist.upload_to_gistwas posting the legacy payload shape ({title, markdown}) to Wavey Gist. The API now rejects unknown fields with HTTP 400:raise_for_status()turned the 400 intorequests.HTTPError, which the existingtry/except (requests.RequestException, ValueError)swallowed. The caller (format_explanation_lineinutils/llm/ai_explainer.py) then fell through to⚠️ Couldn't post full reportin the Telegram message. The Telegram summary still shipped — only the linked detail was lost.This is the same payload that powers every AI report link in production (e.g. timelock alerts, governance-proposal walkthroughs). Whenever an explanation had a
detaillong enough to be sent to gist, the team got the warning instead of a working link.Reproduction (against the prod
WAVEY_GIST_API_KEY)Fix
Switch the create payload to the documented files-snapshot shape and put the report under
README.md(the API's preferred primary filename, so the rendered page opens with the content):{ "title": "AI Transaction Analysis", "files": { "README.md": { "content": "# AI Transaction Analysis\n\n..." } } }Response shape (
{url, id, primary_file, files, snapshot_sha256, ...}) is otherwise compatible — only the request body needed to change.Live-validated with the production key after the patch:
Status 201, gist renders with the correct title andREADME.mdas the primary file.Tests
test_successful_upload: assert the legacymarkdownfield is gone and the content lives atfiles[README.md].content.test_no_title_sends_raw_content: reworked to match the new shape.test_http_error_returns_empty(new): covers the exact failure mode that triggered this incident — the function must keep alerting and return""so the in-Telegram summary still ships even when gist is down or its schema changes again.All 7
test_wavey_gist.pycases pass;ruff formatandruff checkclean.Backfill
Pushed a follow-up gist for the InfiniFi LongTimelock call (tx
0xf61f9e5af62d4ec67b8b6ef71524226236e5d30acb1945531181b4e497c765f3) that surfaced this — see the[Full details]link posted in the original thread.