Repository navigation
Investigation Engine CLI and SDK (limacharlie investigate) - #455
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
No high or medium issues found. There are 4 low-priority findings, posted inline.
General Feedback
- Create-only etag is not tested against a real server.
save_templatecreates new records with the sentinel etagcreate-only: the record must not exist. No other code in this repo uses a sentinel etag to create a record. The unit tests mockHive, and the PR body says no live test was run. The code relies on the hive accepting a write that carries an etag for a record that does not exist yet. If the hive rejects it, everytemplates saveof a new name fails, and so does everyinstall-defaultsentry. Please check this against a real hive before the PR leaves draft. - No retry guard on hive writes.
hive.setinsave_template/promote_templateuses the client's defaultretry_gateway_timeout=True. If a 504 arrives after the write was applied, the retry carries a stale or create-only etag and fails. The record is then saved, but the command reports an error. - test-time-budget: No
test-time-budgetcheck run was found for this commit. The base branchmasterdoes not require the check: branch protection and rulesets list no required checks. This PR does not touch any workflow.
Blast Radius
errors.error_from_status_codenow setsresponse_bodyon the 401/403/404/422/429 typed errors, andClient.requestsets it onRateLimitError. The attribute is new on those classes. They do not becomeApiErrorsubclasses, soisinstance(..., ApiError)checks,_lc_error_codeandis_record_not_foundbehave as before. Code that calledhasattr(e, 'response_body')to detect anApiErrorwould now also match these errors. No such caller exists in this repo.- New top-level
investigateCLI group, lazy-loaded via_COMMAND_MODULE_MAP. There is a newinvestigation_enginediscovery profile and a new help topic. These add to the command surface without changing existing commands. - The new SDK class
limacharlie.sdk.investigation.Investigationwrites to theinvestigation_planhive through the existingHiveclass.
This review was generated automatically by Claude Code.
YAML 1.2 number handling for template sources, iter_actions cursor guard, JSON-lines stream for runs start --follow, landed-write guard for template saves, hive permission hint for template records. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Self-review (adversarial pass over the full diff)Checked each CLI call against the routes the API gateway actually serves (method, path, query and body names, permissions) and against the engine's documented request shapes; only routed endpoints are called. Route and parameter correctness
Draft-by-default
Errors, secrets, paging, termination
Known limits (not bugs)
|
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-review of cad3f10. The four earlier findings are fixed. I found no high or medium issues. One new low-priority note is inline.
General Feedback
- Fixes I checked:
- The YAML 1.2 int/float resolvers and the int constructor are correct for
012,1_000,10:30,0x1f,0o17,1e3and.inf. iter_actionshas the same cursor-advance guard asiter_runs, andactions list --allnow uses it.runs start --followin a structured format now writes JSON lines.- A landed-write guard is added in
save_template.
- The YAML 1.2 int/float resolvers and the int constructor are correct for
- Create-only etag: the author says the hive accepts any etag when no record exists. A live check is still pending before the PR leaves draft. I am noting it, not blocking on it.
- I could not run the tests in this environment because there is no Python interpreter. The new tests call the real SDK and CLI code, with the HTTP client and
Hivemocked. That is mocking, not simulation. - test-time-budget: no run was found for this commit.
masterrequires no status checks, either in branch protection or in rulesets.
Blast Radius
errors.error_from_status_codeandClient.requestnow setresponse_bodyon the typed 401/403/404/422/429 errors. These errors do not change class, so existingisinstancechecks and the hive helpers (is_record_not_found,is_permission_denied) behave as before.- The rest of the PR is additive:
- the
investigateCLI group, which is lazy-loaded; - the
limacharlie.sdk.investigationmodule; - a discovery profile and a help topic;
- writes to the
investigation_planhive through the existingHiveclass.
- the
This review was generated automatically by Claude Code.
…d tags Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-review of 8fc2401. This commit changes only the landed-write guard in save_template. I found no high or medium issues and no new findings.
General Feedback
- The guard now marks a failed write as saved only if three things match what was sent: the stored
data, thecommentand thetags. So whenhive.setfails on an overwrite, a lost--commentor--tagis now reported as an error. The new test,test_a_failed_overwrite_does_not_pass_as_saved_when_the_comment_was_lost, calls the realsave_templatewithHivemocked. That is mocking, not simulation. - Still open from earlier rounds, as notes only (not blocking):
- The create-only etag has not been tried against a live hive.
hive.setinpromote_templatestill uses the client's default gateway-timeout retry.
- test-time-budget: I found no run for this commit.
masterrequires no status checks, in either branch protection or rulesets.
Blast Radius
- This commit only changes
limacharlie/sdk/investigation.py(save_templateerror path) and its unit test. It does not touch existing code. - The PR as a whole is unchanged from the last review:
response_bodyis now set on the typed 401/403/404/422/429 errors. Their classes do not change.- The other changes are additive: the lazy-loaded
investigateCLI group, thelimacharlie.sdk.investigationmodule, a discovery profile, a help topic, and writes to theinvestigation_planhive.
This review was generated automatically by Claude Code.
… every failure, run mode docs, example check - wave and --samples-file are read with YAML 1.2 scalar rules (off/yes stay text, dates stay strings) - unreadable or malformed input files and every Hive/API failure render as structured errors - help and docs: the run mode default is full; triage is cheaper - docs wave example selects the real ioc.prevalence field (seen); a test checks every documented wave against a recorded operator catalogue Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-review of 4c42051. This commit changes four things:
- Wave and
--samples-fileinputs are now parsed with YAML 1.2 scalar rules (parse_document). - Every SDK failure now prints as a structured error in machine output formats.
- Template-record hive failures are wrapped as
InvestigationError. - The run mode text is corrected, and a test checks the documented wave examples against a recorded catalogue.
I found no high or medium issues and no new inline findings.
General Feedback
- What I checked in this commit:
_template_record_errorsnow wraps everyApiErrorand keepsresponse_body, soerror_codestill carries the hive'slc_error_code. Non-ApiErrorerrors that are not permission refusals (ValidationError,NotFoundError, ...) still pass through unchanged.install_default_templatescatchesLimaCharlieError, so wrapping does not change what it does.save_templatehandles a missing record and checks whether a failed write landed. Both happen inside the wrapped function, so they see the raw hive errors as before._engine_errorsnow catches everyLimaCharlieError. Each error keeps its ownexit_code: 4 for refused inputs, 2 for auth, 1 for API errors. In table mode the error is still re-raised for the CLI's normal text handling.parse_documentturns a value JSON cannot carry into aValidationError. A recursive alias falls in that case, becausejson.dumpsraisesValueError.- Anchors and aliases are allowed in wave and sample files. A file built to expand hugely through aliases could use a lot of memory in
json.dumps. The file is the user's own local input, so this is a note only.
- New tests call the real
parse_document,save_template,promote_templateand CLI commands, withHiveand the SDK mocked. That is mocking, not simulation.test_investigation_examples.pyreads a checked-in fixture, with no network and no timing, so it should not be flaky. - Small test nit: in
test_a_coded_hive_refusal_keeps_its_lc_error_code, the firsthive.get.side_effect = ...assignment is overwritten on the next line and has no effect. - Still open from earlier rounds (notes only, not blocking):
- The create-only etag has not been tried against a live hive.
hive.setinpromote_templatestill uses the client's default gateway-timeout retry. A replayed promote with a stale etag would report a failure even though the write landed.
- test-time-budget: I found no run for this commit.
masterrequires no status checks in either branch protection or rulesets. This PR does not touch any workflow.
Blast Radius
- This commit changes only the new
investigatecommand module,limacharlie/sdk/investigation.py, docs and tests. It adds a public helper,limacharlie.sdk.investigation.parse_document. - Behaviour change for SDK users:
get_template,save_template,promote_templateanddelete_templatenow raiseInvestigationErrorfor hiveApiErrorfailures.InvestigationErroris still anApiErrorsubclass, so existingexcept ApiErrorhandlers still catch it. - In the CLI, input errors on
investigatecommands now exit with 4 instead of click's usage-error code 2. - The rest of the PR is unchanged from the last review:
response_bodyis set on the typed 401/403/404/422/429 errors.- The
investigategroup is lazy-loaded. - Templates are written to the
investigation_planhive.
This review was generated automatically by Claude Code.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Self-review of the fixes (4c42051 + test nit): (1) wave/sample files now go through the same YAML 1.2 loader as templates, so |
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-review of 5a4302f. Since 4c42051, the only change is in tests/unit/test_sdk_investigation.py: the dead hive.get.side_effect assignment in test_a_coded_hive_refusal_keeps_its_lc_error_code is removed, as noted in the last review. The test behaves the same: hive.get returns a draft record and hive.set raises the coded 400. I found no high or medium issues and no new findings.
General Feedback
- I checked
save_template,promote_templateandinstall_default_templatesagain againstHive.set. When no tags or comment are given,Hive.setsends nousr_mtdblock. So a plain overwrite or promote does not resetenabledor drop the stored metadata. - Still open from earlier rounds. These are notes only and do not block:
- The create-only etag has not been tried against a live hive. The author says this check is on the list before the PR leaves draft.
hive.setinpromote_templatestill uses the client's default retry on a gateway timeout. If that retry replays a promote that already landed, the stale etag makes it fail. The command then reports an error even though the template is active.
- test-time-budget: no run was found for this commit.
masterrequires no status checks in branch protection or in rulesets. This PR does not touch any workflow.
Blast Radius
- This commit changes one unit test and nothing in the library.
- The PR as a whole has not changed since the last review:
- The typed 401/403/404/422/429 errors now carry
response_body. Their classes do not change. - The lazy-loaded
investigateCLI group and thelimacharlie.sdk.investigationmodule are new, along withparse_document. - Template-record failures are wrapped as
InvestigationError, which is still a subclass ofApiError. - Writes go to the
investigation_planhive through the existingHiveclass.
- The typed 401/403/404/422/429 errors now carry
This review was generated automatically by Claude Code.
- runs start --urgency is low|medium|high|critical (default derived from the alert, else medium) - --auto sends no plan (the engine refuses plan.auto for a person's run) so the engine picks the active template by applies_to; new --category/--severity/--priority/--tag carry the alert attributes it matches on - templates test --strict help: refuses overrides that would loosen the policy - runs list --trigger takes the trigger kind, --verdict also takes undecided, --started-by also matches a name - policy get --template; --case-mode and --wait help corrected Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-review of 5e20b76. This commit changes the investigate flags and help text to match the engine:
runs start --autonow sends noplan.runs starthas new--category,--severity,--priorityand--tagflags that go intotrigger.--urgencyis nowlow|medium|high|critical.--stricthas a new meaning.runs listhas new help text.policy get --templateis new.
I found no high or medium issues. There is one low-priority note, inline.
General Feedback
- The new tests call the real CLI commands and SDK methods, with the SDK or the HTTP client mocked. That is mocking, not simulation. The help-text tests check strings in click's
--helpoutput, which is deterministic, so they are not flaky. - I could not check the engine-side claims in this commit against code in this repo. These are: the engine refuses
plan.autofor a person's run, a start with no plan picks the active template byapplies_to, andtrigger.category/severity/priority/tagsare the field names the engine reads. All tests mock HTTP. Please confirm them with the live check you already plan to run before the PR leaves draft. - Still open from earlier rounds. These are notes only and do not block:
- The create-only etag has not been tried against a live hive.
hive.setinpromote_templatestill uses the client's default retry on a gateway timeout.
- test-time-budget: no run was found for this commit.
masterrequires no status checks, either in branch protection or in rulesets. This PR does not touch any workflow.
Blast Radius
- This commit changes only the new
investigatemodule,limacharlie/sdk/investigation.py, the docs, the CHANGELOG and tests. - SDK:
Investigation.get_effective_policygains an optionaltemplatekeyword. The change is additive. - CLI behaviour changes, all limited to the unreleased
investigategroup:runs start --urgency normalis no longer accepted.--autonow sends a request with noplan.
- The rest of the PR is unchanged from the last review.
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. |
…h shapes
Engine v0.1.4 lets a template's report.summary sentence be a string or
{text, when}. The SDK and CLI treat a template as an opaque mapping, so no code
change is needed; tests now pin that save, get, install-defaults and the YAML
round trip keep both shapes unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-review of 178a9fd. Since 5e20b76, this commit adds one line to doc/cli/investigation-engine.md and new unit tests in tests/unit/test_sdk_investigation.py. The tests check that a report.summary sentence written as a plain string or as {text, when} survives each path unchanged. No library code changed. I found no high or medium issues and no new findings.
General Feedback
- The new tests call the real
parse_template_source,dump_template,get_template,save_templateandinstall_default_templates, withHiveand the HTTP client mocked. That is mocking, not simulation. The expected values are fixed literals (SUMMARY,SUMMARY_SRC), not copies of the code's logic. The tests use no timing or shared state, so they should not be flaky. - The round-trip test includes the string
"yes"as a sentence. This is a good check:safe_dumpquotes it, and the YAML 1.2 loader would also keep it as text without quotes. - Still open from earlier rounds. These are notes only and do not block:
- The create-only etag has not been tried against a live hive.
hive.setinpromote_templatestill uses the client's default retry on a gateway timeout.- The engine-side claims about
triggerfields and--autostill need the live check planned before the PR leaves draft.
- test-time-budget: no run was found for this commit.
masterrequires no status checks in branch protection or in rulesets. This PR does not touch any workflow.
Blast Radius
- This commit changes only a doc line and unit tests. It has no runtime effect.
- The PR as a whole is the same as at the last review:
- The typed 401/403/404/422/429 errors now carry
response_body. Their classes do not change. - New: the lazy-loaded
investigateCLI group and thelimacharlie.sdk.investigationmodule. - Templates are written to the
investigation_planhive through the existingHiveclass.
- The typed 401/403/404/422/429 errors now carry
This review was generated automatically by Claude Code.
…L parser does Unquoted scalars under a fact's args follow gopkg.in/yaml.v3 (012, 1_000, 0o17, 1e3, timestamps), other template fields keep the author's text except the numeric and boolean ones, mapping keys are text. A fixture generated from the engine's own parser pins every edge spelling. The template dumper quotes every string the engine would read as something else, and save/promote validate text proven to read back as the stored record. NaN/Infinity are refused as invalid_input. The docs state who a run executes as when the policy names a secret identity. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-review of aef84c4. This commit replaces the YAML 1.2 loader with a port of the engine's yaml.v3 scalar rules. It also sets typing by position in the template: args are resolved like yaml.v3, a short list of fields are numbers or booleans, and everything else is text. A new dumper quotes any string the engine would read as something else, save/promote now refuse a record that does not read back the same, and NaN/Infinity are refused before anything is sent. I found no high or medium issues. There is one low-priority note, inline.
General Feedback
- Tests: the new tests call the real
parse_template_source,dump_template,parse_document,save_template,promote_templateand CLI commands. Expected values come from a checked-in fixture that the engine's parser generated, not from this code's own logic. That is real testing, not simulation. The tests use no timing, network or shared state. - Behaviour changes in this commit:
- In wave and sample files,
012,1_000and1e3are now sent as numbers. Before this commit they were sent as text. promotenow raisesValidationErrorfor any stored record with a typed value outside the known fields, for exampledescription: 5. That includes records written by earlier builds of this PR.
- In wave and sample files,
- Not checked: I could not confirm the yaml.v3 claims against the engine. The fixture is stated to come from the engine's parser, so I relied on it.
- Still open from earlier rounds (notes only, not blocking):
- The create-only etag has not been tried against a live hive.
hive.setinpromote_templatestill uses the client's default retry on a gateway timeout.- The engine-side
triggerand--autoclaims still need the planned live check.
- test-time-budget: no run was found for this commit.
masterrequires no status checks in branch protection or rulesets, and this PR does not touch any workflow.
Blast Radius
- This commit changes only the new
limacharlie/sdk/investigation.py, theinvestigatecommand module, the docs and tests. Investigation._callnow refuses non-finite floats withValidationError. This affects every engine write that has a body.dump_templateoutput now quotes more strings.templates get --yamloutput therefore differs from earlier builds of this PR.- The rest of the PR is the same as at the last review:
- The typed 401/403/404/422/429 errors now carry
response_body. Their classes do not change. - The
investigategroup is lazy-loaded. - Templates are written to the
investigation_planhive.
- The typed 401/403/404/422/429 errors now carry
This review was generated automatically by Claude Code.
…s with a generated fixture Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/lc-review |
… a server setting name from the docs Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Review round: reworded the docs line so it no longer names a server setting. |
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-review of 3cc81af. Since b0b05c8, this commit does three things:
delete_rungives a run-deletion hint for a 404 that has no engine error code.- The docs no longer name the server setting.
- Two tests are added, and the
call_countcheck that proved nothing is removed.
I found one medium issue, inline. The new hint is set on the exception after the exception text was built. So table output still shows the old "feature not enabled" hint, and the JSON error field shows both hints.
General Feedback
- The doc change resolves the earlier note about naming the server setting.
- The run-deletion 404 hint was meant to resolve the earlier
DELETE runs/{id}thread. It only works once the inline issue is fixed. Please also confirm the route in the live check you plan to run. - Tests: the new tests call the real
delete_runwith the HTTP client mocked. That is mocking, not simulation. They only assert.suggestion, so they miss what the user actually sees. Please also assertstr(ei.value)andei.value.to_dict()["error"]. - Still open from earlier rounds (notes only, not blocking):
- The create-only etag has not been tried against a live hive.
hive.setinpromote_templatestill uses the client's default retry on a gateway timeout.- The engine-side
trigger,--autoandsensor.read.*claims still need the live check.
- test-time-budget: no run was found for this commit.
masterrequires no status checks in branch protection or in rulesets, and this PR does not touch any workflow.
Blast Radius
- This commit only changes
Investigation.delete_runerror reporting, the docs and unit tests, all inside the new, unreleasedinvestigatefeature. - The rest of the PR is the same as at the last review:
- The typed 401/403/404/422/429 errors now carry
response_body. Their classes do not change. - The
investigateCLI group is lazy-loaded. - Templates are written to the
investigation_planhive.
- The typed 401/403/404/422/429 errors now carry
This review was generated automatically by Claude Code.
…carries one hint Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-review of 7834408. Since 3cc81af, this commit rebuilds the run-deletion 404 error in delete_run instead of setting exc.suggestion on the old error. It also extends the test. I found no high or medium issues and no new findings.
General Feedback
- The fix is correct.
exc.raw_messagestrips the old_DISABLED_HINTsuffix, becausesuggestionwas not changed before it was read. The newInvestigationErrorthen holds only_DELETE_ROUTE_HINT.response_body,issues,warnings, the status andexit_codeall carry over.error_codeis still None, because the body had no engine code. - The test now checks what the user sees:
str(ei.value)has exactly oneSuggestion:line, the old hint is gone, andto_dict()["error"]is the plain message. It calls the realdelete_runwith the HTTP client mocked. That is mocking, not simulation. - Still open from earlier rounds (notes only, not blocking):
- The live checks are still pending: the
DELETE runs/{id}route, the create-only etag, and the engine-sidetrigger,--autoandsensor.read.*claims. hive.setinpromote_templatestill uses the client's default retry on a gateway timeout.
- The live checks are still pending: the
- test-time-budget: no run was found for this commit.
masterrequires no status checks in branch protection or in rulesets. This PR does not touch any workflow.
Blast Radius
- This commit only changes
Investigation.delete_runerror reporting and one unit test. Both are inside the new, unreleasedinvestigatefeature. - The rest of the PR is the same as at the last review:
- The typed 401/403/404/422/429 errors now carry
response_body. Their classes do not change. - The
investigateCLI group is lazy-loaded. - Templates are written to the
investigation_planhive.
- The typed 401/403/404/422/429 errors now carry
This review was generated automatically by Claude Code.
* Preserve safe template test diagnostics in compact and tabular output Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep template test diagnostics consistent across output formats Preserve the priced subtotal, share diagnostic filtering, append CSV columns, and document the output beside templates test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Show an unknown LLM cost as blank, never as 0 A test result from a service that reports no cost object now leaves the llm_cost cell empty and prints "LLM cost: unknown", so it cannot be read as free. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-review of 4dbb801. Since 7834408 the branch has two new commits:
- 39a1891 keeps
step_diagnostics(completeness, counts, judgement) in compacttemplates testoutput. It also adds prior, decided, evidence and LLM cost columns to table/CSV rows and anLLM costsummary line. - 4dbb801 merges current master. The only conflict was in
CHANGELOG.md.
I found no high or medium issues and no new inline findings.
General Feedback
- Merge check: the PR's changes to
errors.py(response_bodyon typed errors) andclient.py(response_bodyonRateLimitError) still apply cleanly on top of master's response-compression change.Client.requeststill acceptsraw_body,content_typeandretry_gateway_timeout, whichInvestigation._calluses. The newResponseDecodeErroris anApiErrorwith no status code, so here is how the new code handles it:_wrap_errorpasses it through unchanged._template_record_errorswraps it asInvestigationError.- The landed-write guard in
save_templatereads the record back. This is the right behaviour when a write succeeded but its response could not be decoded.
- Tests: the new tests call the real
_compact_test,_test_rowsand_print_testwith fixed inputs. That is real testing, not simulation. They use no timing or shared state, so they should not be flaky. I could not run the suite here because the environment has no pytest or PyYAML. - Low (docs):
- The new CHANGELOG entry lists
runs start|get|list|events|steps|case|cancelbut leaves outruns delete. - The CHANGELOG still says wave and sample files use "YAML 1.2 scalar rules". Since aef84c4 they follow the engine's yaml.v3 rules, where
012is 10 and1_000is 1000. - In
doc/cli/investigation-engine.md, the new text breaks a paragraph across short lines and leaves a double blank line. It renders fine.
- The new CHANGELOG entry lists
- Still open from earlier rounds (notes only, not blocking):
- Live checks are still pending: the
DELETE runs/{id}route, the create-only etag, and the engine-sidetrigger,--autoandsensor.read.*claims. hive.setinpromote_templatestill uses the client's default retry on a gateway timeout.
- Live checks are still pending: the
- test-time-budget: no check run was found for this commit.
masterrequires no status checks in branch protection or rulesets, and this PR does not touch any workflow.
Blast Radius
- Compared with master, the PR changes:
errors.error_from_status_code: the typed 401/403/404/422/429 errors now carryresponse_body. Their classes do not change.Client.request:RateLimitErrornow carriesresponse_body.cli.pyanddiscovery.py: the lazy-loadedinvestigategroup, theinvestigation_engineprofile and a help topic.
- Everything else is new code:
limacharlie.sdk.investigationandlimacharlie/commands/investigate.py. It writes templates to theinvestigation_planhive through the existingHiveclass. - The
templates testoutput in 39a1891 adds new keys and columns. CSV consumers oftemplates testwill see the extra columns. The feature is unreleased.
This review was generated automatically by Claude Code.
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-review of c2d1b8d. Since 4dbb801, this commit does five things:
iter_runsanditer_actionsnow remember every cursor seen. They fail on any repeated cursor (including A→B→A) and stop at 10,000 cursors.runs start --followgets a--timeoutflag. The default is 900 seconds,0means no limit, and negative values are refused before the run starts._follow_eventsnow prints the last deliveredseqas the resume point. It does this on timeout, on Ctrl-C and on stream errors.- The CHANGELOG now lists
runs delete, and the docs mention--timeout. - The fixture descriptions and the scalar kind labels are reworded.
I found no high or medium issues. There is one low-priority note, inline.
General Feedback
- Logic checked:
- In the pagination guard, a starting
--cursoris seeded intoseen, so a cycle back to it is also caught. - The history bound is checked before the new cursor is added, which matches the test (limit 2, then 3 calls).
timeout or Nonecorrectly maps0to an unbounded follow. The{timeout:g}note can only run on the timed-out path, so it never seesNone.LimaCharlieErroris imported ininvestigate.py.
- In the pagination guard, a starting
- Tests: the new tests drive the real
iter_runs/iter_actionswith the HTTP client mocked, and the real CLI commands with the SDK mocked. That is mocking, not simulation. They use no sleeps, clocks or shared state, so they should not be flaky. - Minor (not flagged inline):
_follow_eventscatches everyLimaCharlieError, including aValidationErrorfrom a bad run id on the first poll. In that case it prints "event stream failed; resume with --after 0", which is misleading. Also, when--allhits the 10,000-cursor limit, the error says "resume with an explicit cursor" but does not say which cursor to use, and the CLI throws away the rows it already fetched. Consider putting the last cursor in the message. - Still open from earlier rounds (notes only, not blocking):
- Live checks are still pending: the
DELETE runs/{id}route, the create-only etag, and the engine-sidetrigger,--autoandsensor.read.*claims. hive.setinpromote_templatestill uses the client's default retry on a gateway timeout.
- Live checks are still pending: the
- test-time-budget: no check run was found for this commit.
masterrequires no status checks in branch protection or in rulesets. This PR does not touch any workflow.
Blast Radius
- This commit only changes the new, unreleased
investigatefeature (limacharlie/sdk/investigation.py,limacharlie/commands/investigate.py), its docs, fixtures and tests. - SDK change:
iter_runs/iter_actionsnow raiseApiErroron any repeated cursor, not only on an immediate repeat. They also raise after 10,000 pages. - CLI change:
runs starthas a new--timeoutoption. - The rest of the PR is the same as at the last review:
- The typed 401/403/404/422/429 errors now carry
response_body. Their classes do not change. - The
investigategroup is lazy-loaded. - Templates are written to the
investigation_planhive.
- The typed 401/403/404/422/429 errors now carry
This review was generated automatically by Claude Code.
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-review of 0d4a0e9. Since c2d1b8d, this commit:
- adds
tools/generate_investigation_fixtures.pyand a checked-in snapshot (investigation_compatibility_snapshot.json); - regenerates both fixtures from that snapshot, with a byte-equality test;
- makes the scalar test fail clearly on an unknown kind;
- rewrites the
_resolve_scalardocstring and adds a provenance README.
No high or medium issues. One low-priority note is inline.
General Feedback
- I checked the snapshot against the fixture. All 219 cases match, except the two collection cases (
array→sequence,object→mapping). So no recorded expectation changed. - The byte-equality test mostly checks that the generator copies the snapshot. It cannot show that the snapshot matches the engine. The README is honest about this ("does not claim a new service capture"). The real safeguard is still the refresh step from the engine's harness.
- Older harness output used kinds like
other:[]interface {}. The generator rejects those with a clear error and does not mis-map them, which is fine. When you refresh, map them toarray/objectfirst, as the README says. test_scalar_fixture_rejects_unknown_kind_clearlycalls a test method directly to check the test's own guard. It works, but it tests test code rather than the SDK. It is harmless.- Still open from earlier rounds (notes only, not blocking):
- Live checks are pending for the
DELETE runs/{id}route, the create-only etag, and the engine-sidetrigger/--auto/sensor.read.*claims. hive.setinpromote_templatestill uses the client's default retry on a gateway timeout.
- Live checks are pending for the
- test-time-budget: no check run was found for this commit.
masterrequires no status checks, in branch protection or in rulesets. This PR does not touch any workflow.
Blast Radius
- Library code: only a docstring in
limacharlie/sdk/investigation.pychanged. There is no runtime change. - New files are a dev tool under
tools/, test fixtures, and tests. None of them are imported by the package. - The rest of the PR is the same as at the last review:
- The typed 401/403/404/422/429 errors now carry
response_body. Their classes do not change. - The
investigateCLI group is lazy-loaded. - Templates are written to the
investigation_planhive.
- The typed 401/403/404/422/429 errors now carry
This review was generated automatically by Claude Code.
|
/lc-review |
There was a problem hiding this comment.
AI Code Review Summary
Re-review of ce651d5. Since 0d4a0e9, this commit only adds encoding="utf-8" to 24 read_text/write_text calls in four test files. No library code, fixture values or assertions changed. I found no high or medium issues and no new findings.
General Feedback
- I checked every changed line. Each one adds only the encoding argument. A search of the PR's investigation tests and
tools/generate_investigation_fixtures.pyfound no text I/O calls left without an explicit encoding. The two multi-linewrite_textcalls (test_cli_investigate.py lines 477 and 588) also passencoding="utf-8". - Still open from earlier rounds. These are notes only and do not block:
- Live checks are still pending for the
DELETE runs/{id}route, the create-only etag, and the engine-sidetrigger,--autoandsensor.read.*claims. hive.setinpromote_templatestill uses the client's default retry on a gateway timeout.
- Live checks are still pending for the
- test-time-budget: no check run was found for this commit.
masterrequires no status checks in branch protection or in rulesets, and this PR does not touch any workflow.
Blast Radius
- This commit changes tests only and has no runtime effect.
- The PR as a whole is the same as at the last review:
- The typed 401/403/404/422/429 errors now carry
response_body. Their classes do not change. - The
investigateCLI group (lazy-loaded) and thelimacharlie.sdk.investigationmodule are new. - Templates are written to the
investigation_planhive through the existingHiveclass.
- The typed 401/403/404/422/429 errors now carry
This review was generated automatically by Claude Code.
Adds SDK and CLI access to investigation APIs for template authoring, runs, evidence and actions. Input files and structured service errors are preserved; commands require the selected deployment's API support and the caller's permissions.
Pagination detects repeated cursors across the whole walk, including A→B→A, and raises a clear error at the 10,000-cursor history bound.
runs start --follow --timeout SECONDSdefaults to900 seconds;0 follows without a deadline, while negative values fail before starting a run. Stream errors and interruptions print the last delivered sequence forruns events RUN_ID --follow --after N; they never restart the run. CHANGELOG includes run deletion. Fixture provenance and scalar type labels use public contract terminology; all public operator/pack names, schemas and expected scalar values are preserved.Validation on this head: focused fixture/SDK/CLI/example tests622PASS. Full documented CI command
python -m pytest tests/unit/ tests/microbenchmarks/ --benchmark-disable -v --reruns 2 --reruns-delay 5 -rsPASS:6345passed,33 intentional guards,21warnings on CPython3.14.10 with both real compression.zstd and zstandard0.25.0. All93microbenchmarks execute once and pass. Guards:24no-decoder scenarios,4decoder-available scenarios,2existing docstring checks and3platform checks. Zero unavailable-codec skips; assertions/skip conditions remain intact.git diff --checkPASS.No release or tag is created. Maintainer owns final review and merge.
Fixture regeneration is reproducible:
python tools/generate_investigation_fixtures.pywrites both scalar and typed-field fixtures from a retained public compatibility-observation snapshot, independently of the SDK resolver. The provenance README documents the input format and refresh process; no new service capture or endpoint is claimed. Generation maps public array/object categories to canonical sequence/mapping. Byte-equality regeneration tests protect both outputs; the fixture consumer rejects unknown kinds clearly. Every recorded scalar expectation and public schema field is preserved. The SDK resolver docstring now describes this recorded compatibility contract accurately.Text-I/O portability follow-up: the whole PR-added Python diff was audited for read_text/write_text/open. All24 remaining implicit text calls in fixture/schema/doc reads and temporary input writes now explicitly use UTF-8; existing generator/production UTF-8 and binary I/O are unchanged. Generation tests also PASS3 under PYTHONUTF8=0 PYTHONCOERCECLOCALE=0 LC_ALL=C with UTF-8 mode0 and locale/preferred encoding ANSI_X3.4-1968 (Python default string encoding remains UTF-8). Latest focused622PASS and full documented CI selection6345PASS/33intentional guards/21warnings, both real codecs, all93microbenchmarksPASS. No assertions, fixtures or earlier behavior changed in this encoding-only commit.