fix(add): accept qualified position IDs and make --dry-run resolve placement - #55
Merged
Conversation
…acement --before/--after now take the file#slug form that lash show prints, and --dry-run runs the same load/validate/resolve path as a real add instead of echoing the request back. Fixes #53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #53.
--before/--afterrejected the ID lash printslash showandlash listqualify IDs with their file (index#beta-task), sothat is the string people paste back into
--before. It failed with "task notfound", which reads as the task being missing rather than the argument being
spelled the way the tool spells it — and
--depends-onon the same commandline accepts the qualified form, so one invocation could need both.
Position IDs now go through
PlacementResolver::local_position_id, whichstrips a
file#qualifier when it names the target file and errors when itnames a different one. Accepting the qualifier is not the same as ignoring it:
a qualifier pointing elsewhere means the caller expected the task in another
file, and positioning against whatever local task shares the slug would be
silently wrong.
The qualifier matches the file's
@id, its name with or without.md, and anytrailing portion of its path; a
#task:prefix on the local part is toleratedbecause that is how
@depends-onreferences are written.The not-found error now names the IDs that do exist at that level, since the
bare "not found" was misleading precisely when the task did exist.
--dry-rundid not validate the positionDry run printed the request back field by field and exited 0. It never opened
the target file, so it passed for a
--beforenaming a task that did notexist — a false green on the one thing it is for.
create_tasknow splits intoplan_task(load, validate, resolve placement)and the emit that follows. Dry run calls
plan_task, so there is no separatedry-run path left to drift out of agreement with the real one. It also reports
the resolved insert line rather than the argument it was handed, stated as a
lower bound when the emitter still has to step past a preceding task's
free-text body.
Tests
placement.rscovering every accepted qualifier spelling,the cross-file rejection, and the new error content
add_command_test.rscovering both halves end to end,including that a failing dry run writes nothing and a passing one writes
nothing either
Full workspace suite passes; clippy and fmt clean.