Skip to content

docs: adds details about leased IP gate in resource matching doc - #3260

Merged
stalniy merged 1 commit into
mainfrom
docs/leased-ips
Jun 3, 2026
Merged

docs: adds details about leased IP gate in resource matching doc#3260
stalniy merged 1 commit into
mainfrom
docs/leased-ips

Conversation

@stalniy

@stalniy stalniy commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Why

Adds details about leased ip docs. Ref CON-431

What

Summary by CodeRabbit

  • Documentation
    • Enhanced documentation for leased public IP handling in resource matching processes.
    • Added detailed acceptance criteria explaining how leased IP availability is computed and allocated across clusters.
    • Expanded failure codes and error scenarios to clarify IP resource constraint handling and troubleshooting.

@stalniy
stalniy enabled auto-merge June 3, 2026 10:17
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This 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.

Changes

Leased IP Specification

Layer / File(s) Summary
Leased IP concept, criteria, and failure codes
apps/provider-inventory/docs/resource-matching-acceptance-criteria.md
Scope clarification defines leased IP checks as cluster-level pre-check. Core concepts updated to emphasize provider-wide pool. Fatal example added for insufficient free IPs. New acceptance criteria AC18–AC21 define request counting by unique endpoint sequence numbers, availability computation (allocatable minus allocated, including unconfirmed), cluster rejection logic, provider-support behavior, and zero-IP bypass treatment. Failure codes extended with two leased-IP-specific errors.
Implementation reference links
apps/provider-inventory/docs/resource-matching-acceptance-criteria.md
Implementation references added for inventory service leased-IP enforcement: request gate, availability/reservation math, endpoint request counting, and leased-IP status fields.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • akash-network/console#3234: Introduces the same resource-matching acceptance-criteria documentation centered on tryAdjust/Adjust and extends it with leased public IP cluster-level pre-check rules.

Suggested labels

size: XS, experienced-contributor

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/leased-ips

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Auto-approved: all changes are related to documentation.

@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.43%. Comparing base (87d6ee9) to head (08eb555).
✅ All tests successful. No failed tests found.

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     
Flag Coverage Δ *Carryforward flag
api 84.72% <ø> (ø) Carriedforward from 87d6ee9
deploy-web 51.42% <ø> (ø) Carriedforward from 87d6ee9
log-collector ?
notifications 91.06% <ø> (ø) Carriedforward from 87d6ee9
provider-console 81.38% <ø> (ø) Carriedforward from 87d6ee9
provider-inventory 81.85% <ø> (ø)
provider-proxy 86.37% <ø> (ø) Carriedforward from 87d6ee9
tx-signer ?

*This pull request uses carry forward flags. Click here to find out more.
see 40 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stalniy
stalniy added this pull request to the merge queue Jun 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 87d6ee9 and 08eb555.

📒 Files selected for processing (1)
  • apps/provider-inventory/docs/resource-matching-acceptance-criteria.md

Comment on lines +273 to +282
### 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify GetEndpointQuantityOfResourceGroup function exists and check its signature

rg -n "func GetEndpointQuantityOfResourceGroup" --type=go -A 10

Repository: 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 . || true

Repository: 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 || true

Repository: 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' . || true

Repository: 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.

  • GetEndpointQuantityOfResourceGroup isn’t implemented anywhere in the repo (only referenced in apps/provider-inventory/docs/resource-matching-acceptance-criteria.md).
  • The linked file apps/provider-inventory/cluster/util/endpoint_quantity.go also 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.

Comment on lines +361 to +366
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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 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 2

Repository: 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)" . || true

Repository: 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.

Merged via the queue into main with commit 05b8f58 Jun 3, 2026
57 checks passed
@stalniy
stalniy deleted the docs/leased-ips branch June 3, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant