Skip to content

feat(dev): refuse a project the environment's stack slots can't hold before loading - #479

Merged
adiman9 merged 3 commits into
mainfrom
feat/dev-up-quota-preflight
Oct 30, 2026
Merged

adiman9 merged 3 commits into
mainfrom
feat/dev-up-quota-preflight

Conversation

@adiman9

@adiman9 adiman9 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #475 (feat/dev-edge), which loads arete.lock stacks in a4 dev up.

a4 dev up checks the environment's stack slots before it loads anything. A project whose stacks don't fit is refused with every stack named, the slots each needs, the dev tier and how to raise it; nothing is loaded.

What changed

  • New cli/src/commands/dev/quotas.rs: reads GET /api/dev/quotas (limits.maxStacksPerEnvironment, tier) and the environment's stack listing, then plans what this run loads: every registry stack arete.lock pins (lock_stacks, one per live alias), the protocol's generated stack and the project's own stacks. Stacks the environment already holds cost no slot: a registry package's aliases count as loaded up to the deployments the environment holds for it, an authored StackManifest is expanded into one stack per live alias (as a4 dev up deploys them) and matched by name, and the protocol stack by slug. An API that reports no limit skips the check.
  • Called at the top of start() in up.rs, before the protocol deploy, load_lock_stacks and deploy_project_stacks.
  • a4 doctor's account.dev-environments adds "N stacks per environment" when the API reports it.

Tests

  • a_project_over_the_free_tier_is_refused_with_every_stack_named, lock_stacks_count_before_any_loads (free tier, one slot left, three lock stacks of which one is loaded: refused naming each), stacks_that_fit_or_reload_pass, the_plan_matches_loaded_stacks_by_name_and_protocol; doctor detail with stack slots.
  • Ran locally: nothing (overloaded shared machine). CI only: build and tests, green.

Notes

  • Registry stacks are matched per package by count, not by version: a held deployment of another version of the package counts as loaded here (the server still enforces the limit).

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previously reported test failure is fixed.

Summary

Adds a stack-slot check before a4 dev up loads stacks, and shows the per-environment limit in a4 doctor.

  • a4 dev up checks stack slots before it starts deployment work.
  • a4 doctor shows how many stacks each environment can hold.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[a4 dev up] --> B[Read quota and held stacks]
  B --> C[Count stacks that need new slots]
  C --> D{Enough slots?}
  D -->|No| E[Refuse before loading]
  D -->|Yes| F[Load protocol, registry, and project stacks]
Loading

Reviews (3) · Last reviewed commit: "test(dev): the full-tier case for lock s..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
arete-docs Ready Ready Preview Oct 29, 2026 5:06am UTC

Request Review

Comment thread cli/src/commands/dev/quotas.rs Outdated
Comment thread cli/src/commands/dev/quotas.rs Outdated
Comment thread cli/src/commands/dev/quotas.rs Outdated
Base automatically changed from feat/dev-edge to main October 30, 2026 01:12
@adiman9
adiman9 merged commit 31240d9 into main Oct 30, 2026
35 checks passed
@adiman9
adiman9 deleted the feat/dev-up-quota-preflight branch October 30, 2026 02:26

This branch was successfully deployed

1 active deployment
Preview — 77d3b26e Deployed Oct 29, 2026 by vercel[bot]
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