Skip to content
Python

Merge upstream main and preserve Unicode artifact links

kudala-bharanic38de8ab429a
diff --cc surfaces/gui/src/components/Markdown.test.tsx
index 171c7417,6707e319..b61d506e
--- a/surfaces/gui/src/components/Markdown.test.tsx
+++ b/surfaces/gui/src/components/Markdown.test.tsx
@@@ -36,15 -36,19 +36,31 @@@ describe("Markdown artifact links", ()
expect(screen.getByTestId("artifact-chip").textContent).toContain("report.pdf");
});
+ it("dispatches a decoded Unicode filename", () => {
+ const seen: string[] = [];
+ const listener = (e: Event) => seen.push((e as CustomEvent).detail.path);
+ window.addEventListener(OPEN_ARTIFACT_EVENT, listener);
+
+ render(<Markdown text="[News](artifact:%E6%96%B0%E9%97%BB%E6%91%98%E8%A6%81.md)" />);
+ fireEvent.click(screen.getByTestId("artifact-chip"));
+ expect(seen).toEqual(["新闻摘要.md"]);
+
+ window.removeEventListener(OPEN_ARTIFACT_EVENT, listener);
+ });
++
+ // Seventeenth pass: the lead's one-time board mention — [Board · 5 items](board:)
+ // renders as an inline pill that opens the drawer on its Board section.
+ it("renders a board: link as a pill and dispatches the open-board event", () => {
+ let fired = 0;
+ const listener = () => fired++;
+ window.addEventListener(OPEN_BOARD_EVENT, listener);
+
+ render(<Markdown text="Plan approved — [Board · 5 items](board:) if you want to watch." />);
+ const chip = screen.getByTestId("board-chip");
+ expect(chip.textContent).toContain("Board · 5 items");
+ fireEvent.click(chip);
+ expect(fired).toBe(1);
+
+ window.removeEventListener(OPEN_BOARD_EVENT, listener);
+ });
});
diff --cc surfaces/gui/src/components/Markdown.tsx
index a8bb22a9,e27a6627..18710212
--- a/surfaces/gui/src/components/Markdown.tsx
+++ b/surfaces/gui/src/components/Markdown.tsx
@@@ -10,9 -10,28 +10,34 @@@ import { Icon } from "./Icon"
// the session's artifact list, App un-hides the rail.
export const OPEN_ARTIFACT_EVENT = "ocw-open-artifact";
+ // Seventeenth pass: the lead mentions the board ONCE — [Board · 5 items](board:) — and the
+ // chip opens the drawer on its Board section. Same event plumbing as artifact chips: App
+ // un-hides the rail and bumps the key that expands the section.
+ export const OPEN_BOARD_EVENT = "ocw-open-board";
+
+ function BoardChip({ label }: { label: string }) {
+ return (
+ <button
+ className="boardlink-chip"
+ data-testid="board-chip"
+ title="Open the board"
+ onClick={() => window.dispatchEvent(new CustomEvent(OPEN_BOARD_EVENT))}
+ >
+ <Icon name="table" size={12} />
+ <span>{label || "Board"}</span>
+ </button>
+ );
+ }
+
function ArtifactChip({ path, title }: { path: string; title: string }) {
- const decodedPath = decodeArtifactPath(path);
- const file = artifactBaseName(decodedPath);
+ const { t } = useTranslation();
- const file = path.split("/").pop() || path;
++ let decodedPath = path;
++ try {
++ decodedPath = decodeURIComponent(path);
++ } catch {
++ // Literal percent signs are valid in filenames even when they are not URL encoding.
++ }
++ const file = decodedPath.split(/[\\/]/).pop() || decodedPath;
return (
<button
className="art-chip"