Skip to content
Merged
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
1 change: 1 addition & 0 deletions docs/development/lessons.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ When work exposes a consequential risk or a recurring problem, add a lesson or u
- **Upload acknowledgement follow-up:** Investigating [PR #287's camera sample](https://github.com/ThinkFlowLab/OpenDirector/pull/287#pullrequestreview-5868923062) reproduced a failed preview being swallowed into a successfully saved empty generation item. Require a usable preview before completing a HEIF import, and assert the failure leaves the original registered without creating an empty item. Slow uploads also crossed the first save acknowledgement: default expansion and model display labels were mistaken for user edits. Compare effective settings while retaining actual content, model, frame-selection and lock conflicts; exercise upload into a newly created node and its reference composer before the first save finishes.
- **Large media import:** A Windows Electron renderer exited with a V8 Zone OOM while importing a 128 MiB MP4. The crash log did not identify the failing allocation. Source inspection found whole-file data URL conversion before the shared upload API. Use the original File for audio and video imports and verify the saved asset fingerprint through the file picker flow. Upload-only benchmarks start after file selection and miss renderer work before the request.
- **Quality-default follow-up:** [Issue #377](https://github.com/ThinkFlowLab/OpenDirector/issues/377) reproduced the new-node HEIF upload failure again: image projection expands omitted quality to `auto`, while edit comparison still distinguished those equivalent values. Cover actual projected defaults in both upload guards and generation edit identities, retain rejection of explicit quality changes, and assert that the original node ID binds the uploaded asset before and after reopening. A synthetic saved-settings fixture that omits a projection default can pass while the browser path fails.
- **Preset-default follow-up:** [Nightly 46089353845](https://github.com/ThinkFlowLab/OpenDirector/actions/runs/46089353845/job/140806362007) reproduced the empty-node upload when projection began filling an omitted face-emphasis flag with `false`. The upload guard and generation edit identity must treat both forms as the same default and still detect explicit enablement.

- **Color profile follow-up:** [PR #287's P3 review](https://github.com/ThinkFlowLab/OpenDirector/pull/287#pullrequestreview-5870014881) found that a correct full-size PNG did not prove correct thumbnails: the library JPEG and the asset/history WebP used separate encoders that both omitted ICC. Check every displayed rendition and the actual embedded profile, not only dimensions or successful decoding. Preserve RGB profiles through resizing, but do not attach a non-RGB source profile after converting its channels to RGB. / **颜色配置补充:** 同一素材的全尺寸 PNG 正确,并不能证明素材库 JPEG 和资产/版本历史 WebP 正确。逐条检查显示路径的实际 ICC;缩放保留 RGB 配置,转换通道后不能继续附带非 RGB 源配置。

Expand Down
7 changes: 5 additions & 2 deletions src/canvas/generationSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ export function getNodeGenerationSettings(
export function generationEditSettings(node: CanvasNode) {
if (!["image", "video", "audio"].includes(node.type)) return node.data.settings;
const settings = getNodeGenerationSettings(node);
// Image save receipts expand an omitted quality to the same effective default.
if (node.type === "image") settings.imageQuality ??= "auto";
// Image save receipts can fill defaults without changing the draft.
if (node.type === "image") {
settings.imageQuality ??= "auto";
settings.faceEmphasis ??= false;
}
if (settings.videoMode !== "first-last") delete settings.frameSlotsInitialized;
return { ...settings, model: settings.modelConfigId ? "" : settings.model };
}
Expand Down
8 changes: 6 additions & 2 deletions tests/canvasWorkspaceEntry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@ import {

setActiveLocale("zh-CN");

test("image quality defaults from save receipts preserve upload and edit identity", () => {
test("image defaults from save receipts preserve upload and edit identity", () => {
for (const locale of ["zh-CN", "en-US"] as const) {
setActiveLocale(locale);
const draft = createNode("image", undefined, {
settings: { ...generationDefaults("image"), modelConfigId: "image-model" },
});
const saved = { ...draft, data: { ...draft.data,
settings: { ...draft.data.settings!, imageQuality: "auto" as const } } };
settings: { ...draft.data.settings!, imageQuality: "auto" as const, faceEmphasis: false } } };
assert.equal(uploadTargetUnchanged(saved, draft), true, locale);
assert.equal(uploadTargetUnchanged(draft, saved), true, locale);
assert.equal(generationEditIdentity(saved, []), generationEditIdentity(draft, []), locale);
const emphasized = { ...saved, data: { ...saved.data,
settings: { ...saved.data.settings, faceEmphasis: true } } };
assert.equal(uploadTargetUnchanged(emphasized, draft), false, locale);
assert.notEqual(generationEditIdentity(emphasized, []), generationEditIdentity(draft, []), locale);
for (const imageQuality of ["low", "medium", "high"] as const) {
const edited = { ...saved, data: { ...saved.data,
settings: { ...saved.data.settings, imageQuality } } };
Expand Down
Loading