Skip to content

feat: validate_nodegroup_create — check the body before creating#41

Merged
vks-team merged 2 commits into
mainfrom
feat/validate-nodegroup-create
Jul 14, 2026
Merged

feat: validate_nodegroup_create — check the body before creating#41
vks-team merged 2 commits into
mainfrom
feat/validate-nodegroup-create

Conversation

@vks-team

Copy link
Copy Markdown
Contributor

What

The node-group symmetric of validate_cluster_create — but node-group bodies are assembled from a chain of zone-scoped ids, so this validates against live discovery too (all cached: called right after the discovery flow it costs zero extra API calls).

  • Local rules: name 5–15 chars (lowercase/digits/hyphens, letter/digit at both ends), autoScaleConfig.minSize <= maxSize, subnetId required.
  • Cross-checks: subnet belongs to the cluster's VPC (reuses _resolve_zone_context and its actionable errors), flavorId is an available worker flavor in the subnet's zone, diskType is a volume-type id in that zone, sshKeyId + securityGroups exist in the cluster's region.
  • Collects every problem in one pass, each pointing at the discovery tool that fixes it; "valid" otherwise.

Wiring: NodeGroupHandler shares the server's DiscoveryCache; the nodegroup guide gains a validate step before the plan (mirroring the cluster guide); create_nodegroup's workflow and SERVER_INSTRUCTIONS include the tool. Docs: 41 tools, Node group (10).

Verification

  • 7 new tests (valid, bad name, subnet-not-in-VPC, ghost flavor, bad diskType, ghost ssh key, multi-error collection); 275 total green.
  • Live: a body with 4 planted errors reports all 4 with the right fix-it tools (real zone HCM03-1B); a body assembled from real discovery returns "valid".

tytv2 added 2 commits July 14, 2026 18:29
Symmetric with validate_cluster_create, but node-group bodies are built
from a chain of zone-scoped ids, so this validates against live
discovery too (all cached — right after the discovery flow it costs
zero extra API calls):

- Local rules: name 5-15 chars (lowercase/digits/hyphens, letter/digit
  ends), autoScaleConfig.minSize <= maxSize, subnetId required.
- Cross-checks: subnet belongs to the cluster's VPC (via
  _resolve_zone_context, reusing its actionable errors), flavorId is an
  available worker flavor in the subnet's zone, diskType is a
  volume-type id in that zone, sshKeyId and securityGroups exist in the
  cluster's region.
- Collects EVERY problem in one pass, each pointing at the discovery
  tool that fixes it; returns "valid" otherwise.

NodeGroupHandler now shares the server's DiscoveryCache. The nodegroup
guide gains a validate step before the plan (mirroring the cluster
guide), the create_nodegroup docstring workflow includes it, and
SERVER_INSTRUCTIONS lists the tool in the chain. Docs: 41 tools.

Verified live: a body with 4 planted errors reports all 4 with the
right fix-it tools; a body assembled from real discovery returns
"valid".
@vks-team
vks-team merged commit ab78c03 into main Jul 14, 2026
8 checks passed
vks-team added a commit that referenced this pull request Jul 14, 2026
…F-05) (#43)

F-05a: validate said "valid" for an accented description while
create_cluster then died with the backend 400
(^[a-zA-Z0-9-_. @]{0,255}$). The validator now applies that exact
regex, and the constraint is stated everywhere an agent could miss it:
the CreateClusterComboDto.description field description ("ASCII only...
max 255"), the create_cluster docstring, and the cluster guide (the
"nhập tự do" wording was actively misleading).

F-05b: validate_nodegroup_create already shipped (#41) with the name
rule; what was missing is the rule in the SCHEMA — NodeGroupSpec.name
("Node group name") and CreateClusterComboDto.name now spell out the
5-15 / 5-20 charset rules, and the nodegroup guide names the full rule
instead of just "quá 15 ký tự".

Co-authored-by: tytv2 <tytv2@vng.com.vn>
vks-team added a commit that referenced this pull request Jul 14, 2026
74d168a was pushed directly to main (process violation, bypassed branch
protection) AND its premise was unproven: the field session that showed
tables without the id column may simply have predated the
instructions-level rule from #41 (instructions are only delivered at
initialize). Docstrings are the tool contract; client rendering
etiquette belongs at the instructions/skill layer.

This revert keeps the ## Presenting results rule in SERVER_INSTRUCTIONS
(#41). If a FRESH session still drops the id column, the docstring hint
can be re-landed through a proper PR with that evidence.

This reverts commit 74d168a06f2148633a5175908543cbd7a3743537.

Co-authored-by: tytv2 <tytv2@vng.com.vn>
vks-team added a commit that referenced this pull request Jul 14, 2026
…rge race) (#47)

* feat: instructions require the id column when rendering resources

Field finding: the agent rendered the cluster table without the ID
column — users then cannot reference resources in follow-up commands.
New "## Presenting results" rule in SERVER_INSTRUCTIONS (always show
each item's id next to its name; never drop the column), mirrored in
the getting-started principles. Locked by a test.

* feat: list_volume_types supports SSD — NVME by default, AUTO falls back

Both disk types exist per zone (probed live); the tool had NVME
hardcoded, making SSD invisible. New type_name param (pure enum, no
anyOf-null): AUTO (default) prefers NVME and falls back to SSD when the
zone has no NVME; NVME/SSD select explicitly. The output's type_name
field says which type the tiers belong to, and the nodegroup guide
explains the default/fallback/explicit-SSD rules.

validate_nodegroup_create now accepts diskType ids from EITHER type
(union of NVME + SSD tiers), so an explicit SSD choice is not flagged.

Also, per field feedback on rendered tables: the Presenting-results
rule now requires id and name as the FIRST two columns and forbids
truncating ids (instructions + getting-started principles).

Live-verified: AUTO->NVME (6 tiers), SSD->SSD (4 tiers) on HCM03-1B.

---------

Co-authored-by: tytv2 <tytv2@vng.com.vn>
@vks-team vks-team mentioned this pull request Jul 14, 2026
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