Skip to content

Commit 84b7ceb

Browse files
martinrodeclaude
andcommitted
metadata: add example-request-only-empty recipe for empty-output testing
New cookbook recipe that copies fas_config/request_only_empty_metadata.json verbatim into example_metadata.json. Every recipe field (filename, title, description, ...) ends up as the empty string, so a mapping that wires one of these to an easydb target sees an empty value flow through the recipe path in fylr's internal/api/object/file_metadata.go. Used by the ticket-79607 apitest in fylr to reproduce the production weblink-cleared bug without needing the ai-metadata plugin (which isn't part of the apitest CI). Registered in custom_produce.yml as metadata_request_only so it doesn't run on every upload. see #79607 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 95472b0 commit 84b7ceb

3 files changed

Lines changed: 60 additions & 0 deletions

File tree

fas_config/cookbook_metadata_example.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,46 @@ recipes:
5555
- "require('fs').createReadStream(process.argv[1]).pipe(process.stdout)"
5656
- "%_exec.pluginDir%/fas_config/recipe_dynamic_request_only.json"
5757

58+
# example-request-only-empty mirrors example-request-only but writes a
59+
# metadata JSON where every field is an empty string. Used by ticket
60+
# 79607's apitest to drive the "recipe ran but delivered no data" path
61+
# without needing the ai-metadata plugin in CI: any mapping that targets
62+
# a custom-data-type sub-field through this recipe will see an empty
63+
# value flow through the recipe loop in file_metadata.go, which was
64+
# silently clearing the existing CDT (e.g. weblink.url) before the fix.
65+
example-request-only-empty:
66+
class: _metadata
67+
metadata:
68+
- file: "example_metadata.json"
69+
displayname:
70+
de-DE: Beispiel Metadaten Mapping (empty)
71+
en-US: Example Metadaten Mapping (empty)
72+
execs:
73+
- service: node
74+
commands:
75+
- prog: node
76+
args:
77+
- "-e"
78+
# copy request_only_empty_metadata.json (arg 1) verbatim into example_metadata.json (arg 2)
79+
- "require('fs').createReadStream(process.argv[1]).pipe(require('fs').createWriteStream(process.argv[2]));"
80+
- "%_exec.pluginDir%/fas_config/request_only_empty_metadata.json"
81+
- type: file_out
82+
file:
83+
name: "example_metadata.json"
84+
# dynamic.exec serves the field schema (filename/title/description/...);
85+
# same shape as example-request-only so existing mapping field names work.
86+
dynamic:
87+
exec:
88+
service: node
89+
commands:
90+
- prog: node
91+
stdout:
92+
type: body
93+
args:
94+
- "-e"
95+
- "require('fs').createReadStream(process.argv[1]).pipe(process.stdout)"
96+
- "%_exec.pluginDir%/fas_config/recipe_dynamic_request_only.json"
97+
5898
example-request-only-with-error:
5999
class: _metadata
60100
metadata:

fas_config/custom_produce.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ custommetadata:
2525
extensions:
2626
- png
2727
- jpg
28+
- recipename: fylr_example:example_metadata:example-request-only-empty
29+
includeversions: false
30+
# request-only: the recipe runs lazily, only when a metadata mapping
31+
# actually references it. Used by ticket 79607's apitest to drive the
32+
# "recipe ran but delivered no data" path without the ai-metadata plugin.
33+
metadata_request_only: true
34+
extensions:
35+
- png
36+
- jpg
2837

2938
classes:
3039
image:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"plugin-example": {
3+
"chat-gpt": {
4+
"fields": {
5+
"filename": "",
6+
"description": "",
7+
"title": ""
8+
}
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)