Repository navigation
docs(security): /health sample must filter to revisions, not claim four keys - #994
Merged
NandhaKishorM merged 1 commit intoOct 7, 2026
Merged
Conversation
…ur keys The "Confirm what actually loaded" section printed a 4-key /health payload ending in `"device":"auto"`; laya/serve.py's health() returns seven keys, and `"auto"` is what LAYA_DEVICE defaults to, not a value the handler emits. NandhaKishorM#811 pinned docs/http-api.md to the handler's own return dict; this covers the sibling page the same way. The doc now filters to `.revisions` with jq and cross-references http-api.md for the full shape; tests/test_serve.py accepts either a filtered curl or a raw sample that names every health() key.
Owner
|
Merged in 0.3.29. The security page's |
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.
What
docs/security.md's "Confirm what actually loaded" section showscurl -s localhost:8000/healthfollowed by a four-key JSON comment ending in
"device":"auto". The handler atlaya/serve.py:667-674returns seven keys (status, loaded, revisions, device, device_is_preference, checkpoint_devices, cpu_fallbacks), and"auto"is what theLAYA_DEVICEenvironment variabledefaults to -- not a value the handler emits. #811 already fixed the sibling page,
docs/http-api.md,and pinned its sample to the handler's
returndict. This PR applies the same discipline todocs/security.mdand adds a matching gate.The doc now filters to
.revisionswithjq, which is what that section is actually about:Why
A reader following the old snippet to write their own healthcheck would find three fields silently
missing from their parser --
device_is_preference,checkpoint_devices, andcpu_fallbacksallcarry the "where the work is really running" signal that #574 and the device-fact reporting added.
"device":"auto"is worse than merely stale: the handler never returns"auto", so a probe thatasserted
body["device"] != "auto"as a "config vs measurement" check would go red on every realserver.
docs/http-api.md:70-73already documents this contract and the gate attests/test_serve.py::test_http_api_page_documents_exactly_the_health_fieldsenforces it there.docs/security.mdwas the one page that still quoted the pre-#574 shape.The filter, not a longer literal, is the fix because the section is about revisions. Showing a
seven-key blob to introduce one field buries the point; showing what
jqextracts keeps thesnippet useful. The gate accepts either shape: a curl line that pipes through a filter, or a raw
sample whose JSON keys exactly match
health()'sreturndict -- read out of the source with thesame
_health_return_keys()helper #811's gate uses.How it was verified
Secret scan on the full diff (regex
api[_-]?key|secret|password|credential|bearer|sk-…|ghp_…|AKIA…|BEGIN (RSA|PRIVATE|OPENSSH)): no matches. No credentials in this diff.Deconfliction (
gh pr list --state open --limit 500 --json number,title,files):docs/security.mdhas zero open PRs.tests/test_serve.pyhas one open PR (#963, "fixdocker-compose healthcheck") but no overlapping hunks: my changes are one import line at line 12
and one test function appended after line 2842; the pre-existing tail of the file is untouched.
Checklist
main