(From a Workboard)
When you Drag & Drop an Image to a Task, Phorge generates a cropped "File Transform", but that Transform is somehow orphan, causing small but weird side-effects.
== Reproduce steps ==
1. Take a brand-new Phorge.
2. Create a Project. Create a Workboard. Create a Task.
3. Drag & Drop an image on the Task.
{F686883}
4. Visit that Task to know your original File (`F18`):
{F686881}
5. Visit the original File `F18` and see its transforms (and the Cover Image is surprisingly missing)
== What happens ==
The Transform of `F18` is missing:From the original file `F18`, the Workboard Image Transform is not mentioned:
{F686899}
== Why this is a problem ==
Phorge has a sophisticated policy system allowing to change permissions of `F18` and reflecting changes to its Transforms as well.Deletion issues:
But,If you delete/destroy the original file `F18` (for example because it's a copyright violation), the Cover Image is still there, shown as usual. if you set `F18` as visible to everybodyIt's not easy to find that internal file, you cannot still see the Workboard imageand destroy also that.
Permission issues:
You can set `F18` as visible to everybody, but other people cannot still see the Workboard image.
And more edge-cases probably.
== Cause ==
Premising that, when you Drag & Drop a cover image, you obtain two images; and that the Cover Image is called "Workboard image transform". That final image is orphan. So, the Phorge's sophisticated policy system, allowing to change permissions of `F18` and reflecting changes to its Transforms as well, does not work. That Cover Image is just an orphan transform.
== Inspection ==
Involved entities:
| Task | `PHID-TASK-h4dgfjtdobzd6qkxspw3` | `T1` |
| Cover File | `PHID-FILE-qk4dvcxyjglyamctvpzz` | `F18` |
| Cover Thumbnail | `PHID-FILE-acvp6cslghr5x4rfxa2b` | `F19` |
| Author | `PHID-USER-w7hffapa5g6e76xamoje` | `valerio.bozzolan` |
Maniphest row mentioning `F18` (original) and `F19` (thumbnail cover):
```
$ SELECT * FROM phabricator_maniphest.maniphest_task WHERE id = 1;
*************************** 1. row ***************************
id: 1
phid: PHID-TASK-h4dgfjtdobzd6qkxspw3
authorPHID: PHID-USER-w7hffapa5g6e76xamoje
ownerPHID: NULL
status: open
priority: 90
title: Task with a Cover Image
description:
dateCreated: 1703846291
dateModified: 1703979151
mailKey: kura36ax2hhzdz4f5iqi
ownerOrdering: NULL
originalEmailSource: NULL
subpriority: 0
viewPolicy: users
editPolicy: users
spacePHID: NULL
properties: {"cover.filePHID":"PHID-FILE-qk4dvcxyjglyamctvpzz","cover.thumbnailPHID":"PHID-FILE-acvp6cslghr5x4rfxa2b"}
points: NULL
bridgedObjectPHID: NULL
subtype: default
closedEpoch: NULL
closerPHID: NULL
```
File inspection:
```
$ SELECT * FROM phabricator_file.file where id IN (18, 19);
*************************** 1. row ***************************
id: 18
phid: PHID-FILE-qk4dvcxyjglyamctvpzz
name: snowflake-purple.png
mimeType: image/png
byteSize: 14369
storageEngine: blob
storageFormat: raw
storageHandle: 6
dateCreated: 1703846426
dateModified: 1703978478
authorPHID: PHID-USER-w7hffapa5g6e76xamoje
secretKey: 522hfnwxomarnxtcy45s
contentHash: 8ee39022c15dd91a809673aa58a26e3f45a28d60b20016c88aefc955432bd094
metadata: {"storage":[]}
ttl: NULL
isExplicitUpload: 1
mailKey: vdf54wwjmidgtq6snbac
viewPolicy: PHID-USER-w7hffapa5g6e76xamoje
isPartial: 0
builtinKey: NULL
isDeleted: 0
*************************** 2. row ***************************
id: 19
phid: PHID-FILE-acvp6cslghr5x4rfxa2b
name: workcard-snowflake-purple.png
mimeType: image/png
byteSize: 185328
storageEngine: blob
storageFormat: raw
storageHandle: 13
dateCreated: 1703846426
dateModified: 1703846426
authorPHID: NULL
secretKey: nl5q7yn4htw25qht5mpd
contentHash: d69274397858894f842d22a75930bc33615230addb8b7b7b3976311a8a8d9f39
metadata: {"storage":[],"integrity":"7380ca853fdacfab7e98d2156fab2162be7c3b03e7e401491da86ed595ba8b70","canCDN":1,"width":526,"height":523}
ttl: NULL
isExplicitUpload: 0
mailKey: sdc2clxxqe64tvuu5gji
viewPolicy: PHID-USER-w7hffapa5g6e76xamoje
isPartial: 0
builtinKey: NULL
isDeleted: 0
```
The original file `F18` has just a preview but not the Cover preview (as seen in the screenshot F686899):
```
$ SELECT * FROM phabricator_file.file_transformedfile WHERE originalPHID = 'PHID-FILE-qk4dvcxyjglyamctvpzz';
+----+--------------------------------+-----------+--------------------------------+-------------+--------------+
| id | originalPHID | transform | transformedPHID | dateCreated | dateModified |
+----+--------------------------------+-----------+--------------------------------+-------------+--------------+
| 69 | PHID-FILE-qk4dvcxyjglyamctvpzz | preview | PHID-FILE-3uyqwyhq5ek332zxv62p | 1703849677 | 1703849677 |
+----+--------------------------------+-----------+--------------------------------+-------------+--------------+
```
The file `F19` is not a transform of anything:
```
$ SELECT * FROM phabricator_file.file_transformedfile WHERE transformedPHID = 'PHID-FILE-acvp6cslghr5x4rfxa2b';
Empty set (0,001 sec)
```
== What should happen instead ==
When uploading `F18`, the Cover thumbnail `F19` should be mentioned in the highlighted zone:
{F686899}
So we should probably have this situation instead:
```
$ SELECT * FROM phabricator_file.file_transformedfile WHERE originalPHID = 'PHID-FILE-qk4dvcxyjglyamctvpzz';
+----+--------------------------------+-----------+--------------------------------+-------------+--------------+
| id | originalPHID | transform | transformedPHID | dateCreated | dateModified |
+----+--------------------------------+-----------+--------------------------------+-------------+--------------+
| 69 | PHID-FILE-qk4dvcxyjglyamctvpzz | preview | PHID-FILE-3uyqwyhq5ek332zxv62p | 1703849677 | 1703849677 |
| 70 | PHID-FILE-qk4dvcxyjglyamctvpzz | workcard | PHID-FILE-qk4dvcxyjglyamctvpzz | 1703849677 | 1703849677 | ←←← to be added
+----+--------------------------------+-----------+--------------------------------+-------------+--------------+
```
== Workarounds ==
To show `F18` as Cover Image to other people:
- option 1: ask database administrator to discover `F19`, then tune permissions of `F19` instead
- option 2: ask database administrator to create the missing line in the table `phabricator_file.file_transformedfile` to connect `F19` to `F18`, so you can just tune permissions of `F18` as expected, and it finally works
- option 3: just don't use Cover Image, do something else, like sharing the URL of `F18` to other people, so you can tune permissions of `F18` and other people finally see it somewhere
== Pitfalls ==
It's not useful to manually the file `F18` and click on the "workcard" "Regenerate" button. If you do that, you indeed obtain what is missing, but that is a completely new file unrelated to the file that is actually set to the Task T1.