Commit 324e292
committed
fix(translation): resolve workflow stale-scripts, schema, and undefined-content bugs
Three bugs found in the translate-docs workflow and translation scripts:
1. Workflow always ran scripts from the `content` branch, which had an
older version of translateFrontMatter.ts with `type: "string"` in the
OpenAI response schema instead of `type: "object"`, causing 400 errors.
Fix: overlay scripts/ and package.json from main before bun i, then
immediately unstage them (git restore --staged) so they are not
accidentally committed to the content branch.
2. translateCodeJson.ts used CodeJsonSchema with additionalProperties as
a schema object combined with strict: true, which OpenAI Structured
Outputs forbids (additionalProperties must be false in strict mode).
Fix: switch to response_format { type: "json_object" } — appropriate
since code.json has dynamic/unknown keys.
3. removeFrontMatter and createNotionPageFromMarkdown had no guard
against receiving undefined content (possible when an older caller
caught a translation error but continued with undefined translatedContent).
Fix: type guard in removeFrontMatter returns "" for non-strings;
createNotionPageFromMarkdown throws with a clear diagnostic message.1 parent a2313b4 commit 324e292
File tree
3 files changed
+16
-32
lines changed- .github/workflows
- scripts/notion-translate
3 files changed
+16
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
| 491 | + | |
491 | 492 | | |
492 | 493 | | |
493 | 494 | | |
| |||
562 | 563 | | |
563 | 564 | | |
564 | 565 | | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
565 | 572 | | |
566 | 573 | | |
567 | 574 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | 69 | | |
94 | 70 | | |
95 | 71 | | |
| |||
101 | 77 | | |
102 | 78 | | |
103 | 79 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
112 | 83 | | |
113 | 84 | | |
114 | 85 | | |
| |||
0 commit comments