Skip to content

feat(seed): Seed-Profile (seed --profile, timeouts.seedMs) - #4

Merged
n-hallberg merged 2 commits into
mainfrom
feat/seed-profiles
Sep 14, 2026
Merged

n-hallberg merged 2 commits into
mainfrom
feat/seed-profiles

Conversation

@n-hallberg

@n-hallberg n-hallberg commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Seed-Profile im CLI, passend zum Fleet-Contract just dev-seed <profile>: Mynds Executor ruft künftig nach dev-start und vor dev-auth einmal just dev-seed full (5 min, ein Versuch, Fehler = Warnung). Repos, die das CLI nutzen, bekommen dasselbe über dev-contract seed --profile full.

  • Config: der bestehende seed-Block (command/function/args) bleibt das Profil base (abwärtskompatibel). Neu seed.profiles: Record<name, { command?, function?, args? }>; profiles.base darf den Top-Level-Block ersetzen, beides zugleich ist ein Config-Fehler beim Laden. full ist die Konvention für die Test-Fixture. Profilnamen sind shell-sicher ([A-Za-z0-9_-]). Ein Block nur mit profiles (ohne base) ist erlaubt — start seedet dann nichts.
  • timeouts.seedMs (Default 300 000) gilt je Seed für command und function; bisher galten die 120 s aus runCommand, das ist für Fixtures zu knapp. runConvexFunction nimmt timeoutMs entgegen, die Timeout-Diagnose nennt das Budget ([timeout] killed after N ms). Alle timeouts.* werden beim Laden als positive Zahl validiert.
  • dev-contract seed [--profile <name>] (Default base): unbekanntes Profil → Exit 1 mit [seed] unknown profile <name> (configured: …) auf stderr; letzte stdout-Zeile { "ok": true, "profile": "full", "ran": ["command","function"] }. --profile bei einem anderen Befehl ist ein Fehler statt still ignoriert.
  • dev-contract start seedet weiterhin nur base (Aufruf jetzt explizit performSeed(config, 'base')), überspringt mit Log, wenn kein base konfiguriert ist.
  • performSeed(config, profile) ist strikt: fehlendes Profil (auch: kein seed-Block) ist ein [seed]-Fehler, kein stiller No-op. Resolved-Config-Form ist jetzt seed.profiles (deshalb Minor-Bump); SeedOutput.profile neu; BASE_SEED_PROFILE, SeedProfile, SeedProfileConfig exportiert.
  • README (Seeding mit Profilen, Commands, just dev-seed-Rezept, Consumer-Hinweis für Mynd), devcontract.config.example.json, Version 0.2.0.

Tests

  • pnpm run ci lokal grün (prettier, eslint, tsc, cspell, vitest — 97 Tests).
  • Neu: Config-Auflösung Top-Level + profiles, profiles.base als Ersatz, profiles-only, Konflikt, ungültige Profilnamen/Profile, Timeout-Validierung; performSeed wählt das Profil, unbekanntes Profil läuft nichts, seedMs wird an runCommand und runConvexFunction durchgereicht; runStart seedet nur base bzw. überspringt ohne base; runSeed --profile full, unbekanntes Profil ohne seed-Block.
  • Manuell mit gebautem CLI und Temp-Config: seed --profile nightly[seed] unknown profile nightly (configured: base, full), Exit 1; seed --profile full / seed → korrekte JSON-Zeile; start --profile full → Fehler; Konflikt-Config → [config]-Fehler.

Follow-ups

  • npm-Release 0.2.0 (pnpm run release:minor nach dem Merge) und Bump in den CLI-Nutzern (z. B. ki-at-obv) inkl. dev-seed-Rezept im justfile.
  • Mynd-Executor: just dev-seed full zwischen dev-start und dev-auth aufrufen (separater PR in mynd).

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the previous findings are fully addressed and no new actionable failures remain.

Summary

  • start runs only the optional base profile between provisioning and login.
  • Manual seeding validates the requested profile before applying the deployment guard.
  • Seed commands and Convex functions receive the configured timeouts.seedMs budget.
  • Configuration validation covers profile names, profile conflicts, argument objects, and positive timeout values.
  • All four previous findings are fully fixed: profile lookup uses own properties on a null-prototype map, empty profile values are preserved and rejected, null arguments fail validation, and unknown profiles are resolved before the deployment guard.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[CLI loads and resolves config] --> B{Command}
    B -->|start| C[Backend ready and provisioned]
    C --> D{Base profile configured?}
    D -->|Yes| E[Run base seed]
    D -->|No| F[Skip seeding]
    E --> G[Start app and verify login]
    F --> G
    B -->|seed --profile name| H[Resolve requested profile]
    H -->|Unknown| I[Seed error]
    H -->|Configured| J[Validate development deployment]
    J --> K[Run command with seedMs timeout]
    K --> L[Run Convex function with seedMs timeout]
    L --> M[Emit profile and ran result]
Loading

Reviews (2) · Last reviewed commit: "Seed-Profile: Greptile-Findings (eigene ..."

Comment thread src/seed.ts Outdated
Comment thread src/cli.ts Outdated
Comment thread src/config.ts Outdated
Comment thread src/commands.ts
@n-hallberg

Copy link
Copy Markdown
Contributor Author

@greptile Alle vier Findings sind in 62c091d gefixt (null-prototype Profil-Map + Object.hasOwn, leeres --profile, args null, Profilauflösung vor dem Guard). Bitte erneut reviewen.

…just dev-seed)

Der bisherige seed-Block bleibt als Profil "base" erhalten; weitere Profile
liegen in seed.profiles (Konvention: "full" = komplette Test-Fixture, die
Mynd nach dev-start und vor dev-auth einmal ausführt). profiles.base darf
den Top-Level-Block ersetzen, beides zugleich ist ein Config-Fehler.

- dev-contract seed [--profile <name>] wählt das Profil (Default base);
  unbekanntes Profil endet mit "[seed] unknown profile <name>" und Exit 1.
- start seedet weiterhin nur base und überspringt, wenn keins konfiguriert ist.
- timeouts.seedMs (Default 300 s) gilt je Seed für command und function;
  die 120 s aus runCommand waren für Fixtures zu knapp. Timeout-Diagnose
  nennt jetzt das Budget.
- SeedOutput trägt "profile"; Timeouts werden beim Laden validiert.
- README (Seeding, Commands, just-Rezept dev-seed, Consumer-Hinweis),
  Beispielconfig, Tests; Version 0.2.0 wegen neuer Config-Felder.
…null, Diagnose vor Guard)

- Profil-Map ohne Prototyp + Object.hasOwn-Lookup: "toString" & Co. laufen
  nicht mehr als leeres Profil durch, ein Profil namens "__proto__" bleibt
  ein normaler Key.
- seed --profile '' wird nicht mehr als "kein --profile" gelesen (unbekanntes
  Profil statt stillem base).
- args: null fällt in der Config-Validierung durch (typeof null).
- runSeed löst das Profil vor dem Deployment-Guard auf, damit ein
  Config-Tippfehler nicht hinter [guard] verschwindet.
- hasSeedProfile/resolveSeedProfile exportiert; Tests für alle vier Fälle.
@n-hallberg
n-hallberg merged commit 5cfe6d5 into main Sep 14, 2026
2 checks passed
@n-hallberg
n-hallberg deleted the feat/seed-profiles branch September 14, 2026 14:23
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