Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions pstack/skills/poteto-mode/scripts/orch/orch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,36 @@ describe("Store", () => {
]);
});

it("reads back gates, standing orders, and status containing Unicode line separators", async () => {
const { store } = await initializedStore();
await store.gates.park({
id: "release",
question: "Ship now?\u2028Copied from the brief",
options: "ship,wait",
defaultAnswer: "wait",
});
await store.standing.add({ line: "Never force push.\u2029Ask first." });

expect(await store.gates.list()).toEqual([
{
kind: "open",
id: "release",
question: "Ship now?\u2028Copied from the brief",
options: "ship,wait",
defaultAnswer: "wait",
},
]);
expect(await store.standing.show()).toEqual([
{ number: 1, line: "Never force push.\u2029Ask first." },
]);
await store.units.add({ id: "u1", track: "build" });
await store.units.set({ id: "u1", state: "blocked\u2028on review" });
expect((await store.status.render()).summary.openGateIds).toEqual([
"release",
]);
expect((await store.status.render()).changed).toBe("no derived changes");
});

for (const forge of ["gh", "origin"] as const) {
it(`resolves the ordered frontier from the ${forge} base chain and validates an optional pin`, async () => {
const { directory, store } = await initializedStore();
Expand Down
6 changes: 3 additions & 3 deletions pstack/skills/poteto-mode/scripts/orch/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ async function readGates(store: string): Promise<readonly Gate[]> {
const id = lines.shift() ?? "";
const fields = new Map<string, string>();
for (const value of lines) {
const match = /^- ([^:]+): (.*)$/.exec(value);
const match = /^- ([^:]+): (.*)$/s.exec(value);
if (match === null) {
throw new UserError(`gates.md has a malformed gate ${id}`);
}
Expand Down Expand Up @@ -740,7 +740,7 @@ async function readStanding(
}
const result: StandingLine[] = [];
for (const value of raw.split("\n").filter((item) => item.length > 0)) {
const match = /^([1-9]\d*)\. (.+)$/.exec(value);
const match = /^([1-9]\d*)\. (.+)$/s.exec(value);
const number = Number(match?.[1] ?? 0);
if (match === null || number !== result.length + 1) {
throw new UserError("preferences.md has malformed numbering");
Expand Down Expand Up @@ -798,7 +798,7 @@ function countRecord(value: unknown): Record<string, number> | null {
}

function previousSummary(raw: string): StatusSummary | null {
const match = /<!-- orch-summary (.+) -->/.exec(raw);
const match = /<!-- orch-summary (.+) -->/s.exec(raw);
if (match === null) {
return null;
}
Expand Down
Loading