tenseleyflow/documentlanguagemodel / f6aba6c

Browse files

Bootstrap manifest on first train of a hand-authored .dlm

Trainer's load_manifest call expected the file present, but a .dlm authored without 'dlm init' (LSP / VSCode flow, or hand-edited) only has the on-disk store after ensure_layout(). Drop the just_scaffolded gate so any never-init'd doc gets a fresh manifest before the load.
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
f6aba6cfd119f82e60e99b8fcda92d9446472538
Parents
be9fc89
Tree
d2f5104

1 changed file

StatusFile+-
M src/dlm/cli/commands.py 9 5
src/dlm/cli/commands.pymodified
@@ -879,11 +879,15 @@ def train_cmd(
879879
     store = for_dlm(parsed.frontmatter.dlm_id)
880880
     store.ensure_layout()
881881
 
882
-    # `dlm init` writes a manifest as part of store provisioning. When
883
-    # we just scaffolded a fresh `.dlm`, mirror that manifest write
884
-    # here too. Guarded by exists() so --rescaffold (same dlm_id,
885
-    # prior store) preserves training history.
886
-    if just_scaffolded and not store.manifest.exists():
882
+    # `dlm init` writes a manifest as part of store provisioning. Mirror
883
+    # that manifest write here when the store layout exists but has no
884
+    # manifest yet — covers two flows:
885
+    #   - auto-scaffold via `dlm train <dir>` (just_scaffolded path)
886
+    #   - hand-authored .dlm with a fresh ULID that never went through
887
+    #     `dlm init` (e.g. authored via the LSP / VSCode extension)
888
+    # License acceptance has already been validated upstream by this
889
+    # point, so we just record it.
890
+    if not store.manifest.exists():
887891
         from dlm.base_models import is_gated
888892
         from dlm.base_models.license import require_acceptance
889893
         from dlm.store.manifest import Manifest, save_manifest