Skip to content

cloudsec(sdk): keep resolver_ready through the chunked resolve merge#323

Merged
maximelb merged 3 commits into
masterfrom
fix/resolve-keep-readiness-signals
Jul 25, 2026
Merged

cloudsec(sdk): keep resolver_ready through the chunked resolve merge#323
maximelb merged 3 commits into
masterfrom
fix/resolve-keep-readiness-signals

Conversation

@maximelb

@maximelb maximelb commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

The bug

CloudSec._resolve_chunked (limacharlie/sdk/cloudsec.py) rebuilds the merged response from scratch:

return {"resolved": resolved, "unresolved": unresolved}

dropping resolver_ready — the flag that says whether the sensor↔cloud resolver (redis-cloudsec) is provisioned in that datacenter at all. Without it an SDK caller cannot tell "no sensor runs on a cloud asset" from "nothing resolved because the resolver isn't running here". The server added that flag precisely so the two are distinguishable; the SDK threw it away.

This matters more now that refractionPOINT/legion_graph#94 makes the same endpoint report posture verdicts only where they were actually computed — the whole surface is being made to say "unknown" out loud rather than imply a negative.

The fix

Merge it rather than drop it, pessimistically: one not-ready chunk makes the whole merged answer not-ready (a batch split across chunks is only as trustworthy as its weakest chunk). A backend that never sent the flag still gets no flag — absent, not a fabricated False.

Tests

Three new cases in tests/unit/test_sdk_cloudsec.py::TestResolution, verified failing-first on master with KeyError: 'resolver_ready':

  • the signal survives a multi-chunk merge;
  • one not-ready chunk ⇒ merged resolver_ready is False;
  • a backend that sends no flag ⇒ output unchanged, no invented key.

Verified

  • python3 -m pytest tests/unit3676 passed, 6 skipped.
  • The CLI (limacharlie/commands/cloudsec.py) _outputs whatever this returns, so the flag now reaches CLI users too; no CLI change needed.

Not verified

  • Integration tests need live credentials; not run. Not exercised against a live gateway.

Related: refractionPOINT/legion_graph#94.

…hunked resolve merge

_resolve_chunked rebuilt the response as {resolved, unresolved}, discarding
resolver_ready — and, once legion_graph #94 lands, verdicts_available. Those
flags are how an SDK caller distinguishes a real negative from an unevaluated
one: a resolved asset with no 'exposed' key means UNKNOWN, not safe. Without
them the SDK hands back silence.

Merge them instead: resolver_ready is pessimistic (one not-ready chunk makes the
batch not-ready), verdicts_available is true if any chunk carried a verdict, and
a flag no chunk reported (older backend) stays absent rather than invented.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132oQ8tTsLG5qGvX1c4TiJu
lcbill
lcbill previously approved these changes Jul 25, 2026
_resolve_chunked rebuilt the response as {resolved, unresolved}, discarding
resolver_ready — the flag that says whether the resolver is provisioned in that
datacenter at all. Without it a caller cannot tell 'no sensor runs on a cloud
asset' from 'nothing resolved because redis-cloudsec is not there'.

Merge it instead, pessimistically: one not-ready chunk makes the whole batch
not-ready. A backend that never sent the flag still gets no flag — absent, not
a fabricated False.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132oQ8tTsLG5qGvX1c4TiJu
lcbill
lcbill previously approved these changes Jul 25, 2026
@maximelb maximelb changed the title cloudsec(sdk): keep resolver_ready / verdicts_available through the chunked resolve merge cloudsec(sdk): keep resolver_ready through the chunked resolve merge Jul 25, 2026
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132oQ8tTsLG5qGvX1c4TiJu
@maximelb
maximelb merged commit e17eb1c into master Jul 25, 2026
6 checks passed
@maximelb
maximelb deleted the fix/resolve-keep-readiness-signals branch July 25, 2026 22: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