Public Access
Fix YAML escaping for meeting note frontmatter
PR and Push Build/Test / build-and-test (push) Successful in 10m21s
PR and Push Build/Test / build-and-test (push) Successful in 10m21s
This commit is contained in:
@@ -135,6 +135,72 @@ public sealed class MeetingNoteStoreTests
|
||||
Assert.Equal("User notes.", loaded.UserNotes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task StoreEscapesApostrophePrefixedAttendeesBeforeWritingFrontmatter()
|
||||
{
|
||||
var (store, saved) = await SaveNoteAsync(
|
||||
title: "Escaped Attendees",
|
||||
attendees: ["'Ada Lovelace"],
|
||||
projects: [],
|
||||
userNotes: "Discuss attendee import.");
|
||||
var content = await File.ReadAllTextAsync(saved.Path);
|
||||
var loaded = await store.ReadAsync(saved.Path, CancellationToken.None);
|
||||
|
||||
Assert.Contains("- \"'Ada Lovelace\"", content);
|
||||
Assert.Equal(["'Ada Lovelace"], loaded.Frontmatter.Attendees);
|
||||
Assert.Equal("Discuss attendee import.", loaded.UserNotes);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Ada # platform lead")]
|
||||
[InlineData("- Ada Lovelace")]
|
||||
[InlineData("? Ada Lovelace")]
|
||||
[InlineData("{Ada: Platform}")]
|
||||
[InlineData("*Ada")]
|
||||
[InlineData("&Ada")]
|
||||
[InlineData("!Ada")]
|
||||
[InlineData("| Ada")]
|
||||
[InlineData("> Ada")]
|
||||
[InlineData("@Ada")]
|
||||
[InlineData("`Ada")]
|
||||
[InlineData("true")]
|
||||
[InlineData("null")]
|
||||
[InlineData("2026-07-08")]
|
||||
[InlineData("Ada \"The Architect\" Lovelace")]
|
||||
[InlineData("C:\\People\\Ada")]
|
||||
public async Task StoreEscapesYamlSensitiveAttendeesBeforeWritingFrontmatter(string attendee)
|
||||
{
|
||||
var (store, saved) = await SaveNoteAsync(
|
||||
title: "Escaped Attendees",
|
||||
attendees: [attendee],
|
||||
projects: [],
|
||||
userNotes: "Discuss attendee import.");
|
||||
var loaded = await store.ReadAsync(saved.Path, CancellationToken.None);
|
||||
|
||||
Assert.Equal([attendee], loaded.Frontmatter.Attendees);
|
||||
Assert.Equal("Discuss attendee import.", loaded.UserNotes);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Planning # Q3")]
|
||||
[InlineData("- Planning")]
|
||||
[InlineData("{Planning: Q3}")]
|
||||
[InlineData("true")]
|
||||
[InlineData("2026-07-08")]
|
||||
public async Task StoreEscapesYamlSensitiveScalarAndProjectFrontmatterValues(string value)
|
||||
{
|
||||
var (store, saved) = await SaveNoteAsync(
|
||||
title: value,
|
||||
attendees: [],
|
||||
projects: [value],
|
||||
userNotes: "Discuss YAML escaping.");
|
||||
var loaded = await store.ReadAsync(saved.Path, CancellationToken.None);
|
||||
|
||||
Assert.Equal(value, loaded.Frontmatter.Title);
|
||||
Assert.Equal([value], loaded.Frontmatter.Projects);
|
||||
Assert.Equal("Discuss YAML escaping.", loaded.UserNotes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ActionLinkEscapesSummaryFileName()
|
||||
{
|
||||
@@ -147,6 +213,26 @@ public sealed class MeetingNoteStoreTests
|
||||
link);
|
||||
}
|
||||
|
||||
private static async Task<(MarkdownMeetingNoteStore Store, MeetingNote Saved)> SaveNoteAsync(
|
||||
string title,
|
||||
IReadOnlyList<string> attendees,
|
||||
IReadOnlyList<string> projects,
|
||||
string userNotes)
|
||||
{
|
||||
var (vaultRoot, store) = CreateStore();
|
||||
var note = MeetingNoteTemplate.Create(
|
||||
title: title,
|
||||
attendees: attendees,
|
||||
projects: projects,
|
||||
transcriptPath: Path.Combine(vaultRoot, "Meetings", "Transcripts", "20260519-transcript.md"),
|
||||
assistantContextPath: Path.Combine(vaultRoot, "Meetings", "Assistant Context", "20260519-context.md"),
|
||||
summaryPath: Path.Combine(vaultRoot, "Meetings", "Summaries", "20260519-summary.md"),
|
||||
userNotes: userNotes);
|
||||
|
||||
var saved = await store.SaveAsync(note, CancellationToken.None);
|
||||
return (store, saved);
|
||||
}
|
||||
|
||||
private static (string VaultRoot, MarkdownMeetingNoteStore Store) CreateStore()
|
||||
{
|
||||
var vaultRoot = Path.Combine(Path.GetTempPath(), "meeting-assistant-tests", Guid.NewGuid().ToString("N"));
|
||||
|
||||
Reference in New Issue
Block a user