Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex r3): report metadata strip even when only denoise runs (#1763)
[._.]/ Adam Eivy46bcb89f6bc4
diff --git a/server/lib/imageClean.js b/server/lib/imageClean.jsindex 8497eeb47c..67a37e0a3c 100644--- a/server/lib/imageClean.js+++ b/server/lib/imageClean.js@@ -266,7 +266,15 @@ export async function cleanImageBuffer(buffer, options = {}) {width = info.width || null;height = info.height || null;c2paStripped = hadC2PA;- if (metadata) steps.push({ step: 'metadata', status: 'applied', lossless: false, detail: 'dropped via re-encode' });+ // The re-encode drops all metadata unconditionally. Report it even when the+ // user left the metadata step OFF — otherwise the report implies metadata+ // survived a denoise pass, which it never does. Honest > misleading.+ steps.push({+ step: 'metadata',+ status: 'applied',+ lossless: false,+ detail: metadata ? 'dropped via re-encode' : 'dropped as an unavoidable side effect of denoise re-encode',+ });steps.push({ step: 'denoise', status: 'applied', lossless: false, detail: 'median(3) + sharpen' });} else if (metadata && format === 'png') {const meta = await sharp(buffer, { limitInputPixels: MAX_PIXELS }).metadata();diff --git a/server/lib/imageClean.test.js b/server/lib/imageClean.test.jsindex 28b3321f83..6a4c36d6d7 100644--- a/server/lib/imageClean.test.js+++ b/server/lib/imageClean.test.js@@ -347,6 +347,18 @@ describe('cleanImageBuffer (composable steps)', () => {expect(result.height).toBe(32);});+ it('reports the unavoidable metadata strip even when only denoise is selected', async () => {+ const caBX = makePngChunk('caBX', Buffer.alloc(16, 0xCA));+ const polluted = injectChunkBeforeIEND(pngFixture, caBX);+ const result = await cleanImageBuffer(polluted, { metadata: false, denoise: true });+ // The denoise re-encode strips caBX/metadata regardless — the report must+ // not imply metadata survived.+ expect(result.steps.map((s) => s.step)).toEqual(['metadata', 'denoise']);+ expect(result.c2paStripped).toBe(true);+ const meta = result.steps.find((s) => s.step === 'metadata');+ expect(meta.detail).toContain('unavoidable');+ });+it('bakes orientation into pixels (lossy) when a PNG carries a non-default EXIF orientation', async () => {// 4×8 PNG re-emitted with EXIF Orientation=6 (rotate 90° CW). A pure chunk// strip would drop the tag and visibly rotate it, so the metadata-only path