Skip to content

Commit 3e75094

Browse files
committed
Ignore parking lot docs in doc dag
1 parent c749a02 commit 3e75094

4 files changed

Lines changed: 59 additions & 5 deletions

File tree

internal/dun/doc_dag.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ func loadDocNodes(root string) (map[string]*DocNode, map[string]*DocNode, []Issu
215215
if !frontmatter.HasFrontmatter || strings.TrimSpace(frontmatter.Dun.ID) == "" {
216216
return nil
217217
}
218+
if frontmatter.Dun.ParkingLot {
219+
return nil
220+
}
218221
if frontmatter.Dun.Review.Deps == nil {
219222
frontmatter.Dun.Review.Deps = make(map[string]string)
220223
}

internal/dun/doc_dag_test.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,3 +355,49 @@ dun:
355355
t.Fatalf("expected invalid issue, got %#v", graph.Issues)
356356
}
357357
}
358+
359+
func TestBuildDocGraphSkipsParkingLotDocs(t *testing.T) {
360+
root := t.TempDir()
361+
parkedDir := filepath.Join(root, "docs", "helix", "02-design", "adr")
362+
if err := os.MkdirAll(parkedDir, 0755); err != nil {
363+
t.Fatalf("mkdir parked dir: %v", err)
364+
}
365+
activeDir := filepath.Join(root, "docs", "helix", "01-frame")
366+
if err := os.MkdirAll(activeDir, 0755); err != nil {
367+
t.Fatalf("mkdir active dir: %v", err)
368+
}
369+
370+
parked := `---
371+
dun:
372+
id: ADR-008
373+
parking_lot: true
374+
depends_on:
375+
- PRD-001
376+
---
377+
# Parked ADR
378+
`
379+
if err := os.WriteFile(filepath.Join(parkedDir, "ADR-008-parked.md"), []byte(parked), 0644); err != nil {
380+
t.Fatalf("write parked: %v", err)
381+
}
382+
383+
active := `---
384+
dun:
385+
id: PRD-001
386+
---
387+
# PRD
388+
`
389+
if err := os.WriteFile(filepath.Join(activeDir, "prd.md"), []byte(active), 0644); err != nil {
390+
t.Fatalf("write active: %v", err)
391+
}
392+
393+
graph, err := buildDocGraph(root)
394+
if err != nil {
395+
t.Fatalf("build graph: %v", err)
396+
}
397+
if _, ok := graph.Nodes["ADR-008"]; ok {
398+
t.Fatalf("expected parking lot doc to be skipped")
399+
}
400+
if _, ok := graph.Nodes["PRD-001"]; !ok {
401+
t.Fatalf("expected active doc to be included")
402+
}
403+
}

internal/dun/frontmatter.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ type Frontmatter struct {
1616
}
1717

1818
type DunFrontmatter struct {
19-
ID string `yaml:"id"`
20-
DependsOn []string `yaml:"depends_on"`
21-
Prompt string `yaml:"prompt"`
22-
Inputs []string `yaml:"inputs"`
23-
Review DocReview `yaml:"review"`
19+
ID string `yaml:"id"`
20+
DependsOn []string `yaml:"depends_on"`
21+
Prompt string `yaml:"prompt"`
22+
Inputs []string `yaml:"inputs"`
23+
Review DocReview `yaml:"review"`
24+
ParkingLot bool `yaml:"parking_lot"`
2425
}
2526

2627
type DocReview struct {

internal/dun/frontmatter_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dun:
1616
prompt: prompts/test.md
1717
inputs:
1818
- node:parent.doc
19+
parking_lot: true
1920
review:
2021
self_hash: abc123
2122
deps:
@@ -43,6 +44,9 @@ Body`
4344
if len(frontmatter.Dun.Inputs) != 1 || frontmatter.Dun.Inputs[0] != "node:parent.doc" {
4445
t.Fatalf("unexpected inputs: %#v", frontmatter.Dun.Inputs)
4546
}
47+
if !frontmatter.Dun.ParkingLot {
48+
t.Fatalf("expected parking_lot true")
49+
}
4650
if frontmatter.Dun.Review.SelfHash != "abc123" {
4751
t.Fatalf("unexpected self hash: %q", frontmatter.Dun.Review.SelfHash)
4852
}

0 commit comments

Comments
 (0)