diffs: validate hydration language inputs

This commit is contained in:
Gustavo Madeira Santana 2026-03-30 15:58:24 -04:00
parent a39501a4f2
commit afaa838bed
No known key found for this signature in database
4 changed files with 1014 additions and 430 deletions

View File

@ -29,6 +29,7 @@ Docs: https://docs.openclaw.ai
### Fixes
- Diffs: fall back to plain text when `lang` hints are invalid during diff render and viewer hydration, so bad or stale language values no longer break the diff viewer. (#57902) Thanks @gumadeiras.
- Image generation/build: write stable runtime alias files into `dist/` and route provider-auth runtime lookups through those aliases so image-generation providers keep resolving auth/runtime modules after rebuilds instead of crashing on missing hashed chunk files.
- Config/runtime: pin the first successful config load in memory for the running process and refresh that snapshot on successful writes/reloads, so hot paths stop reparsing `openclaw.json` between watcher-driven swaps.
- Config/legacy cleanup: stop probing obsolete alternate legacy config names and service labels during local config/service detection, while keeping the active `~/.openclaw/openclaw.json` path canonical.

File diff suppressed because one or more lines are too long

View File

@ -10,14 +10,14 @@ describe("filterSupportedHydrationLanguages", () => {
});
it("drops invalid languages and falls back to text", async () => {
await expect(
filterSupportedHydrationLanguages(["not-a-real-language" as unknown as "text"]),
).resolves.toEqual(["text"]);
await expect(filterSupportedHydrationLanguages(["not-a-real-language"])).resolves.toEqual([
"text",
]);
});
it("keeps valid languages when invalid hints are mixed in", async () => {
await expect(
filterSupportedHydrationLanguages(["typescript", "not-a-real-language" as unknown as "text"]),
filterSupportedHydrationLanguages(["typescript", "not-a-real-language"]),
).resolves.toEqual(["typescript"]);
});
});

View File

@ -30,7 +30,7 @@ const viewerState: ViewerState = {
};
export async function filterSupportedHydrationLanguages(
languages: Iterable<SupportedLanguages>,
languages: Iterable<string>,
): Promise<SupportedLanguages[]> {
const supported = new Set<SupportedLanguages>();
for (const language of languages) {