Skip to content

Land v-pkg: m-kids→v-pkg refile + KIDS lifecycle + waterline (Phase A)#2

Merged
rafael5 merged 13 commits into
mainfrom
refile-v-pkg
Jun 14, 2026
Merged

Land v-pkg: m-kids→v-pkg refile + KIDS lifecycle + waterline (Phase A)#2
rafael5 merged 13 commits into
mainfrom
refile-v-pkg

Conversation

@rafael5

@rafael5 rafael5 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Phase A stabilization. main is still the old m-kids; this lands the canonical v-pkg: the m-kids→v-pkg refile + importable pkgcli, dist/v-contract.json (+ drift gate), KIDS build-spec + deterministic v pkg build, the live-proven install/verify/uninstall lifecycle over mdriver.Client (M0a), the streamed-install fix, and the waterline layer-v tag + arch CI caller. A release tag (v0.1.0) follows so v-cli can pin it (drops its dev replace).

rafael5 and others added 13 commits June 11, 2026 21:56
Refile the KIDS tool as the first `v` CLI domain (VSL T0a.0):
- module path → github.com/vista-cloud-dev/v-pkg; binary → v-pkg; Makefile +
  doc comments updated (the round-trip semantics are unchanged).
- extract the 9 offline verbs (parse/decompose/assemble/roundtrip/canonicalize/
  lint) from package main into an importable `pkgcli.Commands`, so the `v`
  umbrella can mount them in-process as `v pkg <verb>` (static-pinned
  composition, v-cli-platform §3). The standalone `v-pkg` binary embeds the same
  Commands for top-level verbs. Behavior is the byte-identical py-kids-vc port.

