feat: complete catalog-driven preprocessing
Publish documentation / publish (push) Successful in 2m12s

This commit is contained in:
Codex
2026-09-06 17:49:35 +02:00
parent 8707ae1d46
commit cffa60772e
141 changed files with 5898 additions and 3015 deletions
+5 -8
View File
@@ -83,14 +83,11 @@ Commands:
Verify a terminal installation, remove stale lifecycle files, and clear maintenance.
pi logs Show the latest 200 sanitized core log lines (bounded; no follow mode).
workspace inspect --workspace ID [--json]
Inspect the active registry snapshot for one workspace.
workspace preprocess dwh --workspace ID [--resume RUN] [--json]
workspace schema suggest-fks --workspace ID [--from-sql FILE]... [--assume COLUMN=TABLE]... [--output FILE] [--json]
workspace schema check --workspace ID [--annotations FILE --reviewed-candidates sha256:HEX] [--json]
workspace schema accept --workspace ID --run RUN --yes [--json]
workspace index-schema --workspace ID [--json]
workspace preprocess evidence --workspace ID [--dry-run] [--resume RUN] [--json]
workspace preprocess run --workspace ID [--resume RUN] [--json]
Inspect the active registry snapshot for one workspace.
workspace preprocess run --workspace ID [--json]
Rebuild Catalog metadata, LSH, schema/Evidence vectors, then enable the core.
workspace preprocess clear --workspace ID [--json]
Clear schema/Evidence vectors and LSH while preserving workspace memory.
`
var (
+10 -18
View File
@@ -1255,28 +1255,20 @@ func TestRunWorkspaceInspectDispatchesThroughTheMaintenanceService(t *testing.T)
assertInvocationContains(t, fixture.invocations(t), "workspace-maintenance", "inspect")
}
func TestRunWorkspaceBlockedResultsExitThreeAndRenderHumanOutput(t *testing.T) {
func TestRunWorkspaceRejectsRemovedSchemaCommandsBeforeDocker(t *testing.T) {
fixture := newCLIFixture(t, "SAFE_VALUE=1\n")
fixture.setEnvironment(t)
t.Setenv("THT_FAKE_WORKSPACE_RESULT", `{"schemaVersion":1,"status":"blocked","code":"manual_review_required","workspaceId":"abc","workspaceRevision":"1234567890abcdef1234567890abcdef12345678","descriptorBlob":"sha256:`+strings.Repeat("b", 64)+`","operation":"schema-suggest-fks","completedStages":["dwh"],"warnings":["review required"]}`)
var stdout, stderr bytes.Buffer
exitCode := run(context.Background(), []string{"--installation", fixture.installationPath, "workspace", "schema", "suggest-fks", "--workspace", "abc"}, &stdout, &stderr)
if exitCode != 3 {
t.Fatalf("run() exit code = %d, want 3", exitCode)
if exitCode != 2 {
t.Fatalf("run() exit code = %d, want 2", exitCode)
}
for _, expected := range []string{"workspace: abc", "status: blocked", "warning: review required"} {
if !strings.Contains(stdout.String(), expected) {
t.Fatalf("stdout = %q, missing %q", stdout.String(), expected)
}
}
if strings.Contains(stdout.String(), "descriptorBlob") || strings.Contains(stdout.String(), strings.Repeat("b", 64)) {
t.Fatalf("stdout leaked non-allowlisted fields: %q", stdout.String())
}
if stderr.Len() != 0 {
if !strings.Contains(stderr.String(), `unknown workspace command "schema"`) {
t.Fatalf("stderr = %q", stderr.String())
}
assertDockerNotInvoked(t, fixture)
}
func TestRunWorkspaceRequiresWorkspaceFlagBeforeDocker(t *testing.T) {
@@ -1317,26 +1309,26 @@ func TestRunWorkspaceRejectsDuplicateWorkspaceFlagsBeforeDocker(t *testing.T) {
assertDockerNotInvoked(t, fixture)
}
func TestRunWorkspaceRejectsInvalidResumeRunIDsBeforeDocker(t *testing.T) {
func TestRunWorkspaceRejectsResumeOnOneShotPreprocessingBeforeDocker(t *testing.T) {
fixture := newCLIFixture(t, "SAFE_VALUE=1\n")
fixture.setEnvironment(t)
var stdout, stderr bytes.Buffer
exitCode := run(context.Background(), []string{
"--installation", fixture.installationPath,
"workspace", "preprocess", "dwh", "--workspace", "abc", "--resume", "not-a-run-id",
"workspace", "preprocess", "run", "--workspace", "abc", "--resume", "not-a-run-id",
}, &stdout, &stderr)
if exitCode != 2 {
t.Fatalf("run() exit code = %d, want 2", exitCode)
}
if !strings.Contains(stderr.String(), "--resume") || !strings.Contains(stderr.String(), "32 lowercase hex") {
if !strings.Contains(stderr.String(), "--resume") || !strings.Contains(stderr.String(), "unknown workspace option") {
t.Fatalf("stderr = %q", stderr.String())
}
assertDockerNotInvoked(t, fixture)
}
func TestRunWorkspaceSchemaCheckRequiresReviewedCandidatesWithAnnotations(t *testing.T) {
func TestRunWorkspaceRejectsRemovedSchemaCheckBeforeDocker(t *testing.T) {
fixture := newCLIFixture(t, "SAFE_VALUE=1\n")
fixture.setEnvironment(t)
annotations := filepath.Join(fixture.root, "annotations.yaml")
@@ -1353,7 +1345,7 @@ func TestRunWorkspaceSchemaCheckRequiresReviewedCandidatesWithAnnotations(t *tes
if exitCode != 2 {
t.Fatalf("run() exit code = %d, want 2", exitCode)
}
if !strings.Contains(stderr.String(), "--reviewed-candidates") {
if !strings.Contains(stderr.String(), `unknown workspace command "schema"`) {
t.Fatalf("stderr = %q", stderr.String())
}
assertDockerNotInvoked(t, fixture)