Skip to content

Python: expose investigation sync and track records - #464

Draft
maximelb wants to merge 5 commits into
masterfrom
feat/investigation-sync-contract
Draft

maximelb wants to merge 5 commits into
masterfrom
feat/investigation-sync-contract

Conversation

@maximelb

@maximelb maximelb commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Add investigation_policy and investigation_plan sync selection, including --all, and expose paginated read-only get_track_record/list_reopenings SDK methods and investigate track-record/reopenings commands. Preserve native Hive wrappers, report metadata, nullable metrics, opaque cursors and integer/string counters. Code-less gateway 404s and incompatible schemas surface upgrade_required; gateway 404s preserve disabled-feature/region guidance, while coded engine errors including not_found pass through unchanged. Update discovery and user documentation.

Validation: full pytest tests/unit/ tests/microbenchmarks/ with editable development install: 6258 passed, 271 existing skips. Added both report commands to the strict CLI snapshot, removing no entries. All 33 fixture/report/CLI contract tests pass. Python compileall and git diff --check pass.

Round 2: both report methods preserve coded engine not_found and retain disabled-feature guidance on code-less gateway 404s. The gateway cannot distinguish a missing report route from an engine unavailable in the organization’s region; the diagnostic now retains that ambiguity. Strict command snapshot remains intact.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maximelb

Copy link
Copy Markdown
Contributor Author

/lc-review

@maximelb

maximelb commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated adversarial self-review (round 5, head 5ba280a): The first-install regression now sends the fixture through the real Investigation.get_track_record method and the track-record CLI in JSON and YAML formats, mocking only client.request. Each path checks a single GET to the expected endpoint, full-page equality, healthy incomplete historical coverage, zero reopened/disputed subjects, zero events in all five principal categories, and clear zero-count guards. Every existing assertion is retained. Reviewed the test boundary to confirm the CLI invokes the actual SDK rather than a mocked report method. Prior coded-error, schema, strict command snapshot, native sync, filter, cursor and resolved-policy output coverage remains intact. Full pytest tests/unit/ tests/microbenchmarks/: 6265 passed, 271 existing skips, 22 warnings. git diff --check passed. No unaddressed code findings identified.

@limacharlie-event-notifications limacharlie-event-notifications Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Code Review Summary

Found 2 issues: 1 Medium, 1 Low.

General Feedback

  • Medium (CI will fail): tests/unit/test_cli_lazy_loading_regression.py line 198 still lists the old investigate subcommands. The PR body confirms this test fails. Add "track-record" and "reopenings" to that frozenset in this PR. This review cannot approve a PR that is known to break the unit suite. Details are inline on investigate.py.
  • test-time-budget: no run was found for this commit. master does not list the check as required in branch protection or rulesets, so this does not block.

Blast Radius

  • Configs.ALL_HIVES now includes investigation_policy and investigation_plan. As a result, sync pull --all and sync push --all now send these hives to the infrastructure extension for every user. If the backend for an org does not support them, or the caller lacks investigation_policy.* / investigation_plan.* permissions, existing --all workflows may start to report skipped hives or errors. A push --all --force could also delete records in these hives that are missing from the local file.
  • New public SDK methods Investigation.get_track_record and Investigation.list_reopenings, plus CLI commands investigate track-record and investigate reopenings. They are read-only and add to the discovery registry.
  • The new sync flags are named --investigation-policy / --investigation-plan, not --hive-... like the other hive flags. Scripts that build flag names from the hive name will not find them.

This review was generated automatically by Claude Code.

Comment thread limacharlie/commands/investigate.py Resolved
Comment thread limacharlie/sdk/investigation.py Resolved
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maximelb

Copy link
Copy Markdown
Contributor Author

/lc-review

@limacharlie-event-notifications limacharlie-event-notifications Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Code Review Summary

Re-reviewed at this commit. The command snapshot finding is fixed. One Low finding from the last review is still open. No High or Medium issues remain.

General Feedback

  • test-time-budget: no run was found for this commit. master does not require the check in branch protection or rulesets, so it does not block.

Blast Radius

  • Configs.ALL_HIVES now includes investigation_policy and investigation_plan, so every sync pull --all / sync push --all now sends these hives. Callers without investigation_* permissions, or orgs where the backend does not support these hives, may see new skipped-hive errors. If someone runs push --all --force with a config file pulled before this change, records in these two hives may be deleted, because the file has no entries for them. Consider a release note.
  • New public SDK methods Investigation.get_track_record and Investigation.list_reopenings, and new CLI commands investigate track-record and investigate reopenings. All are read-only and are listed in the discovery profile.
  • The new sync flags are --investigation-policy / --investigation-plan. Other hive flags use a --hive- prefix. Scripts that build flag names from the hive name will not find the new flags.

This review was generated automatically by Claude Code.

@maximelb

maximelb commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated adversarial self-review (round 5, head 5ba280a): The first-install regression now sends the fixture through the real Investigation.get_track_record method and the track-record CLI in JSON and YAML formats, mocking only client.request. Each path checks a single GET to the expected endpoint, full-page equality, healthy incomplete historical coverage, zero reopened/disputed subjects, zero events in all five principal categories, and clear zero-count guards. Every existing assertion is retained. Reviewed the test boundary to confirm the CLI invokes the actual SDK rather than a mocked report method. Prior coded-error, schema, strict command snapshot, native sync, filter, cursor and resolved-policy output coverage remains intact. Full pytest tests/unit/ tests/microbenchmarks/: 6265 passed, 271 existing skips, 22 warnings. git diff --check passed. No unaddressed code findings identified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maximelb

Copy link
Copy Markdown
Contributor Author

/lc-review

@limacharlie-event-notifications limacharlie-event-notifications Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Code Review Summary

Re-reviewed at this commit. Both earlier findings are fixed. No new High, Medium or Low issues found.

General Feedback

  • test-time-budget: no run was found for this commit. master does not require the check in branch protection or rulesets, so it does not block.
  • I could not run the tests in this environment. I checked the new tests against the code statically. str(err.value) includes the suggestion, so the "region" in str(err.value) assertion holds. A coded engine not_found keeps suggestion="" from _wrap_error.

Blast Radius

  • Configs.ALL_HIVES now includes investigation_policy and investigation_plan. Every sync pull --all / sync push --all now sends these hives. Callers without investigation_* permissions, or orgs whose backend does not support these hives, may see new skipped-hive errors. If someone runs push --all --force with a config file pulled before this change, records in these two hives may be deleted, because the file has no entries for them. Consider a release note.
  • New public SDK methods Investigation.get_track_record and Investigation.list_reopenings, and new CLI commands investigate track-record and investigate reopenings. All are read-only and are listed in the discovery profile.
  • The new sync flags are --investigation-policy / --investigation-plan. Other hive flags use a --hive- prefix. Scripts that build flag names from the hive name will not find the new flags.

This review was generated automatically by Claude Code.

@limacharlie-refractionpoint

limacharlie-refractionpoint Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

LimaCharlie Cloud Security — code scan

No new code findings were introduced by this pull request.

This check reports and never fails: no gating.fail_on is set on the code_scanning policy.

Scanned refractionPOINT/python-limacharlie 81ebc78…5ba280a — only findings new in the head commit are listed; anything already on the base branch is the repository's own finding set, on the Cloud Security Code page.

This comment is updated in place on every push to this pull request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maximelb

Copy link
Copy Markdown
Contributor Author

/lc-review

@limacharlie-event-notifications limacharlie-event-notifications Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Code Review Summary

Re-reviewed this commit. It has the same head as the last review. Both earlier findings are still fixed. I found no High or Medium issues and one Low finding.

General Feedback

  • test-time-budget: no run was found for this commit. master does not require the check in branch protection or rulesets, so this does not block.

Blast Radius

  • Configs.ALL_HIVES now includes investigation_policy and investigation_plan. Every sync pull --all and sync push --all now sends these hives. Callers without investigation_* permissions, or orgs whose backend does not support these hives, may see new skipped-hive errors. A push --all --force that uses a config file pulled before this change may delete records in these two hives. Consider adding a release note.
  • This adds the public SDK methods Investigation.get_track_record and Investigation.list_reopenings, and the CLI commands investigate track-record and investigate reopenings. All four are read-only and are in the discovery profile.
  • The new sync flags have no --hive- prefix, unlike the other hive flags. Scripts that build flag names from the hive name will not find them.

This review was generated automatically by Claude Code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maximelb

Copy link
Copy Markdown
Contributor Author

/lc-review

@limacharlie-event-notifications limacharlie-event-notifications Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Code Review Summary

Re-reviewed at this commit. All earlier findings are fixed. No new High, Medium or Low issues found.

General Feedback

  • test-time-budget: no run was found for this commit. master does not require the check in branch protection or rulesets, so this does not block.

Blast Radius

  • Configs.ALL_HIVES now includes investigation_policy and investigation_plan. Every sync pull --all and sync push --all now sends these hives. Callers without investigation_* permissions, or orgs whose backend does not support these hives, may see new skipped-hive errors. A push --all --force that uses a config file pulled before this change may delete records in these two hives. Consider a release note.
  • New public SDK methods Investigation.get_track_record and Investigation.list_reopenings, and new CLI commands investigate track-record and investigate reopenings. All are read-only and are listed in the discovery profile.
  • The new sync flags have no --hive- prefix, unlike the other hive flags. Scripts that build flag names from the hive name will not find them.

This review was generated automatically by Claude Code.

This branch has not been deployed

No deployments
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.

1 participant