Gates green: go build, go vet, go test ./... (roundtrip fixtures pass via the
renamed binary). NOTE: the GitHub repo rename m-kids→v-pkg is a separate
user-run gh op (sandbox-blocked for me); this branch pushes to the current
remote and will sit in v-pkg after the rename.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add the v CLI domain command-surface contract (v-cli-platform.md §4): a
`vcontract.Manifest` reflected from the live kong command tree (reusing
clikit.BuildSchema, so it can't drift from the real verbs), exposed as
`pkgcli.Contract()`. Carries domain/version/contractVersion + the exit-code
ladder + the full command tree. dist/v-contract.json is the committed artifact;
a golden test is the drift gate (`make contract` to regenerate, `make
check-contract` to verify). .gitignore keeps dist/*.json (un-ignores the
artifact while still ignoring binaries); clean preserves it.

Gates: gofmt, go vet, go test ./... green (contract golden + invariants).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add internal/buildspec: the declarative, diffable git source of a KIDS BUILD
(#9.6) — kids/<pkg>.build.json (coordination plan §7.2). Spec carries the
component list (routines, FileMan file #s, options, security keys, XPAR params,
protocols/templates/RPCs/mail-groups/HL7), Required Builds (#11) with their
install action, the env-check routine (XPDENV), and the ICR list. Parse/Load
reject unknown fields (a typo is an error) and validate: namespace/version/patch
format, ≥1 component, M routine names (≤8), required-build name + action enum,
env-check routine, positive ICR numbers. InstallName() = NAMESPACE*VERSION[*PATCH].
This is what `v pkg build` will consume (T0a.2+).

Tests: valid/invalid table + file Load + a testdata/zzskel.build.json fixture;
gofmt/vet/test green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… (T0a.2)

Add the spec-driven `v pkg build`: load kids/<pkg>.build.json (T0a.1), read the
routine source, construct the ^XPD BUILD pairs (kids.MakeBuildPairs: BLD header +
RTN sections + VER) with volatile fields NORMALIZED (build date 0, routine
checksums stripped), and WriteKID a normalized .KID. Same spec+source → a
byte-identical export (deterministic-build invariant, coordination plan §7.2 #2);
distinct from `assemble` (which reassembles an existing decomposed tree).

Add the ZZSKEL throwaway package (one routine + its build spec) under testdata/,
and the deterministic-build gate: build twice → byte-identical + golden
ZZSKEL.kids. dist/v-contract.json regenerated (build verb added).

NOTE: the export's KIDS-installability is proven at T0a.3 (live FOIA via
VistaEngine); this increment proves determinism + spec consumption. Real routine
checksums are computed at install, not baked into the diffable artifact.

Gates: gofmt, go vet, go test ./... green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Corrected the Tier-A install design with the real, corpus-confirmed KIDS entry
points (Kernel 8.0 DG/SM KIDS UG + TM): load = EN1^XPDIL (HFS → ^XTMP + INSTALL
#9.7), install = EN^XPDIJ(xpda) (ICR 2243, by #9.7 IEN) / EN^XPDI; answer
suppression via XPDDIQ("XPZ1"/"XPO1"/"XPI1")=0; phase via XPDENV; result via
INSTALL #9.7 STATUS (#.02)="Install Completed" + PACKAGE #9.4 patch history.
The unconfirmed $$LOAD^XPDID / D INSTALL candidates were wrong and removed.
Caveat recorded: param signatures + non-interactive driving need %RO/live
confirmation (no XPD* source in the corpus) — a live FOIA engine is still
required to finalize the driver (M0a's deepest unknown). §11 Q1 resolved.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add internal/installspec: the JSON form of the install answers `v pkg install`
feeds a non-interactive KIDS install (docs/kids-installation-automation.md §5) —
source (hfs|packman), environmentCheck (run|skip), the four standard KIDS
answers, device/queue, and build-specific extraAnswers. Parse/Load reject
unknown fields + validate name/source/envcheck/delay. Answers.XPDDIQ() maps the
standard answers onto the KIDS XPO1/XPI1/XPZ1 answer codes (the prompt-suppress
mechanism confirmed by the T0a.3 corpus research).

This is the declarative input for the install driver. The driver itself (driving
EN1^XPDIL/EN^XPDIJ over the VistaEngine) needs a live FOIA engine + %RO
confirmation of the routine signatures — M0a's deepest unknown, the user's live
session. Gates: gofmt/vet/test green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drove the full KIDS lifecycle end-to-end on a live worldvista/vehu engine
(GT.M V7.0-005), installing v pkg build's ZZSKEL artifact: EN1^XPDIL load
(2 stdin answers; the build's layout matches GI's parser) → EN^XPDIJ
synchronous install (no prompts for routine-only; DUZ(0)="@") → #9.7 status
3 "Install Completed", routine installed and executes ($$PING^ZZSKEL→pong).
Reversible uninstall via ^%ZOSF("DEL") + DIK ×2; snapshot→install→uninstall
→diff returns the engine to pre-install. Documents the corrupt-0-node gotcha
and the non-interactive-load design point for v pkg install over the driver.
Closes §11 Q1 (silent-install entry points).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rators

The direct-populate path (kids-installation-automation.md §7.1), live-proven on
YDB FOIA: instead of the interactive EN1^XPDIL host-file load (which prompts and
can't be fed over the driver's subprocess+JSON Exec), InstallScript creates the
#9.7 entry via the real $$INST^XPDIL1, populates ^XTMP("XPDI",XPDA,…) directly
from the parsed .KID pairs, then runs synchronous EN^XPDIJ. VerifyScript reports
#9.7 presence/status + per-routine load; UninstallScript reverses a routine-only
install (^%ZOSF("DEL") + DIK on #9.7/#9.6). Each emits parseable <<VPKG>>key=val
result lines for the driver layer. New kids.MString / Subs.MRef render M source.

All three generators live-validated end-to-end on worldvista/vehu: install →
status=3 + $$PING^ZZSKEL→pong, verify → installed=1, uninstall → installed=0
(reversible). Already-installed guard prevents a re-install prompt-hang.

Tests TDD-first (installspec 91.4% cover). Remaining: mount as `v pkg install/
verify/uninstall` verbs running these over the m-ydb/m-iris driver Exec.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…M0a)

Mount the live KIDS lifecycle verbs on the install-script generators
(internal/installspec), reaching a live engine through the shared
m-driver-sdk reference Client (pinned v0.3.0) — the m/v waterline: KIDS
knowledge stays in v-pkg, the engine transport is consumed from m.

Each verb generates a one-shot M script, wraps it as a scratch routine
(ZVPKG{INS,VFY,UNI}), stages it via `exec load`, and runs EN^<rtn> via
`exec run` — one driver process is one symbol table, so XPDA survives the
SETs the direct-`^XTMP` install needs. The Client exposes no script verb
(only load/run/eval), so routine-wrap + exec-run is the path, not
eval-per-line. Results are read from `<<VPKG>>key=value` markers scanned
off the captured device output.

- pkgcli/lifecycle.go: engineConn (--engine/--transport), runMScript,
  wrapRoutine, parseMarkers, runInstall/runVerify/runUninstall + the
  install/verify/uninstall commands.
- kids.Build.RoutineNames(): the RTN component names verify/uninstall need.
- dist/v-contract.json regenerated with the three new verbs.

YDB FOIA live-proven for the generated sequence (T0a.3/T0a.4); the live
lifecycle over the driver on the IRIS FOIA engine (T0a.5) is the M0a exit
gate and is still pending. v-cli registry regen owed in a v-cli session.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A driver can report no fault yet stage nothing — e.g. m-ydb's docker
`exec load` errors BAD_CONFIG (no routine source dir) in the envelope's
`error`, which mdriver.Client.Load does not surface, so Load returns a
clean result with empty Loaded. runMScript would then run EN^<rtn> and
fail with a confusing %YDB-E-ZLINKFILE. Refuse up front when the driver
loaded no routine, so the cause points at staging, not the run.

Surfaced while attempting T0a.5 live over the m-ydb driver against vehu.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tial-install

v pkg install built ONE scratch routine embedding every ^XTMP("XPDI",XPDA,…)
SET, then ran it. Fine for a 1-routine fixture (ZZSKEL), but a real package's
transport global makes that routine huge — the 15-routine MSL base (~6100 nodes
/ ~560 KB) produced a ~560 KB install routine that the driver's routine staging
silently truncates, so only the first ~3 routines landed while EN^XPDIJ still
reported #9.7 status 3 (T0b.2 discoveries P1). v-pkg generated the correct full
script; the loss was entirely in staging the giant routine.

Fix — stream, don't embed:
- installspec.StageChunks(pairs, maxBytes): render the pairs as several small
  routine bodies (≤40 KB) that populate a staging global ^XTMP("VPKGI",…); the
  first body clears it. runInstall runs each (load+run); the global persists
  across the stateless driver processes, accumulating the whole tree.
- installspec.FinalInstallScript: a constant-size routine that COUNTS the staged
  nodes and refuses with error=stage-incomplete unless the count matches (a
  silent truncation now fails loudly), then INST → MERGE the staged tree into
  ^XTMP("XPDI",XPDA) → EN^XPDIJ, all in one process so XPDA survives. The MERGE
  makes the install routine size-independent of the package.
- runInstall surfaces stage-incomplete as an error (not already-installed).

Removed InstallScript (the one-routine generator).

TDD: TestStageChunks_CoversAllPairsBounded, TestFinalInstallScript,
TestRunInstall_MultiChunkStages. go test -race ./..., vet, gofmt, contract
no-drift: green. Live on YDB FOIA vehu: the full 15-routine MSL base installs
(all $T(^STD*)=1, status 3), m-stdlib suites pass test-in-place (15/15, 1403
assertions), uninstall reversible. IRIS validation of the chunked path owed
(T0b.2 IRIS leg).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add repo.meta.json with "layer": "v" so `m arch check` reads v-pkg's
side of the m/v waterline. v-pkg is VistA-specific (KIDS / the `v pkg`
domain); it passes G1 trivially (v → m allowed) but carries the tag so
the gate runs everywhere with no exception. The layer is a repo
property, so it lives in repo.meta.json (not the per-domain, generated
dist/v-contract.json).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add the arch job calling vista-cloud-dev/.github
arch-waterline.yml@main, so `m arch check` (the G1 dependency-direction
gate) runs in CI on every push/PR — the ADR §3.3 'no exception'
enforcement, not just the local make gate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rafael5 rafael5 merged commit 4ed0c85 into main Jun 14, 2026
6 checks passed
@rafael5 rafael5 deleted the refile-v-pkg branch June 14, 2026 12:47
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