feat(pipeline): write into wiki/<wing>/{sources,facts}/ when Config.Wing is set (#205 S2)
Sources -> wiki/<wing>/sources, concepts/entities -> wiki/<wing>/facts with kind: frontmatter; inventory, title resolution and back-references are confined to the target wing. Empty Wing keeps the retired layout unchanged. Mutation-checked: widening the inventory beyond the wing fails the cross-wing back-reference test; a non-plain wing name is rejected. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -35,17 +35,17 @@ func TestReadSourcePageAndSchemaRefuseSymlinksAndSurviveSwapRaces(t *testing.T)
|
||||
inBrain := brainfstest.WriteSentinelAt(t, filepath.Join(brain, "raw", "s.md"))
|
||||
require.NoError(t, os.WriteFile(filepath.Join(brain, "wiki", "sources", "ok.md"), []byte("zqinside source"), 0o644))
|
||||
require.NoError(t, os.WriteFile(filepath.Join(brain, "schema.md"), []byte("zqinside schema"), 0o644))
|
||||
assert.Equal(t, "zqinside source", readSourcePage(brain, "ok"), "positive control")
|
||||
assert.Equal(t, "zqinside source", readSourcePage(brain, "", "ok"), "positive control")
|
||||
assert.Equal(t, "zqinside schema", loadSchema(brain), "positive control")
|
||||
|
||||
require.NoError(t, os.Symlink(brainfstest.Outside(t), filepath.Join(brain, "wiki", "sources", "out.md")))
|
||||
require.NoError(t, os.Symlink(filepath.Join("..", "..", "raw", "s.md"), filepath.Join(brain, "wiki", "sources", "in.md")))
|
||||
assert.NotContains(t, readSourcePage(brain, "out"), brainfstest.Sentinel)
|
||||
assert.NotContains(t, readSourcePage(brain, "in"), brainfstest.Sentinel)
|
||||
assert.NotContains(t, storedSourceHash(brain, "in"), brainfstest.Sentinel)
|
||||
assert.NotContains(t, readSourcePage(brain, "", "out"), brainfstest.Sentinel)
|
||||
assert.NotContains(t, readSourcePage(brain, "", "in"), brainfstest.Sentinel)
|
||||
assert.NotContains(t, storedSourceHash(brain, "", "in"), brainfstest.Sentinel)
|
||||
|
||||
src := filepath.Join(brain, "wiki", "sources", "r.md")
|
||||
read := func() string { return readSourcePage(brain, "r") }
|
||||
read := func() string { return readSourcePage(brain, "", "r") }
|
||||
brainfstest.AssertNoLeak(t, src, "zqinside", 1500*time.Millisecond, read)
|
||||
brainfstest.AssertNoLeakFrom(t, src, "zqinside", inBrain, 1500*time.Millisecond, read)
|
||||
brainfstest.AssertNoHang(t, src, "zqinside", 1500*time.Millisecond, 6*time.Second, func() { _ = read() })
|
||||
|
||||
Reference in New Issue
Block a user