Repository navigation
Conversation
…ault pack install Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/lc-review |
|
Self-review (adversarial pass over the diff)
|
There was a problem hiding this comment.
AI Code Review Summary
Found 1 medium issue in install-defaults --update/--force: the replacement record drops the stored ui_actions metadata.
General Feedback
- test-time-budget: no check run was found for this commit. The check is not required on
master(branch protection and rulesets list no required checks), and this PR does not touch whatever would create it. test_cli_host_posture.py::test_install_defaults_arguments_and_failure_exitandtest_sweep_tagsdo not assertexit_code == 0on the success runs. If the command crashes after calling the mock, theassert_called_withchecks still pass. Low priority._CREATE_ONLY_ETAGdepends on server behaviour (the hive ignores an etag when no record exists). The PR only tests this with mocks.sdk/investigation.pyalready relies on the same convention, so this is not flagged. But if the server ever rejected that etag, every fresh install would report all rules asskipped("created while installing") with exit code 0.
Blast radius
- Adding
host_posture_ruletoConfigs.ALL_HIVESchangessync pull --allandsync push --allfor every org. If you runsync push --all --forcewith a config file pulled before this change (nohost_posture_rulekey), it can now remove every Host Posture rule in the org, including installed default-pack rules. Earlier hive additions toALL_HIVESworked the same way, but this is worth a line in the CHANGELOG. hive list-types, thehivehelp text, the discoveryPROFILESand the lazy-load command map all gain new entries. Tools that snapshot these outputs will see the change.- New public SDK surface:
limacharlie.sdk.host_posture.HostPosture,record_digest, and the tag and comment conventions (lc:default-pack,lc:pack-sha256:). Other clients have to keep the digest scheme byte-compatible (sorted keys, compact separators,ensure_ascii=False, first 32 hex characters). Otherwise--updatewill treat pack rules they write as edited.
This review was generated automatically by Claude Code.
… note Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-reviewed at d97aa0f. The earlier ui_actions finding is fixed: _install_one now carries existing.ui_actions into the replacement record, and test_update_replaces_unedited_older_rule_keeping_org_state asserts it. The success runs in test_sweep_tags and test_install_defaults_arguments_and_failure_exit now assert exit_code == 0. I found no new high or medium issues.
General Feedback
- test-time-budget: no check run exists for this commit. Neither branch protection nor rulesets on
masterrequire the check, and this PR does not touch anything that creates it. - Low: the
host-posture.install-defaultsexplain text (commands/host_posture.pylines 184-185) still lists only "Enabled state, expiry, other tags and your own comment" as kept. The SDK docstring now also listsui_actions. Add it to the help text so the two match. - Low: the tests cover
_CREATE_ONLY_ETAG(create-only writes) only with mocks. If the server ever rejected an unknown etag on a missing record, a fresh install would report every rule asskippedand exit 0. This is the same convention as existing SDK code, so I am not flagging it.
Blast radius
Configs.ALL_HIVESnow includeshost_posture_rule. Sosync pull --allandsync push --allnow cover this hive for every org. A forcedsync push --allof a config file pulled before this change has nohost_posture_rulekey and could remove the org's Host Posture rules. The CHANGELOG now says so.hive list-types, the hive help text, the discoveryPROFILESand the lazy-load command map all gain new entries. Tools that snapshot these outputs will see the change.- New public SDK surface:
limacharlie.sdk.host_posture.HostPostureandrecord_digest, plus thelc:default-packandlc:pack-sha256:tag conventions. Any other client that installs the pack must compute the same digest (sorted keys, compact separators,ensure_ascii=False, first 32 hex characters). Otherwise--updatetreats its records as edited.
This review was generated automatically by Claude Code.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-reviewed at 330ad72. This commit only changes text: the install-defaults help and doc/cli/host-posture.md now list ui_actions as kept metadata. That fixes the Low note from the last review. The help, the docs and the SDK docstring now match the code (_install_one passes ui_actions=existing.ui_actions). I found no high or medium issues.
General Feedback
- test-time-budget: no check run exists for this commit. Neither branch protection nor rulesets on
masterrequire the check, and this PR does not touch anything that creates it. - Low, carried over and not blocking: the tests cover the create-only etag (
_CREATE_ONLY_ETAG) only with mocks. If the server ever rejected an unknown etag on a missing record, a fresh install would report every rule asskippedand still exit 0. Existing SDK code relies on the same convention.
Blast radius
Configs.ALL_HIVESnow includeshost_posture_rule, sosync pull --allandsync push --allnow cover this hive. A forcedsync push --allof a config file pulled before this change could remove the org's Host Posture rules. The CHANGELOG notes this.hive list-types, the hive help text, the discoveryPROFILESand the lazy-load command map all gain entries. Tools that snapshot these outputs will see the change.- New public SDK surface:
limacharlie.sdk.host_posture.HostPosture,record_digest, and thelc:default-packandlc:pack-sha256:tag conventions. Any other client that installs the pack must compute the same digest, or--updatewill treat its records as edited.
This review was generated automatically by Claude Code.
…sion's digest, report state_now on conflicts Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Update for the revised pack contract (head after this push).
|
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-reviewed at 2296759 (the revised pack contract, where pack_status decides each rule's state). Found 1 medium issue: --update can overwrite a rule that was edited after pack_status was read.
General Feedback
- test-time-budget: no check run exists for this commit. Earlier reviews of this PR found that
masterdoes not require the check, and this PR does not touch anything that creates it. - Low, carried over: the tests cover the create-only etag (
_CREATE_ONLY_ETAG) only with mocks. Existing SDK code relies on the same convention. - The earlier
ui_actionsfinding is still fixed in this version (host_posture.pyline 364, asserted intest_update_replaces_keeping_org_state).
Blast radius
Configs.ALL_HIVESnow includeshost_posture_rule, sosync pull --allandsync push --allnow cover this hive. A forcedsync push --allof a config file pulled before this change could remove the org's Host Posture rules. The CHANGELOG notes this.hive list-types, the hive help text, the discoveryPROFILESand the lazy-load command map all gain entries. Tools that snapshot these outputs will see the change.- New public SDK surface:
limacharlie.sdk.host_posture.HostPosture(includingpack_status), and thelc:default-pack/lc:pack-sha256:tag conventions.record_digestfrom earlier commits is gone, so nothing outside this PR could depend on it yet.install-defaultsnow needs the extension to support thepack_statusaction. With an older extension build, the whole command fails before it writes anything.
This review was generated automatically by Claude Code.
…eplacing it Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-reviewed at 3830d0c. The race from the last review is fixed. After hive.get, _install_one reads pack_status again and writes only if the state has not changed. The write still uses the etag from that get. An edit before the get shows up in the new state, and an edit after it fails the etag check. If the second read fails, state_now is None and the rule is skipped, so the code fails safe. Three new tests cover this: an edit between the reads, a recheck that fails, and --force also rechecking. Each one asserts that hive.set is not called. I found no high or medium issues.
General Feedback
- Low: each
update_available/edited/org_newerrule that reaches the write path now callspack_statusonce more.--dry-rundoes this too. Each call returns the status of every rule. A full--updateof N rules therefore makes N+1 extension requests and moves O(N²) status data. That is fine for a pack of tens of rules, but it will get slower as the pack grows. Apack_statusfilter by id would keep each recheck small, if the extension can add one. - Low: line 185 of
commands/host_posture.pyis now much longer than the lines around it in the explain text, so the help output wraps unevenly. - test-time-budget: no check run exists for this commit. Neither branch protection nor rulesets on
masterrequire the check, and this PR does not touch anything that creates it. - Low, carried over: the tests cover
_CREATE_ONLY_ETAGonly with mocks.
Blast radius
Configs.ALL_HIVESnow includeshost_posture_rule, sosync pull --allandsync push --allcover this hive. A forcedsync push --allof a config file pulled before this change could remove the org's Host Posture rules. The CHANGELOG notes this.hive list-types, the hive help text, the discoveryPROFILESand the lazy-load command map all gain entries.- New public SDK surface:
limacharlie.sdk.host_posture.HostPostureand thelc:default-pack/lc:pack-sha256:tag conventions.install-defaultsneeds an extension build that supportspack_statusand returnsdigestindefault_pack. With an older build, the command fails before it writes anything, or it fails every rule.
This review was generated automatically by Claude Code.
LimaCharlie Cloud Security — code scanNo new code findings were introduced by this pull request. This check reports and never fails: no Scanned This comment is updated in place on every push to this pull request. |
|
Held as draft on purpose: |
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-reviewed at 3830d0c. This is the same commit as the last review, and there are no new commits. I read all the changed files again: the SDK, the commands, sync, configs, hive, discovery, the cli map, the docs and the tests. I found no high or medium issues.
The race found earlier is still fixed. _install_one reads the record with hive.get first. It then reads pack_status again (_state_now) and writes only if the state has not changed. The write uses the etag from that get. If the second read fails, state_now is None and the rule is skipped, so the code fails safe.
General Feedback
- Low (still open): every rule that reaches the write path (
update_available,editedororg_newer) triggers one more fullpack_statuscall, and--dry-rundoes this too. For N rules, that is N+1 extension requests and O(N²) status data. Apack_statusfilter by id would keep each recheck small. - Low (still open):
commands/host_posture.pyline 185 is much longer than the lines around it in the explain text, so the help output wraps unevenly. - Low (still open): the create-only etag (
_CREATE_ONLY_ETAG) is tested only with mocks. Existing SDK code relies on the same convention. - test-time-budget: no check run was found for this commit. Neither branch protection nor rulesets on
masterrequire the check, and this PR does not change anything that creates it.
Blast radius
Configs.ALL_HIVESnow includeshost_posture_rule, sosync pull --allandsync push --allnow cover this hive. A forcedsync push --allof a config file pulled before this change has nohost_posture_rulekey, so it could remove the org's Host Posture rules. The CHANGELOG notes this, and the author is holding the release until the hive is live.hive list-types, the hive help text, the discoveryPROFILESand the lazy-load command map all gain entries.- New public SDK surface:
limacharlie.sdk.host_posture.HostPostureand thelc:default-packandlc:pack-sha256:tag conventions.install-defaultsneeds an extension that supportspack_statusand returnsdigestfromdefault_pack. With an older extension, the command either fails before it writes anything or fails every rule.
This review was generated automatically by Claude Code.
Summary
Adds the
limacharlie host-posturecommand group for the Host Posture extension, and thehost_posture_rulehive it reads.rules list|get|set|delete|enable|disable|tag: thehost_posture_rulehive (record name = rule id). The server validates every record; the CLI does not.install-defaults: fetchesdefault_packfrom the extension and writes the records with the caller's own permissions. The extension decides every rule's fate (pack_status:new,current,update_available,edited,org_newer); the CLI computes no digest.new: created create-only, enabled (--disabledfor disabled), taggedlc:pack-sha256:<digest>with the digest exactly asdefault_packreturned it.update_available: replaced only with--update; etag-conditional; enabled state, expiry, other tags,ui_actionsand the org's own comment are kept.edited(including a record with no digest tag) andorg_newer: replaced only with--force(which implies--update).pack_statusis read again, so the entry reportsstate_now.--id,--disabled,--dry-run. Exit code 1 when a write failed.scan --sid,sweep [--tag],status, andresults summary|hosts|host|rules|rule-hosts|standards(server-side filters and paging).host_posture_ruleadded tohive list-types,sync pull/push(--hive-host-posture-rule,--all) andConfigs.ALL_HIVES.limacharlie.sdk.host_posture.HostPosture.host_posture.setandsensor.task; deleting needshost_posture.set. Documented in the command help.cli.pycommand map,discovery.pyPROFILES,doc/cli/host-posture.md,doc/cli/*and CHANGELOG updated.Notes
default_pack,pack_status,query_*,scan,sweep,status) are exercised through mocks here, not against a live extension.Test plan
pytest tests/unit/ tests/microbenchmarks/: 6294 passed (151 skipped, as before this change)tests/unit/test_sdk_host_posture.py(state matrix, conflicts, partial failure),tests/unit/test_cli_host_posture.py, sync round trip, command map and discovery lints🤖 Generated with Claude Code