docs: adds details about leased IP gate in resource matching doc - #3260
Conversation
📝 WalkthroughWalkthroughThis PR extends the resource-matching acceptance criteria documentation to specify how leased public IPs are validated as a cluster-level pre-check in the inventory service, before per-node matching begins. It defines request counting, availability computation, and failure conditions. ChangesLeased IP Specification
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3260 +/- ##
==========================================
- Coverage 67.06% 66.43% -0.64%
==========================================
Files 1081 1041 -40
Lines 26538 25516 -1022
Branches 6393 6225 -168
==========================================
- Hits 17799 16952 -847
+ Misses 7641 7478 -163
+ Partials 1098 1086 -12
*This pull request uses carry forward flags. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/provider-inventory/docs/resource-matching-acceptance-criteria.md`:
- Around line 361-366: The doc links point to non-existent Go sources; update
the leased-IP anchors to reference the correct TypeScript files or symbols in
this repo (or remove them). Replace references to handleRequest,
availableLeasedIPs, countReservedIPs, leasedIPStatus, and
GetEndpointQuantityOfResourceGroup with the actual TypeScript equivalents in
apps/provider-inventory (e.g., the inventory request handler, availability
calculation, reserved-count logic, leased IP status reporting, and
endpoint-quantity function) or link to the provider status fields
(`provider.Inventory.LeasedIP` / `leased_ip.{allocatable, allocated}`) directly
so anchors resolve correctly.
- Around line 273-282: The doc references a non-existent function
GetEndpointQuantityOfResourceGroup and a missing util file; update
apps/provider-inventory/docs/resource-matching-acceptance-criteria.md so AC18
either points to the actual implementation that computes unique leased-IP counts
(replace GetEndpointQuantityOfResourceGroup with the real function name that
collects distinct endpoint sequence numbers and stores the reservation's
endpoint quantity) or revise the AC wording to match the current code path
(describe that the system counts distinct Endpoint_LEASED_IP sequence numbers
across the group spec once per reservation and stores that value). Ensure the
doc mentions the correct symbol Endpoint_LEASED_IP and the real
implementation/function used in the repo instead of the stale references.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e8f113a8-9262-407c-93c0-41ee8fee2246
📒 Files selected for processing (1)
apps/provider-inventory/docs/resource-matching-acceptance-criteria.md
| ### AC18 — Leased IP counting | ||
| **WHAT:** The number of leased IPs a deployment needs is the count of **unique** `LEASED_IP` | ||
| endpoint sequence numbers across the whole group spec. The same endpoint referenced by several | ||
| services is **one** IP, not many. | ||
| **HOW:** The provider counts via `GetEndpointQuantityOfResourceGroup(gspec, Endpoint_LEASED_IP)`, | ||
| which collects distinct endpoint sequence numbers into a set and returns the set size. This is | ||
| computed once per reservation and stored as the reservation's endpoint quantity. | ||
|
|
||
| - ✅ **Counts as 1:** Three services all reference leased-IP endpoint `#1` → requested = 1. | ||
| - ✅ **Counts as 2:** Group references leased-IP endpoints `#1` and `#2` → requested = 2. |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify GetEndpointQuantityOfResourceGroup function exists and check its signature
rg -n "func GetEndpointQuantityOfResourceGroup" --type=go -A 10Repository: akash-network/console
Length of output: 214
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 1) Locate the symbol name anywhere in the repo (any language)
rg -n "GetEndpointQuantityOfResourceGroup" .
# 2) If we find likely files, narrow to them to find the function/signature and how it counts
# (We can't assume file paths yet—so this is best-effort with a second search after we know matches.)Repository: akash-network/console
Length of output: 413
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate the implementation file the docs link to
fd -a "endpoint_quantity\.go$" .
# Also list anything under cluster/util that looks relevant (fallback)
fd -a "endpoint_.*quantity.*\.go$" apps/provider-inventory . || trueRepository: akash-network/console
Length of output: 47
🏁 Script executed:
#!/bin/bash
set -euo pipefail
target="apps/provider-inventory/cluster/util/endpoint_quantity.go"
echo "== Existence =="
if [ -f "$target" ]; then
echo "FOUND: $target"
else
echo "MISSING: $target"
fi
echo
echo "== Find endpoint_quantity.go under apps/provider-inventory =="
fd -a -e go "endpoint_quantity\.go$" apps/provider-inventory || true
echo
echo "== Grep for Endpoint_LEASED_IP under apps/provider-inventory/cluster/util =="
rg -n "Endpoint_LEASED_IP" apps/provider-inventory/cluster/util || true
echo
echo "== Grep for GetEndpointQuantityOfResourceGroup under apps/provider-inventory/cluster/util =="
rg -n "GetEndpointQuantityOfResourceGroup" apps/provider-inventory/cluster/util || trueRepository: akash-network/console
Length of output: 555
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Locate endpoint_quantity.go files =="
fd -a "endpoint_quantity\.go$" . || true
echo
echo "== Search for GetEndpointQuantityOfResourceGroup anywhere (any language) =="
rg -n "GetEndpointQuantityOfResourceGroup" . || true
echo
echo "== Search for Endpoint_LEASED_IP usage in Go files =="
rg -n "Endpoint_LEASED_IP" --glob='*.go' . || trueRepository: akash-network/console
Length of output: 585
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Search for LEASED_IP / Endpoint_LEASED_IP anywhere =="
rg -n "LEASED_IP|Endpoint_LEASED_IP" . || true
echo
echo "== Search for related function/name fragments =="
rg -n "GetEndpointQuantity|EndpointQuantity|QuantityOfResourceGroup|Endpoint.*Quantity" . || true
echo
echo "== Directory scan for provider-inventory (top 3 levels) =="
find apps/provider-inventory -maxdepth 3 -type d | sort | sed -n '1,120p'Repository: akash-network/console
Length of output: 3076
Fix stale implementation reference for AC18 leased IP counting.
GetEndpointQuantityOfResourceGroupisn’t implemented anywhere in the repo (only referenced inapps/provider-inventory/docs/resource-matching-acceptance-criteria.md).- The linked file
apps/provider-inventory/cluster/util/endpoint_quantity.goalso doesn’t exist, so the described “unique endpoint sequence numbers” logic can’t be traced to code.
Update the doc to point to the actual counting implementation (or adjust the acceptance-criteria wording to match what the code does).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/provider-inventory/docs/resource-matching-acceptance-criteria.md` around
lines 273 - 282, The doc references a non-existent function
GetEndpointQuantityOfResourceGroup and a missing util file; update
apps/provider-inventory/docs/resource-matching-acceptance-criteria.md so AC18
either points to the actual implementation that computes unique leased-IP counts
(replace GetEndpointQuantityOfResourceGroup with the real function name that
collects distinct endpoint sequence numbers and stores the reservation's
endpoint quantity) or revise the AC wording to match the current code path
(describe that the system counts distinct Endpoint_LEASED_IP sequence numbers
across the group spec once per reservation and stores that value). Ensure the
doc mentions the correct symbol Endpoint_LEASED_IP and the real
implementation/function used in the repo instead of the stale references.
| Leased IP (AC18–AC21), enforced in the inventory service, not the per-node engine: | ||
|
|
||
| - Leased IP gate: [handleRequest](../cluster/inventory.go#L457) | ||
| - Availability math: [availableLeasedIPs / countReservedIPs / leasedIPStatus](../cluster/inventory.go#L411-L444) | ||
| - Request counting: [GetEndpointQuantityOfResourceGroup](../cluster/util/endpoint_quantity.go#L8) | ||
| - Status reporting: `provider.Inventory.LeasedIP` (`leased_ip.{allocatable, allocated}` in the provider status stream) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify leased IP implementation references exist
echo "=== Checking handleRequest ==="
rg -n "func.*handleRequest" apps/provider-inventory/cluster/inventory.go -A 3
echo -e "\n=== Checking availableLeasedIPs ==="
rg -n "func.*availableLeasedIPs" apps/provider-inventory/cluster/inventory.go -A 3
echo -e "\n=== Checking countReservedIPs ==="
rg -n "func.*countReservedIPs" apps/provider-inventory/cluster/inventory.go -A 3
echo -e "\n=== Checking leasedIPStatus ==="
rg -n "func.*leasedIPStatus" apps/provider-inventory/cluster/inventory.go -A 3
echo -e "\n=== Checking GetEndpointQuantityOfResourceGroup ==="
rg -n "func.*GetEndpointQuantityOfResourceGroup" apps/provider-inventory/cluster/util/endpoint_quantity.go -A 3
echo -e "\n=== Checking LeasedIP status field ==="
rg -n "LeasedIP.*Inventory" apps/provider-inventory --type=go -C 2Repository: akash-network/console
Length of output: 750
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== Locate inventory.go ==="
fd -t f -g 'inventory.go' . | head -n 50
echo -e "\n=== Locate endpoint_quantity.go ==="
fd -t f -g 'endpoint_quantity.go' . | head -n 50
echo -e "\n=== Search for symbols across Go files ==="
rg -n --type go "func\s+handleRequest\b" .
rg -n --type go "func\s+availableLeasedIPs\b" .
rg -n --type go "func\s+countReservedIPs\b" .
rg -n --type go "func\s+leasedIPStatus\b" .
rg -n --type go "func\s+GetEndpointQuantityOfResourceGroup\b" .
echo -e "\n=== Search for LeasedIP status field / stream names ==="
rg -n --type go "provider\.Inventory\.LeasedIP|leased_ip\.(allocatable|allocated)" .Repository: akash-network/console
Length of output: 174
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== Check for fd ==="
command -v fd || true
echo -e "\n=== List apps/ ==="
ls -la apps 2>/dev/null || true
echo -e "\n=== Check apps/provider-inventory ==="
ls -la apps/provider-inventory 2>/dev/null || true
echo -e "\n=== Find inventory.go anywhere (tracked files) ==="
git ls-files | rg -n '(^|/)inventory\.go$' || true
echo -e "\n=== Find endpoint_quantity.go anywhere (tracked files) ==="
git ls-files | rg -n '(^|/)endpoint_quantity\.go$' || true
echo -e "\n=== Search for symbols anywhere (Go) ==="
rg -n --type go "func\s+handleRequest\b" . || true
rg -n --type go "func\s+availableLeasedIPs\b" . || true
rg -n --type go "func\s+countReservedIPs\b" . || true
rg -n --type go "func\s+leasedIPStatus\b" . || true
rg -n --type go "func\s+GetEndpointQuantityOfResourceGroup\b" . || true
echo -e "\n=== Search for LeasedIP stream/status fields anywhere (Go) ==="
rg -n --type go "provider\.Inventory\.LeasedIP|leased_ip\.(allocatable|allocated)" . || trueRepository: akash-network/console
Length of output: 2210
Update the leased-IP links: the referenced Go files/symbols don’t exist in this repo snapshot.
apps/provider-inventory is a TypeScript project, and there are no matching Go sources for the documentation links (e.g., apps/provider-inventory/cluster/inventory.go and apps/provider-inventory/cluster/util/endpoint_quantity.go—so the handleRequest, availableLeasedIPs, countReservedIPs, leasedIPStatus, and GetEndpointQuantityOfResourceGroup anchors can’t resolve).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/provider-inventory/docs/resource-matching-acceptance-criteria.md` around
lines 361 - 366, The doc links point to non-existent Go sources; update the
leased-IP anchors to reference the correct TypeScript files or symbols in this
repo (or remove them). Replace references to handleRequest, availableLeasedIPs,
countReservedIPs, leasedIPStatus, and GetEndpointQuantityOfResourceGroup with
the actual TypeScript equivalents in apps/provider-inventory (e.g., the
inventory request handler, availability calculation, reserved-count logic,
leased IP status reporting, and endpoint-quantity function) or link to the
provider status fields (`provider.Inventory.LeasedIP` / `leased_ip.{allocatable,
allocated}`) directly so anchors resolve correctly.
Why
Adds details about leased ip docs. Ref CON-431
What
Summary by CodeRabbit