Skip to content

sync: add the investigation_pack hive - #484

Merged
maximelb merged 2 commits into
masterfrom
iagp-packs
Nov 26, 2026
Merged

maximelb merged 2 commits into
masterfrom
iagp-packs

Conversation

@maximelb

Copy link
Copy Markdown
Contributor

What

limacharlie sync pull / sync push support the investigation_pack hive (the packs of shared checks that Investigation Engine templates use), like the other two investigation hives.

  • New flag --investigation-pack; --all and --all-available include it (_HIVE_FLAG_MAP), and so does Configs.ALL_HIVES.
  • INVESTIGATION_HIVES (the YAML 1.2 boolean rule for config files) includes it.
  • doc/cli/infrastructure.md: permissions table row and the "Investigation configuration sync" section (apply order: settings record, packs, templates; removals in reverse).
  • CHANGELOG: "New permissions" entry. The pack hive uses the investigation_plan permission family, so a key that already syncs templates needs nothing new; sync pull --all fails without the read permission and --all-available skips the hive.

The apply order and compare-and-swap writes happen in the Infrastructure extension's SDK, which is changed in refractionPOINT/go-limacharlie#300.

Tests

Flag selection (alone and with --all), ALL_HIVES, the YAML rule, CLI pull/push round trip with the pack flag and --all, and a pack record's source carried unchanged through export and push. Full tests/unit + tests/microbenchmarks: 6652 passed.

🤖 Generated with Claude Code

--investigation-pack on sync pull/push, included in --all and
--all-available, Configs.ALL_HIVES, the YAML 1.2 loader rule, docs,
permissions table and changelog.

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

Copy link
Copy Markdown
Contributor Author

Self-review (adversarial), head 8c28723.

Checked and found no open issue:

  • Surface. The new click option, _HIVE_FLAG_MAP entry, pull and push signatures and the _resolve_sync_flags calls all carry investigation_pack; the CLI round-trip test runs both pull and push with the explicit flags and with --all, so a signature mismatch fails there. --all-available goes through the same map.
  • Selection is exact. --investigation-pack alone selects only that hive (test); without the flag only --all selects it.
  • YAML rule. INVESTIGATION_HIVES now includes the pack. A pack's data is {"yaml": "<source>"}, a string, so the 1.2 rule changes nothing for the source; it keeps the loader consistent for the pack's other keys. A test carries a source containing off through export and push unchanged.
  • Ordering and compare-and-swap are not in this repo. They happen in the Infrastructure extension's Go SDK (Sync: support the investigation_pack hive go-limacharlie#300). Against an extension that still has the older SDK, an explicit --investigation-pack push is applied as an "other" hive: after the known ones, without version checks. The docs say the extension applies the order, not the CLI.
  • Permissions. The table row and the CHANGELOG entry name the investigation_plan permission family, as the Hive definition does, and say that --all fails and --all-available skips without the read permission.
  • Full tests/unit + tests/microbenchmarks: 6652 passed.

@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

Verdict: APPROVED (0 High, 0 Medium, 1 Low)

I found no High or Medium issues. The new flag, the _HIVE_FLAG_MAP entry, the pull/push signatures, Configs.ALL_HIVES and INVESTIGATION_HIVES all match. The tests call the real _resolve_sync_flags, the Configs.fetch_to_file/push_from_file functions and the CLI through CliRunner. They mock only the HTTP client, so they do not simulate the code under test.

General Feedback

  • Low Priority: Two flag lists still leave out --investigation-pack, and the diff does not touch either line, so I could not comment on them inline:
    • doc/cli/infrastructure.md:51-56: the "Available hive flags" list ends with --investigation-policy, --investigation-plan. Add --investigation-pack there.
    • limacharlie/commands/sync.py:246-273: the sync.pull explain text ("Hive flags" block) has no --investigation-* flag. --investigation-policy and --investigation-plan were already missing before this PR. Users who read limacharlie explain sync.pull will not learn that the new flag exists.
  • test-time-budget: no check run was found on this commit. Neither branch protection nor rulesets on master require the check, so it does not block this review.

Blast radius

  • --all and --all-available on sync pull/sync push now include investigation_pack.
  • With --all, a key that lacks investigation_plan.get now fails on the pack hive as well. Before this PR, such a key would already have failed on investigation_plan, so no key that passed before fails now.
  • sync push --all --force now also removes pack records that are missing from the local file. A config file exported by an older CLI has no investigation_pack section. Pushing that file with --all --force will delete every pack in the org, and templates that use those packs may then break. The CHANGELOG entry could warn about this, as with any new hive added to --all.
  • limacharlie hive set/hive update (through load_record_yaml) now read investigation_pack input with the YAML 1.2 boolean rule. A pack's data is {"yaml": "<string>"}, so the pack source itself does not change.
  • Configs.ALL_HIVES is part of the public SDK, so code that reads it will now see the new hive.

This review was generated automatically by Claude Code.

lcbill
lcbill previously approved these changes Nov 26, 2026
…nd version rule

Co-Authored-By: Claude Sonnet 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

Verdict: APPROVED (0 High, 0 Medium, 0 Low)

Re-review of 5d50e03 against my earlier review of 8c28723. Since then only CHANGELOG.md, doc/cli/infrastructure.md, doc/sdk/configs.md and limacharlie/commands/sync.py changed. I reviewed those again in full. The other files have not changed since my last review.

Earlier findings

  • My earlier Low finding is fixed. --investigation-pack is now in the "Available hive flags" list in doc/cli/infrastructure.md. The sync.pull explain text in limacharlie/commands/sync.py now lists all three --investigation-* flags.

General Feedback

  • The new CHANGELOG and docs text describes two Hive rules for packs: the allow-api-key-promotion tag and the higher version needed when a pack source changes. These rules are enforced by the server, not by this repository, so I could not check them here.
  • test-time-budget: no check run was found on this commit. Neither branch protection nor rulesets on master require the check, so it does not block this review.

Blast radius

  • sync pull/sync push with --all or --all-available now include investigation_pack.
  • sync push --all --force with a config file exported by an older CLI (which has no investigation_pack section) will remove every pack in the org. Templates that use those packs may then fail.
  • Configs.ALL_HIVES and yaml_input.INVESTIGATION_HIVES are public, so code that reads them will now see the new hive. hive set/hive update now read investigation_pack input with the YAML 1.2 boolean rule. A pack's source is a string, so it is not affected.

This review was generated automatically by Claude Code.

@maximelb
maximelb merged commit fd7455a into master Nov 26, 2026
7 checks passed
@maximelb
maximelb deleted the iagp-packs branch November 26, 2026 19:25
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