Repository navigation
Description
Reported by Odilon on Discord: "in the aisle.conf file, TOML comments are treated as ingredients in the UI".
aisle.conf is not TOML. The only comment it knows is // (cooklang::aisle::parse cuts each line at //, and src/server/aisle_file.rs follows the same rule), so a # or -- line is read as an ingredient. Nothing tells people this: the README's aisle.conf example has no comments, the spec shows aisle.conf in ```toml blocks and never mentions comments, pantry.conf in the same folder really is TOML, and .shopping-list comments are --. Writing # is the natural guess.
Not a regression: the parser has always worked this way, and the /aisles page (#631) just makes it visible.
Steps to reproduce
config/aisle.conf:
# My aisles
[produce]
# fruit first
apples
tomatoes | tomato # cherry ones are fine
-- dash comment
// slash comment
garlic // inline slash
With a recipe using @tomato{2}, @garlic{1%clove}, @apples{1}, on main 7341a28:
/aislesandGET /api/aisleslist# fruit firstand-- dash commentas ingredients of produce.- The inline
#comment becomes part of a name: the second name istomato # cherry ones are fine, so the synonymtomatostops working and a recipe asking for@tomatois no longer filed under produce. # My aislesabove the first aisle gives the warningIngredient found before any category(CLI,cook doctor aisleand the/aislespage), which doesn't explain what's wrong.cook doctor aislesays nothing else.- Only the
//lines are ignored.
Expected
Either comments written the way people expect are ignored, or the file says clearly what a comment is and points at lines that look like one.
Possible fixes
- Document
//: add a comment to the README example and to the/aislespage help, and ask the spec to say what anaisle.confcomment is (and stop labelling the examplestoml). Cheapest, but#lines will keep turning up. - Warn: have
cook doctor aisleand the/aislespage flag a name starting with#or--("looks like a comment; aisle.conf comments start with//"). Nothing changes for existing files. - Accept
#as a comment incooklang::aisle(cooklang-rs) andaisle_file.rs. An ingredient name starting with#is very unlikely, but this changes the format, so it needs a spec update.
I'd do 1 and 2 here, and raise 3 with the spec / cooklang-rs.
Activity
fix: point out aisle.conf lines written like a # or -- comment (cookl…