-
Notifications
You must be signed in to change notification settings - Fork 30
Update NRadix Tree #3157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update NRadix Tree #3157
Changes from all commits
48248aa
6191758
c77c8a0
d1e7a46
7fb9902
9ee7372
24c1d24
5eecdb7
f75b62d
7a5bdb1
11b7afe
e32a662
25bf9d8
2cc2a47
1cc86dd
f969766
b609c53
762e2ce
995b443
bdb95eb
1f8b8f6
768ebb2
dff9883
5c1b799
ab2dd59
ef2fee9
09bae7c
e2a4085
3295488
bc74ac4
48da9b7
356e1d8
480e9aa
e595f88
4683ad3
94418f7
db98d81
0c538c4
4cf15e2
5369867
d1c71dc
69d62c2
9835cd8
8672c77
d7d42a0
bc0825a
df9991a
cb9610c
8feb2b2
6a1d5ba
31c2f0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "permissions": { | ||
| "deny": [ | ||
| "mcp__github__merge_pull_request", | ||
| "mcp__github__delete_file", | ||
| "mcp__github__fork_repository", | ||
| "mcp__github__create_repository", | ||
| "mcp__github__actions_run_trigger" | ||
| ] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| --- | ||
| name: dev-loop | ||
| description: Full autonomous development loop — implement, build, test, commit, push, create PR, monitor CI, fix failures until green | ||
| disable-model-invocation: true | ||
| allowed-tools: Bash(cmake *), Bash(ctest *), Bash(nproc), Bash(git add *), Bash(git commit *), Bash(git diff *), Bash(git describe *), Bash(git branch *), Bash(git status), Bash(git log *), Bash(git rev-parse *), Bash(clang-format *), Bash(sleep *), Bash(date *), Read, Write, Edit, Glob, Grep, Agent | ||
| --- | ||
|
|
||
| # Dev Loop | ||
|
|
||
| Complete a development task end-to-end: implement, build, test, push, create PR, monitor CI, fix failures. | ||
| Do NOT stop until CI is green or you are blocked. | ||
|
|
||
| ## Phase 1: Implement | ||
|
|
||
| 1. Read and understand the task from $ARGUMENTS | ||
| 2. Explore relevant code | ||
| 3. Implement the changes | ||
| 4. Build: `cmake -S . -B cmake-build -DCMAKE_BUILD_TYPE=Release -DCOLLECTOR_VERSION=$(git describe --tags --abbrev=10 --long) && cmake --build cmake-build -- -j$(nproc)` | ||
| - If build fails, fix and retry | ||
| 5. Test: `ctest --no-tests=error -V --test-dir cmake-build` | ||
| - If tests fail, fix and retry | ||
| 6. Format: `clang-format --style=file -i <changed .cpp/.h files>` | ||
| 7. Commit: `git add` changed files, `git commit` with a descriptive message | ||
|
|
||
| ## Phase 2: Push and create PR | ||
|
|
||
| Use the GitHub MCP server to push files and create a PR. | ||
| Do NOT use `git push` — it will fail (no SSH keys in this container). | ||
|
|
||
| 1. Get the current branch name and the list of changed files: | ||
| - `git branch --show-current` for the branch | ||
| - `git diff --name-only origin/HEAD..HEAD` for changed files | ||
| 2. Use the GitHub MCP `push_files` tool to push the changed files directly to | ||
| the remote branch. This creates a commit via the GitHub API using the file | ||
| contents from your local workspace — it does not sync git history. | ||
| - owner: stackrox, repo: collector, branch: <current branch> | ||
| - Read each changed file and include its content | ||
| - Provide a commit message | ||
| 3. Search for an open PR for this branch via GitHub MCP | ||
| 4. If no PR exists, create a draft PR via GitHub MCP | ||
|
|
||
| ## Phase 3: Monitor CI | ||
|
|
||
| Loop until all checks pass or blocked (max 6 cycles, ~3 hours): | ||
|
|
||
| 1. Wait 10 minutes: `sleep 600` | ||
| 2. Check CI status via GitHub MCP (PR checks, workflow runs) | ||
| 3. Update PR body with an `## Agent Status` section: | ||
| ``` | ||
| ## Agent Status | ||
| **Last updated:** <`date -u +"%Y-%m-%d %H:%M UTC"`> | ||
| **CI cycle:** N of 6 | ||
| **Status:** PENDING | PASSED | FIXED | FLAKE | BLOCKED | ||
| **Details:** <one-line summary> | ||
| ``` | ||
| 4. Evaluate: | ||
| - **All checks passed** → update PR body, report success, stop | ||
| - **Still running** → continue loop | ||
| - **Failed** → | ||
| - Get job logs via GitHub MCP | ||
| - Diagnose: build error, test assertion, lint, infra flake | ||
| - If fixable: fix → build → test → push changed files via MCP → continue | ||
| - If infra flake: note as FLAKE, continue | ||
| - If not fixable: update PR body, report BLOCKED, stop | ||
|
|
||
| ## Phase 4: Check PR comments | ||
|
|
||
| Before each CI cycle, check if there are new PR review comments via GitHub MCP. | ||
| If a reviewer left feedback: | ||
| - Address the feedback (edit code, fix issues) | ||
| - Build and test | ||
| - Push changed files via MCP | ||
| - Note in the Agent Status section what feedback was addressed | ||
|
|
||
| ## Completion | ||
|
|
||
| Print summary: | ||
| ``` | ||
| STATUS: PASSED | BLOCKED | TIMEOUT | ||
| Branch: <branch> | ||
| PR: <url> | ||
| Cycles: N | ||
| Changes: <list of files modified> | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| --- | ||
| name: task | ||
| description: Implement a change — edit code, build, test, format, commit locally. No push. | ||
| disable-model-invocation: true | ||
| allowed-tools: Bash(cmake *), Bash(ctest *), Bash(nproc), Bash(git add *), Bash(git commit *), Bash(git diff *), Bash(git describe *), Bash(git branch *), Bash(git status), Bash(clang-format *), Read, Write, Edit, Glob, Grep, Agent | ||
| --- | ||
|
|
||
| # Task | ||
|
|
||
| Implement a change locally: edit, build, test, format, commit. | ||
| Do NOT push or create PRs — use /watch-ci for that. | ||
|
|
||
| ## Steps | ||
|
|
||
| 1. Read and understand the task from $ARGUMENTS | ||
| 2. Explore relevant code in the repository | ||
| 3. Implement the changes | ||
| 4. Build: | ||
| - `cmake -S . -B cmake-build -DCMAKE_BUILD_TYPE=Release -DCOLLECTOR_VERSION=$(git describe --tags --abbrev=10 --long) && cmake --build cmake-build -- -j$(nproc)` | ||
| - If build fails, fix and retry | ||
| 5. Run unit tests: | ||
| - `ctest --no-tests=error -V --test-dir cmake-build` | ||
| - If tests fail, fix and retry | ||
| 6. Format changed C++ files: | ||
| - `clang-format --style=file -i <changed .cpp/.h files>` | ||
| 7. Commit: | ||
| - `git add` the changed files | ||
| - `git commit` with a descriptive message | ||
|
|
||
| ## STOP here. Report and wait. | ||
|
|
||
| Print this summary and then STOP. Do not continue with any other actions. | ||
|
|
||
| ``` | ||
| TASK COMPLETE | ||
| Branch: <current branch> | ||
| Commit: <commit hash> | ||
| Files changed: <list> | ||
| Tests: <pass/fail count> | ||
| ``` | ||
|
|
||
| The user will review and decide whether to run /watch-ci. | ||
| Do NOT push, create branches, or create PRs. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| --- | ||
| name: watch-ci | ||
| description: Push files to existing remote branch via GitHub MCP, create PR if needed, monitor CI, fix failures until green | ||
| disable-model-invocation: true | ||
| allowed-tools: Bash(cmake *), Bash(ctest *), Bash(nproc), Bash(git add *), Bash(git commit *), Bash(git diff *), Bash(git describe *), Bash(git branch *), Bash(git status), Bash(git log *), Bash(git rev-parse *), Bash(clang-format *), Bash(sleep *), Bash(date *), Read, Write, Edit, Glob, Grep | ||
| --- | ||
|
|
||
| # Watch CI | ||
|
|
||
| Push changed files via the GitHub MCP server, create PR if needed, and monitor CI until green. | ||
| Do NOT use `git push` — it will fail (no SSH keys in this container). | ||
|
|
||
| ## How pushing works | ||
|
|
||
| Use the GitHub MCP `push_files` tool to send file contents directly to the remote | ||
| branch via the GitHub API. This does NOT sync local git history — it creates a new | ||
| commit on the remote with the file contents you provide. | ||
|
|
||
| 1. Get the branch name: `git branch --show-current` | ||
| 2. Get changed files: `git diff --name-only origin/HEAD..HEAD` | ||
| 3. Read each changed file's content | ||
| 4. Call `push_files` with owner: stackrox, repo: collector, branch, files, and commit message | ||
|
|
||
| ## Steps | ||
|
|
||
| 1. **Push** changed files: | ||
| - Use the GitHub MCP `push_files` tool as described above | ||
| - If no files have changed since last push, skip | ||
|
|
||
| 2. **Find or create PR**: | ||
| - Use the GitHub MCP server to search for an open PR for this branch | ||
| - If no PR exists, create a draft PR via the GitHub MCP server | ||
|
|
||
| 3. **Monitor CI loop** (repeat until all checks pass or blocked): | ||
| - Wait 10 minutes: `sleep 600` | ||
| - Use the GitHub MCP server to get PR check status and workflow runs | ||
| - Update PR body with an `## Agent Status` section: | ||
| ``` | ||
| ## Agent Status | ||
| **Last updated:** <`date -u +"%Y-%m-%d %H:%M UTC"`> | ||
| **CI cycle:** N of 6 | ||
| **Status:** PENDING | PASSED | FIXED | FLAKE | BLOCKED | ||
| **Details:** <one-line summary> | ||
| ``` | ||
| - Evaluate: | ||
| - **All checks passed** → update PR body, report success and stop | ||
| - **Checks still running** → report progress, continue loop | ||
| - **Checks failed** → | ||
| - Get job logs via the GitHub MCP server | ||
| - Diagnose: | ||
| - Build failure: read error, fix code | ||
| - Unit test failure: read assertion, fix code | ||
| - Lint failure: run `clang-format --style=file -i` | ||
| - Integration test infra flake (VM timeout, network): report as flake, continue | ||
| - Integration test real failure: analyze and fix code | ||
| - If fixable: fix → build → test → push changed files via MCP → continue loop | ||
| - If not fixable: update PR body, report diagnosis and stop | ||
|
|
||
| 4. **Safety limits**: | ||
| - Maximum 6 CI cycles (about 3 hours of monitoring) | ||
| - If exceeded, update PR body and stop | ||
|
|
||
| 5. **Summary**: end with a status line: | ||
| - `PASSED` — all checks green | ||
| - `PENDING` — checks still running | ||
| - `FIXED` — failure diagnosed and fix pushed | ||
| - `FLAKE` — infra failure, not a code issue | ||
| - `BLOCKED` — failure requires human intervention |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # Collector development container | ||
| # Based on the collector-builder image which has all C++ dependencies pre-installed. | ||
| # Adds Claude Code, Go, and developer tooling for agent-driven development. | ||
| # | ||
| # Build environment: CentOS Stream 10 with clang, llvm, cmake, grpc, protobuf, | ||
| # libbpf, bpftool, and all other collector dependencies. | ||
|
|
||
| ARG COLLECTOR_BUILDER_TAG=master | ||
| FROM quay.io/stackrox-io/collector-builder:${COLLECTOR_BUILDER_TAG} | ||
|
|
||
| # Install developer tooling not in the builder image | ||
| # Note: git, findutils, which, openssh-clients already in builder | ||
| # bubblewrap: Claude Code uses this for built-in command sandboxing | ||
| RUN dnf install -y \ | ||
| bubblewrap \ | ||
| clang-tools-extra \ | ||
| jq \ | ||
| socat \ | ||
| zsh \ | ||
| procps-ng \ | ||
| sudo \ | ||
| python3-pip \ | ||
| iptables \ | ||
| ipset \ | ||
| && dnf clean all | ||
|
|
||
| # Determine architecture strings used by various download URLs | ||
| # uname -m gives aarch64 or x86_64 | ||
| # Go uses arm64/amd64, ripgrep/fd use aarch64/x86_64 | ||
| RUN ARCH=$(uname -m) \ | ||
| && GOARCH=$([ "$ARCH" = "aarch64" ] && echo "arm64" || echo "amd64") \ | ||
| # Install Go | ||
| && curl -fsSL "https://go.dev/dl/go1.23.6.linux-${GOARCH}.tar.gz" | tar -C /usr/local -xzf - \ | ||
| # Install ripgrep | ||
| && curl -fsSL "https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep-14.1.1-${ARCH}-unknown-linux-gnu.tar.gz" \ | ||
| | tar -xzf - --strip-components=1 -C /usr/local/bin "ripgrep-14.1.1-${ARCH}-unknown-linux-gnu/rg" \ | ||
| # Install fd | ||
| && curl -fsSL "https://github.com/sharkdp/fd/releases/download/v10.2.0/fd-v10.2.0-${ARCH}-unknown-linux-gnu.tar.gz" \ | ||
| | tar -xzf - --strip-components=1 -C /usr/local/bin "fd-v10.2.0-${ARCH}-unknown-linux-gnu/fd" | ||
|
Comment on lines
+30
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's read the Dockerfile to understand the full context
cat -n .devcontainer/DockerfileRepository: stackrox/collector Length of output: 3854 🏁 Script executed: # Check if checksums or signatures are available for these tools
# Go - check official documentation and available checksums
curl -sL https://go.dev/dl/ | grep -i "sha256\|checksum" | head -20Repository: stackrox/collector Length of output: 655 🏁 Script executed: # Check ripgrep releases for checksum information
curl -sL "https://api.github.com/repos/BurntSushi/ripgrep/releases/tags/14.1.1" | jq '.body' 2>/dev/null | head -50Repository: stackrox/collector Length of output: 66 🏁 Script executed: # Check fd releases for checksum information
curl -sL "https://api.github.com/repos/sharkdp/fd/releases/tags/v10.2.0" | jq '.body' 2>/dev/null | head -50Repository: stackrox/collector Length of output: 66 🌐 Web query:
💡 Result: Go 1.23.6 was released on 2025-02-04 as a security release fixing crypto/elliptic timing sidechannel on ppc64le (CVE-2025-22866). Official binary and source distributions are available at https://go.dev/dl/. SHA256 checksums for all official download files are listed on that page in a table under the go1.23.6 section (likely in "Archived versions" since newer releases like go1.26.1 are featured). To verify downloads, compute the SHA256 hash of the file and match it against the official checksums on https://go.dev/dl/. Alternatively, use go install golang.org/dl/go1.23.6@latest followed by go1.23.6 download, which fetches and verifies the official distribution automatically. Source code can also be obtained via git checkout go1.23.6 in the golang/go repository at https://go.googlesource.com/go. No explicit checksum values were extractable from search snippets, but the official page provides them directly. Citations:
🌐 Web query:
💡 Result: Yes, checksums (SHA256) for ripgrep 14.1.1 release binaries are available on the official GitHub releases page at https://github.com/BurntSushi/ripgrep/releases/tag/14.1.1. Each binary archive, such as ripgrep-14.1.1-x86_64-unknown-linux-musl.tar.gz, has a corresponding .sha256 file containing its checksum. These are standard for ripgrep releases, as confirmed by examples in 14.0.0 and 15.x releases (e.g., ripgrep-14.0.0-aarch64-apple-darwin.tar.gz.sha256). SourceForge mirrors also host these .sha256 files specifically for 14.1.1 assets, like ripgrep-14.1.1-x86_64-pc-windows-gnu.zip.sha256 and ripgrep_14.1.1-1_amd64.deb.sha256. The release occurred on 2024-09-09 (patch fixing matching bug Citations:
🌐 Web query:
💡 Result: The fd (find alternative) tool version 10.2.0 was released on 2024-08-23 by sharkdp/fd on GitHub. SHA256 checksums for its binary assets are provided directly on the GitHub release page (https://github.com/sharkdp/fd/releases/tag/v10.2.0), listed next to each downloadable file (e.g., similar to fd-musl_10.4.2_amd64.deb sha256:a8d10259388c32f9aafd65fb65b6e3e2d2782043bed687112f50e2c4cf000c27 for recent releases). There is no separate checksums.txt file, as confirmed by closed issue Citations:
🌐 Web query:
💡 Result: Dockerfile best practices for piping curl to tar, such as RUN curl https://example.com/file.tar.gz | tar -xzf -, are endorsed by official Docker documentation as efficient for downloading and extracting remote archives in a single layer. This avoids leaving temporary files in image layers, unlike using ADD with remote URLs followed by separate extraction. Key best practices: - Prefer RUN curl ... | tar over ADD http://... for remote archives: ADD creates an extra layer with the unextracted archive, bloating the image and complicating cleanup. RUN allows download, extract, and delete in one step. - Pin exact versions in URLs (e.g., via ENV PG_VERSION=9.3.4; curl https://example.com/postgres-$PG_VERSION.tar.xz | tar ...) for reproducibility and supply chain security. - Verify integrity: Download to a temp file first, check SHA256 checksum, then extract and remove (e.g., RUN curl -fsSL https://example.com/package.tar.gz -o /tmp/pkg.tar.gz && echo "expected_sha256 /tmp/pkg.tar.gz" | sha256sum -c - && tar -xzf /tmp/pkg.tar.gz -C / && rm /tmp/pkg.tar.gz). - Use --fail/-f with curl to fail on HTTP errors, -SL for location following. - Combine with apt cleanup: In Debian/Ubuntu, chain with apt-get update/install/curl && ... && apt-get purge -y curl ca-certificates && rm -rf /var/lib/apt/lists/* to minimize image size. - Avoid piping curl directly to sh/bash (curl | sh), as it executes untrusted scripts without review; always inspect or verify downloads. - Use multi-stage builds for complex cases to further reduce final image size. - Scan images with tools like Trivy or Docker Scout for vulnerabilities, including in curl itself (keep base images updated). Security risks if not followed: - Unpinned URLs allow supply chain attacks if source changes maliciously. - No checksum: Tampered archives execute arbitrary code during build. - Separate layers retain artifacts inspectable in image history. - ADD remote URLs lack transparency and checksum support, enabling user-agent-based attacks. Official Docker docs explicitly recommend this pattern in multiple best practices pages (e.g., ENV example with curl | tar). Citations:
Verify downloaded archives before extracting them. Go, ripgrep, and fd are streamed directly from the network into 🤖 Prompt for AI Agents |
||
|
|
||
| ENV PATH="/usr/local/go/bin:${PATH}" | ||
| ENV GOPATH="/home/dev/go" | ||
| ENV PATH="${GOPATH}/bin:${PATH}" | ||
|
|
||
| # Install Node.js (needed for Claude Code) | ||
| ARG NODE_VERSION=22 | ||
| RUN curl -fsSL https://rpm.nodesource.com/setup_${NODE_VERSION}.x | bash - \ | ||
| && dnf install -y nodejs \ | ||
| && dnf clean all | ||
|
Comment on lines
+47
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n .devcontainer/Dockerfile | head -70Repository: stackrox/collector Length of output: 3453 Avoid executing live installer scripts during the build. Both the NodeSource and gcloud installs execute remote scripts fetched at build time without any integrity check. This makes the image non-reproducible and extends the supply-chain trust boundary to live network content (lines 47-49 and 55-57). Prefer pinned packages or verified release artifacts instead. 🤖 Prompt for AI Agents |
||
|
|
||
| # Install Claude Code | ||
| RUN npm install -g @anthropic-ai/claude-code | ||
|
Comment on lines
+51
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Check the .devcontainer directory structure
ls -la .devcontainer/Repository: stackrox/collector Length of output: 624 🏁 Script executed: # Read the Dockerfile to confirm the current state at lines 51-52
cat -n .devcontainer/Dockerfile | head -60Repository: stackrox/collector Length of output: 2895 🏁 Script executed: # Read entrypoint.sh to check for subcommand usage
cat -n .devcontainer/entrypoint.shRepository: stackrox/collector Length of output: 1028 Pin The entrypoint script relies on specific subcommands: 🤖 Prompt for AI Agents |
||
|
|
||
| # Install gcloud CLI (for Vertex AI auth and GCP VM management) | ||
| RUN curl -fsSL https://sdk.cloud.google.com > /tmp/install-gcloud.sh \ | ||
| && bash /tmp/install-gcloud.sh --disable-prompts --install-dir=/opt \ | ||
| && rm /tmp/install-gcloud.sh | ||
| ENV PATH="/opt/google-cloud-sdk/bin:${PATH}" | ||
|
|
||
| # Create non-root dev user with passwordless sudo | ||
| RUN useradd -m -s /bin/zsh dev \ | ||
| && echo "dev ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/dev \ | ||
| && mkdir -p /home/dev/.claude/debug /home/dev/.commandhistory \ | ||
| && chown -R dev:dev /home/dev/.claude /home/dev/.commandhistory | ||
|
|
||
| # Install ansible for VM-based testing (optional, lightweight) | ||
| RUN pip3 install ansible-core | ||
|
|
||
| # Firewall script for network isolation (optional, used with --dangerously-skip-permissions) | ||
| COPY --chmod=755 init-firewall.sh /usr/local/bin/init-firewall.sh | ||
| COPY --chmod=755 entrypoint.sh /usr/local/bin/entrypoint.sh | ||
|
|
||
| USER dev | ||
| WORKDIR /workspace | ||
|
|
||
| # Persist shell history and Claude state across rebuilds (volumes in devcontainer.json) | ||
| ENV HISTFILE=/home/dev/.commandhistory/.zsh_history | ||
|
|
||
| ENV SHELL=/bin/zsh | ||
| ENV DEVCONTAINER=true | ||
|
|
||
| ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify a language for this fenced block.
markdownlintis already flagging this fence, so this change leaves the warning open until the block is annotated (for example,text).🧰 Tools
🪛 markdownlint-cli2 (0.22.0)
[warning] 38-38: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents