fix: dossier_get must trim extracted values (validator accepts what the reader returns padded) #475

Closed
opened 2026-08-09 02:05:04 +00:00 by igor · 0 comments
Collaborator

One-line fix + one test. In lib/dossier.sh, dossier_get echoes the raw value after stripping at most ONE leading space (value="${value# }"), while _dossier_validate_metadata trims before comparing. Consequence, reproduced on master:

# Metadata block line:  type:  arcade␠␠   (two leading, two trailing spaces)
dossier_validate  -> PASS (post-#468 trim-before-compare accepts it)
dossier_get type  -> " arcade  "   (untrimmed -- breaks [ "$(dossier_get . type)" = "arcade" ] and padded urls reach curl)

The change: in dossier_get, trim the extracted value (leading AND trailing whitespace) with the existing _dossier_trim helper before the empty-check and echo. Apply the same to the agent.json fallback values for symmetry (jq output is clean today, but the contract should be uniform).

The test: extend bin/test-dossier.sh with a padded fixture (type: arcade ) asserting three-way agreement: dossier_validate passes, dossier_keys lists type, and dossier_get returns exactly arcade.

Nothing else in scope.

One-line fix + one test. In `lib/dossier.sh`, `dossier_get` echoes the raw value after stripping at most ONE leading space (`value="${value# }"`), while `_dossier_validate_metadata` trims before comparing. Consequence, reproduced on master: ``` # Metadata block line: type: arcade␠␠ (two leading, two trailing spaces) dossier_validate -> PASS (post-#468 trim-before-compare accepts it) dossier_get type -> " arcade " (untrimmed -- breaks [ "$(dossier_get . type)" = "arcade" ] and padded urls reach curl) ``` **The change:** in `dossier_get`, trim the extracted value (leading AND trailing whitespace) with the existing `_dossier_trim` helper before the empty-check and echo. Apply the same to the `agent.json` fallback values for symmetry (jq output is clean today, but the contract should be uniform). **The test:** extend `bin/test-dossier.sh` with a padded fixture (`type: arcade `) asserting three-way agreement: `dossier_validate` passes, `dossier_keys` lists `type`, and `dossier_get` returns exactly `arcade`. Nothing else in scope.
igor self-assigned this 2026-08-09 02:43:22 +00:00
igor added spent time 2026-08-09 02:47:21 +00:00
3 minutes 45 seconds
igor removed their assignment 2026-08-09 02:47:21 +00:00
igor closed this issue 2026-08-09 02:50:23 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Total time spent: 3 minutes 45 seconds
igor
3 minutes 45 seconds
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
joshtronic/igor#475
No description provided.