Compare commits

..
3 Commits
Author SHA1 Message Date
Ansho ReiandClaude Opus 5 5dc087d49e (9564ac9) Show the annotation in tags ls, and bump to 0.26.4
Since tags.md there are two vocabularies, the one the file declares and the one
the tickets carry, and the listing reported only the second. A tag declared and
never applied was invisible, and a word somebody invented in a hurry read
exactly like one the board had agreed on. Those two cases are the whole reason
to declare tags at all.

The listing is now the union: still alphabetical, still case sensitive, with the
annotation's opening line as a third tab-separated field and a count of zero for
a tag nothing carries.

**The absence of the third field is what marks a carried but undeclared tag.**
Nothing could be appended to the first field without a completion offering a tag
that does not exist, and nothing could be added to the second without it
stopping being a number. Absence costs neither, and it buys the property a
marker could not have: a board with no tags.md has every tag undeclared, so it
prints two fields a line, which is byte for byte what this printed before the
file existed. An older completion script on a newer binary keeps working, which
is the same compatibility 1db02e5 kept for the bare form.

A declared tag with nothing said about it answers the placeholder rather than an
empty string. An empty third field is a trailing tab and nothing else, so the
one difference between declared and not would have been invisible in a terminal
and in a completion alike. It is also what the file itself holds under that
heading, so the field is the section's opening line either way.

`TagIndex::summary` does the cut to one line, the way `CampaignRow::summary`
takes one line off a description the read carries whole: the annotation is prose
with paragraphs in it, and how much of it a view wants is the view's business.

The two fish rules pipe through `cut -f1,3`, since fish takes everything after
the *first* tab as one description and the count would otherwise land in the
middle of the prose. What is left is the annotation, and a tag the board has
never declared is offered with no description at all, which says what the count
used to say more weakly. `cut` rather than `string replace` because columns are
what is being picked, and `cut -f1` is how a script reads this listing anyway.
A test pins both rules rather than the script as a whole, so a rule added later
that reads `worklane tags` raw is caught.

`assets/ADMIN.md` claimed a declared and unapplied tag does not appear in the
listing, which is now the opposite of the truth; it lists at zero. Fixed here
rather than left to f7dd1a1, which does not list that file. The same stale
sentence in SKILL.md and PLAN.md is recorded on that ticket.

Filed on the way past: an annotation carrying a tab splits the listing into a
fourth field, 8f650fc, and the `tags set` completion offers the undeclared tags
it refuses, which only became filterable now that the listing tells them apart,
193f9be.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-24 03:58:04 +02:00
Ansho ReiandClaude Opus 5 07c783410c (b74dc5a) Remove a test's fixture directory with a guard, not a trailing line
Every unit test here built its board under the system temp directory,
and the ones that remembered a `remove_dir_all` at the end only cleaned
up when their assertions passed. Most had no such line at all. /tmp
reached 18363 of these and filled the disk, which failed a link step and
then a `git add` with "No space left on device": an error naming neither
the tests nor what they had left behind.

`util::Fixture` is a uuid-named directory whose `Drop` removes it, which
is the only shape that also runs when an assertion fails, since
unwinding runs destructors. It derefs to `Path` and implements
`AsRef<Path>`, because the two reach different call sites: a parameter
typed `&Path` is a coercion site and one bound by `impl AsRef<Path>` is
not. So nothing changed at the ~160 call sites but the type, and the 85
trailing cleanup lines are gone.

Five leaking prefixes, not the two the ticket names.
`worklane-project-*` from `project_tree` and `worklane-bare-*` never
cleaned up at all, and the four `worklane-count/blocked/stray/stamps-*`
sites in `util.rs` cleaned up only on the passing path.
`Fixture::child` is what covers `project_tree`, which needs the fixture
to point at the project and remove the directory above it.

`assert_fs::TempDir` is a dev-dependency already and was still not the
answer: it names its directories `.tmpXXXXXX`, which says nothing about
whose they are for the one case that matters, the one left on disk on
purpose. Wrapping it to add a prefix and a printed path is more code
than the guard.

`WORKLANE_KEEP_FIXTURES=1` keeps them and prints each path, opt-in
rather than kept-automatically-on-failure: the assertions here carry the
state they are about, so a path printed on every failure would be noise
on almost all of them. Read once when a fixture is made rather than at
drop time, so the answer cannot change mid-test, and `Fixture::swept()`
turns it off for the three tests that are about the guard itself and
must not be failed by a reader's environment.

Verified against a clean temp dir rather than against /tmp, which still
holds the historical leak: `TMPDIR=/tmp/scratch cargo test` leaves zero
directories behind, with the variable set and unset, 383 green either
way.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-24 03:35:23 +02:00
Ansho ReiandClaude Opus 5 dd2b457bff (9b7fa7d) Expand the campaign frame with enter
Three rows of prose was the right default and the wrong ceiling. enter
while the frame holds the selection gives it half the board, enter again
gives the rows back, and pgup and pgdn go on doing what they do against
whichever height it is at.

Half of what the frame and the columns divide, which is the screen less
the tab row and the footer. Half rather than most of it for the same
reason the frame is not an overlay: the columns below are the campaign's
members, and a reader inspecting the campaign has to go on seeing what
it is made of. So `Chrome::campaign` is an `Option<FrameSize>` rather
than a bool and `campaign_rows` takes a height, resolved in `frame_rows`
because that is the one place that already has an area to take a share
of, which keeps `Chrome` itself pure.

Bounded at both ends, and the upper bound is the one that matters:
`Constraint::Min(COLUMN_MIN_ROWS)` would take rows back from a frame
that asked for too many, silently, and the frame's own measurement would
then disagree with what is drawn. Floored at the collapsed height, since
expanding must never shrink the frame, so a board too short to divide
gives the collapsed height back rather than one nothing measured. Swept
over every height from 4 to 60, tabbed and not.

q does not gain a layer and the arrow keys do not take the height back.
The expanded frame is the frame at its other height, not a thing laid
over the board, so q goes on taking the campaign filter off from either
and enter is the only key that undoes what enter did. The height
outlives the selection for the same reason: it is a view of the campaign
the reader chose, so the columns stay short with the selection on a
card. `dismiss` and `select_card` are untouched, and two tests pin that.

`enter` routes through `Board::toggle_focused` rather than in the
`main.rs` arm, the rule `dismiss` and `scroll_page` follow. It was inert
on the frame for free before, because `Tab::selected` hands back nothing
there and `toggle_detail` had nothing to open; that answer is now the
thing in the way, and AGENTS.md and `Tab::selected`'s doc are amended
rather than left describing the key by what it used to do.

The toggle re-clamps the frame offset through `scroll_frame(0, screen)`.
A taller viewport has a smaller last offset, so where the reader was can
end up past the end of the frame they just asked for, and the next pgup
would count down from a number the frame never showed.

Criterion 13 is not done: 2a83bd4 has not landed, so there is no tag
frame to give a second height to. What it inherits is on the ticket, and
all of it is generic rather than campaign-specific.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-24 03:08:39 +02:00
12 changed files with 919 additions and 226 deletions
+13 -4
View File
@@ -45,6 +45,10 @@ and this file is for what someone changing worklane's own code needs.
- Tests use `assert_cmd` and `assert_fs` for CLI testing
- `setup_worklane()` creates temp `.worklane/` with all four status folders pre-created, plus `campaigns/` in `cmd_campaign.rs`, which is also where the on-demand creation is tested from a board without it
- `create_ticket()` writes fully-formed markdown files directly (no `--` separator for positional args in test commands)
- **Every unit-test fixture directory goes through `util::Fixture`, and nothing calls `remove_dir_all` at the end of a test.** `Fixture::new(prefix)` makes a uuid-named directory under the system temp dir and its `Drop` removes it, which is the only shape that also runs when an assertion fails — a trailing line does not, and a failing test is exactly when a fixture is most likely to be stranded. That was b74dc5a: `/tmp` reached 18363 of these and filled the disk, failing a link step and then a `git add` with "No space left on device", an error naming neither the tests nor what they left behind
- **`Fixture` derefs to `Path` and also implements `AsRef<Path>`**, because the two reach different call sites: a parameter typed `&Path` is a coercion site and one bound by `impl AsRef<Path>` is not. `Fixture::child(name)` points the fixture at a directory inside itself while still removing the parent, which is the tree `project_tree` needs. The prefix earns its place on the one path that is ever left behind, which is why this is a small guard rather than `assert_fs::TempDir` — that names its directories `.tmpXXXXXX`, which says nothing about whose they are
- **`WORKLANE_KEEP_FIXTURES=1 cargo test` keeps the fixtures and prints each path.** Opt-in rather than kept-automatically-on-failure, because the assertions here carry the state they are about: a failing board test prints the rendered rows. The flag is read once when a fixture is made rather than at drop time, so the answer cannot change mid-test, and `Fixture::swept()` turns it off for the three tests that are about the guard itself and must not be failed by a reader's environment
- **Verify a claim about leaked fixtures against a clean temp dir, not against `/tmp`.** `TMPDIR=/tmp/scratch cargo test` then count what is left in it: `/tmp` still holds the historical leak, so counting there measures the past rather than the change
- In `tui.rs`, `write_member_card` is `write_tagged_card` plus a Campaign field and `write_campaign` puts a campaign on disk, creating the campaigns directory as it goes — `board_dir()` deliberately does not, so every test that does not write one is also the test that a board with no campaigns draws. `picker_rows` cuts the picker's list out of the frame by its own geometry, for the reason `overlay_title_row` exists: a card carries the same campaign label, so a search over every row finds the board rather than the list
- **`cargo clippy --all-targets` is clean. Keep it clean**, and do not silence a lint that is pointing at something real. The only two `allow`s in the tree sit on the `create_ticket` fixtures in `cmd_mv.rs` and `cmd_show.rs`, each carrying the reason and what would replace it
- **`cargo fmt --check` is clean too, and `rustfmt.toml` is what makes that affordable.** rustfmt is the formatter here, run it. The config is four stable width settings and nothing else:
@@ -235,18 +239,23 @@ and this file is for what someone changing worklane's own code needs.
- **A campaign the board does not hold labels nothing**, the answer `mark_blocked` gives a dangling blocker. `campaign_cell` renders that case as `_missing_` because a metadata table is a place to report a dangling reference; a card is not
- **`c` opens the campaign picker, and taking a campaign filters the tab's columns to its members.** Not a fifth tab: a campaign groups across the flow, so the shape of the answer is the four statuses with fewer cards in them, which is what `campaign show` already answers the question in. Every column is kept, empty ones included. The filter is applied in `reload`, where the columns are built, so nothing downstream has to ask whether a campaign is selected — the board simply holds fewer cards, and `first_match`, `done_count` and the copy key all keep working unchanged
- **`Tab::campaign` is a uuid on the tab, not on the `Board`.** A campaign belongs to one `.worklane`, so a filter carried onto another project's tab would empty it and say nothing about why. It is looked up by uuid rather than held as an index, and a selection whose campaign has left the board is cleared by `reload` rather than left filtering the board to nothing
- **The frame above the columns is `Chrome::CAMPAIGN_ROWS` rows, and `Chrome` is what every measurement takes.** `frame_rows` grew a row, so the two bools that decide the geometry became one `Chrome`, copied from `Board::chrome`: adjacent same-typed parameters are what the Rust Style rule warns about, and the draw and `follow_selection` have to measure one answer or a keypress scrolls against a board the next frame does not draw. The row indices are named (`TAB_ROW`, `CAMPAIGN_ROW`, `BOARD_ROW`, `FOOTER_ROW`), since an index written out by hand goes on meaning what it used to
- **The frame above the columns has two heights, and `Chrome` is what every measurement takes.** `Chrome::campaign` is an `Option<FrameSize>`, not a bool: `None` for a tab showing the whole board, and `Collapsed` or `Expanded` for one filtered to a campaign, because both heights have to be measured the same way by everything that measures the board. `frame_rows` grew a row, so the two bools that decide the geometry became one `Chrome`, copied from `Board::chrome`: adjacent same-typed parameters are what the Rust Style rule warns about, and the draw and `follow_selection` have to measure one answer or a keypress scrolls against a board the next frame does not draw. The row indices are named (`TAB_ROW`, `CAMPAIGN_ROW`, `BOARD_ROW`, `FOOTER_ROW`), since an index written out by hand goes on meaning what it used to
- **The whole description is carried off the one read, and the cut is on the view.** `section_prose` replaced `section_opening`, which cut to the opening line at read time: the campaign file is only in hand while the campaigns directory is being read, so what that read has to carry is everything a view might want, and `CampaignRow::summary` takes the one line the picker draws back off it. Two fields, one cut from the other, are two strings free to come from different reads of the same file
- **`CAMPAIGN_PROSE_ROWS` is a constant, not a height fitted to the description.** Three rows of prose plus a border either side. A frame that grew and shrank with the campaign would resize every column whenever the filter changed, and a reader would look for a card where the previous campaign's description had put it. It does not have to be right for the longest description, because scrolling is what covers the rest — which is also why three was affordable where one row was not
- **`CAMPAIGN_PROSE_ROWS` is the collapsed height, and it is a constant rather than a height fitted to the description.** Three rows of prose plus a border either side. A frame that grew and shrank with the campaign would resize every column whenever the filter changed, and a reader would look for a card where the previous campaign's description had put it. It does not have to be right for the longest description, because scrolling is what covers the rest — which is also why three was affordable where one row was not
- **The expanded height is a share, not a second constant: half of what the frame and the columns divide.** That is the screen less the tab row and the footer, so the split is even between the two of them rather than even against rows neither gets all of. Half rather than most of it for the same reason the frame is not an overlay: the columns below are the campaign's members, and a reader inspecting the campaign has to go on seeing what it is made of. Floored, so the odd row goes to the cards. `Chrome::campaign_rows` takes the height because of this, and `frame_rows` is where it is called, since that is the one place that already has an area to take a share of — which is what keeps `Chrome` itself pure and copyable from `Board::chrome` with no screen to hand
- **The share is bounded at both ends, and `COLUMN_MIN_ROWS` is why.** `Constraint::Min(COLUMN_MIN_ROWS)` would take rows back from a frame that asked for too many, silently, and the frame's own measurement would then disagree with what is drawn — the fault `Chrome` exists to prevent. So the share is capped at what leaves the columns those rows, and floored at `CAMPAIGN_ROWS`, since expanding must never shrink the frame. On a board too short to divide, `enter` gives the collapsed height back rather than a height nothing measured. `the_expanded_share_is_bounded_at_both_ends` sweeps every height from 4 to 60, tabbed and not, because one screen that happens to work says nothing about the arithmetic
- **The frame says the rest of what it has to say on its borders**, the trade the detail overlay makes with its title and its page indicator: `(id) ~codename · Name` on the top one, the standing on the bottom right, and `q board` then the page indicator on the bottom left. Every row spent here is a row of cards
- **The frame's page indicator goes on the bottom border beside `q board`, not on the top beside the title.** The title is cut against the border it sits on, so an indicator up there would shorten a long campaign name the moment its description grew past three rows; and the bottom right is the standing's, which is what the frame is *about* where the indicator is only where the reader has got to in it. Dropped before `q board` when the two cannot both fit, since with a campaign selected the footer's last slot names `ctrl-c quit` and the border is the only place that says `q` gives the board back
- **`Focus` is the third place the selection can be, and `Tab` is what holds it.** The board had a column and a card and `select_card` clamped at zero; up from the top card now reaches the frame and down returns to the column it left, since the column index is never what changed. Per tab beside the filter and the offset, so switching away and back returns to where the tab was left. `Focus::Frame` while no campaign is selected is the one state that must never exist — `select_campaign` and `reload` are what keep it from arising
- **`Tab::selected` hands back nothing while the frame holds the selection.** Every key that acts on a card has to answer for the frame, and the answer for `enter` falls out of this rather than being written into the dispatch. `←→` are inert, because the frame spans the width of the board and moving the column underneath would change nothing on screen. `y` is the exception that earns its place: it copies the campaign's short id, so `y copy id` means the id of the selected thing in every state the selection can be in. No card is drawn reversed there either, since that highlight is what says which ticket a key is about
- **`Tab::selected` hands back nothing while the frame holds the selection.** Every key that acts on a card has to answer for the frame. `←→` are inert, because the frame spans the width of the board and moving the column underneath would change nothing on screen. `y` is the exception that earns its place: it copies the campaign's short id, so `y copy id` means the id of the selected thing in every state the selection can be in. No card is drawn reversed there either, since that highlight is what says which ticket a key is about
- **`enter` routes on the focus through `Board::toggle_focused`: the frame's height on the frame, the overlay on a card.** It used to be inert on the frame for free, because `Tab::selected` hands back nothing and `toggle_detail` therefore had nothing to open. That is no longer an answer, and the routing is in `Board` rather than in the `main.rs` arm for the reason `dismiss` and `scroll_page` are
- **`q` does not gain a layer for the expanded frame, and up and down do not take it back.** The expanded frame is the frame at its other height, not a thing laid over the board, so `q` goes on taking the campaign filter off from either height and `enter` is the only key that undoes what `enter` did. The height outlives the selection for the same reason: it is a view of the campaign the reader chose, so the columns stay short with the selection on a card. `Tab::expanded` sits beside the filter and resets where `select_campaign` and `reload` reset the focus and the offset — a different campaign opens collapsed and at the top of its own description
- **The toggle re-clamps the frame offset, through `scroll_frame(0, screen)`.** A taller viewport has a smaller last offset than a shorter one, so where the reader was can end up past the end of the frame they just asked for. The draw clamps on its own geometry either way, but the stored value has to be clamped too or the next `pgup` counts down from a number the frame never showed. A scroll of no pages is that clamp and nothing else, which keeps it in the one place it lives
- **The frame is out of reach from under an open ticket.** With the overlay open, up and down step through the tickets and it follows, so a selection that reached the frame would have to either close it on an arrow key or leave it showing a ticket nothing is selecting. `an_open_ticket_keeps_the_scroll_keys_from_the_frame` builds that state by hand for exactly this reason: the precedence has to hold whether or not a keypress can reach it
- **The standing comes from the columns, not from a walk of the tree.** While a campaign is selected the columns *are* its members, done included, so `Tab::standing` counts what is already in hand rather than paying what `campaign ls` pays per campaign. Counted over every column, drawn or not: hiding done is a change to what is drawn and never to what is counted
- **The way out is on the frame's own border, not in the footer.** `q board` sits on the thing it takes away, and the footer row was already at its width naming eight keys. Dropped whole when it and the standing would meet, the rule the page indicator follows
- **`c` is named in the footer only on a closed board with nothing selected**, which is where a reader has to find it. Over an open ticket and on a filtered board it is left out: the frame's border then says how to put the campaign away, and the row has no cells to spare. Incomplete rather than wrong, which is the trade this row is allowed to make — what it must never do is name a key by what it used to do
- **The footer has three states, because the selection has three places to be.** An open ticket, the frame, and the cards. On the frame it names `↓ board`, the two scroll keys and `y copy id`, and leaves out `enter` and `←→` because they do nothing there. `↑ frame` is not named on the board, on the same trade `c` is dropped on: the frame is drawn directly above the columns and up is the key that reaches it
- **The footer has three states, because the selection has three places to be.** An open ticket, the frame, and the cards. On the frame it names `↓ board`, `enter expand` or `enter collapse`, the two scroll keys and `y copy id`, and leaves out `←→` because they do nothing there. It has to say which way `enter` goes, since the key is a toggle and the frame is always at one of its two heights. `↑ frame` is not named on the board, on the same trade `c` is dropped on: the frame is drawn directly above the columns and up is the key that reaches it. Nor is the way to collapse an expanded frame named from the cards, which is the same trade again — the frame is right there and `↑` reaches it
- **`picker: Option<Picker>` is the whole mode**, the shape `search` and `detail` use, and `Board::picker_key` runs beside `search_key` ahead of the action arms for the same reason: an open list owns the keyboard, so `d` must not toggle done and `q` must not quit while a campaign is being chosen. `ctrl-c` is the one key it declines and every other control combination is swallowed, or `ctrl-d` would reach the arm bound to `d`
- **The picker's rows are `Tab::campaigns`, not a copy taken when it opened**, so a campaign filed elsewhere appears in an open picker on the next tick. It opens on the campaign already selected, so `c` on a filtered board says where you are as well as offering somewhere to go, and a board with no campaigns gets a `Notice` rather than an empty box that has to be dismissed to learn it was empty
- **A picker row draws a real codename only.** The row opens with the short id, so the card's `~<id>` fallback would print it twice and say nothing the second time
Generated
+1 -1
View File
@@ -1503,7 +1503,7 @@ dependencies = [
[[package]]
name = "worklane"
version = "0.26.2"
version = "0.26.4"
dependencies = [
"anyhow",
"assert_cmd",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "worklane"
version = "0.26.2"
version = "0.26.4"
edition = "2024"
[dependencies]
+1 -1
View File
@@ -5,7 +5,7 @@ Worklane is a local Kanban flow for agentic software development.
## Commands
| Command | Description |
|---------|-------------|
| `worklane` or `worklane tui [path...]` | Opens the board: four status columns, redrawn when the tree changes. Read only. Opens on backlog, committed and reviewing; `d` shows or hides done, whose count stays in the footer either way. Arrows or `hjkl` to move, `enter` for detail, `pgup`/`pgdn` to scroll an open ticket or the campaign frame, whichever the selection is on, with a page indicator on its border while there is more of it than fits, `/` to jump to the first ticket whose id or title matches, `y` to copy the selected ticket's short id to the clipboard, `c` to pick a campaign and filter the columns to its members, `q` to close whatever is open and then to quit. A card carries its campaign beside its tags, marked `~` and bold, and a comment count in its bottom right corner, the number then `❞` in cyan, before the criteria count and absent entirely when nobody has commented; while one is selected a frame above the columns names it, shows three rows of its description and says how far it has got, and `q` on its border gives the whole board back; up from the top card of a column moves the selection to that frame, where the scroll keys page through the description and down returns to the column it came from. Each path opens the first `.worklane` at or above it, the working directory by default. Several paths are monitored together, as a tab per project plus an `all` tab that merges them, with `tab` and `shift+tab` between them |
| `worklane` or `worklane tui [path...]` | Opens the board: four status columns, redrawn when the tree changes. Read only. Opens on backlog, committed and reviewing; `d` shows or hides done, whose count stays in the footer either way. Arrows or `hjkl` to move, `enter` for detail, `pgup`/`pgdn` to scroll an open ticket or the campaign frame, whichever the selection is on, with a page indicator on its border while there is more of it than fits, `/` to jump to the first ticket whose id or title matches, `y` to copy the selected ticket's short id to the clipboard, `c` to pick a campaign and filter the columns to its members, `q` to close whatever is open and then to quit. A card carries its campaign beside its tags, marked `~` and bold, and a comment count in its bottom right corner, the number then `❞` in cyan, before the criteria count and absent entirely when nobody has commented; while one is selected a frame above the columns names it, shows three rows of its description and says how far it has got, and `q` on its border gives the whole board back; up from the top card of a column moves the selection to that frame, where the scroll keys page through the description, `enter` gives it half the board and takes the rows back again, and down returns to the column it came from, leaving the frame at whatever height it was. Each path opens the first `.worklane` at or above it, the working directory by default. Several paths are monitored together, as a tab per project plus an `all` tab that merges them, with `tab` and `shift+tab` between them |
| `worklane init` | Creates `.worklane/` with backlog, committed, reviewing, done directories |
| `worklane add` | Creates a ticket in backlog with `--title`, `--description`, `--acceptance`, `--plan`, `--tags`, `--due`, `--owner`, `--priority` flags. `--due` takes `YYYY-MM-DD` and refuses anything else at parse time |
| `worklane ls [status]` | Lists tickets, sorted by priority then title. Optional positional status, and `--priority <1-5>`, `--tag <tag>` and `--campaign <campaign>`, which compose in any combination. `--tag` matches a whole value of the comma-separated Tags field, case sensitively, so `--tag bug` does not list a ticket tagged `bugfix` or one tagged `Bug`. `--ids` prints one ticket per line as its short id, a tab and its title, unstyled, done included, for a script or a completion |
+10 -5
View File
@@ -122,7 +122,7 @@ question asked by tag.
## Annotating a tag
```
worklane tags # every tag carried, with counts
worklane tags # every tag, its count and what it means
worklane tags add kitchen --annotation "..." # declare one, and say what it means
worklane tags set kitchen --annotation "..." # change what it means
```
@@ -132,10 +132,15 @@ annotation under it. It is what a person opens to find out what the board means
and it is what an agent reads before choosing one.
**Declaring a tag tags nothing, and tagging a ticket declares nothing.** The two lists are
separate on purpose: `worklane tags` counts what the tickets carry, `tags.md` records what
separate on purpose: the counts come from what the tickets carry, `tags.md` records what
the board agreed on, and the difference between them is the thing worth looking at. A tag
carried by tickets but never declared is a word somebody invented in a hurry.
`worklane tags` reports both, as the tag, a tab, the count, and a tab and the annotation's
opening line for a tag that is declared. So the two cases worth finding read off the
listing: a tag at a count of zero is declared and nobody has reached for it, and a tag with
no annotation column at all is carried and was never declared.
### What an annotation has to say
The definition is the easy half and does the least work. What stops drift is the boundary
@@ -177,9 +182,9 @@ ones two people quietly disagree about.
not. Each names the other, so the refusal tells you which you wanted.
- A tag cannot contain a comma, because a comma is what separates one tag from the next in
the Tags field. Surrounding spaces are trimmed.
- `worklane tags` counts tickets, so a tag you have declared and never applied does not
appear in it. That is not a fault; it is the file and the board disagreeing, which is
the state that tells you the vocabulary has not landed yet.
- A tag you have declared and never applied lists at a count of zero. That is not a fault;
it is the file and the board disagreeing, which is the state that tells you the
vocabulary has not landed yet.
- Nothing removes a declaration. There is no `tags rm`, so a tag declared in error stays
in the file with whatever its annotation says. Say it is retired in the annotation.
+37 -4
View File
@@ -192,14 +192,21 @@ complete -c worklane -n '__worklane_command_is ls' {campaign_flags} \
-x -a '(worklane campaign ls --ids)'
# Tags come from `worklane tags` rather than from a listing of objects, since a tag has no
# id. The count after the tab lands as fish's description, which is what makes the list
# worth reading: it says which spelling the board actually uses.
complete -c worklane -n '__worklane_command_is ls' {tag_flags} -x -a '(worklane tags)'
# id. Three fields now, the tag, its count and its annotation, and fish takes everything
# after the *first* tab as one description, so the count is dropped here rather than landing
# in the middle of the prose. `cut` and not `string replace` because the columns are what is
# being picked, and `cut -f1` is how a script reads this listing anyway.
#
# What is left is the annotation, and a tag the board carries but has never declared has
# none: it is offered with no description at all, which is the near-duplicate the file was
# added to catch. The count used to be the description and said the same thing more weakly.
complete -c worklane -n '__worklane_command_is ls' {tag_flags} \
-x -a '(worklane tags | cut -f1,3)'
# And `tags set` names one that is already declared, so it reads the same listing. `tags
# add` has no rule on purpose: it takes a tag the board does not have, so the candidates
# here are the values it refuses.
complete -c worklane -n '{tag_nested}' -a '(worklane tags)'
complete -c worklane -n '{tag_nested}' -a '(worklane tags | cut -f1,3)'
# `chown --clear` names the ticket in the flag too, since with no user to give there is
# no second positional to put it in. Scoped to `chown`, unlike the rule above: `set`
@@ -514,6 +521,32 @@ mod tests {
assert!(script.contains("__worklane_first_arg_of assign"), "{script}");
}
/// Every rule that reads the tag listing drops the count, because `worklane tags` prints
/// three fields and fish takes everything after the first tab as the description. Left
/// whole, a tag would be described as its count, a tab and its annotation.
///
/// Pinned per rule rather than once over the script: a rule added later that reads
/// `worklane tags` raw is the bug this catches, and it would not show up in a single
/// `contains`.
#[test]
fn every_tag_rule_takes_the_annotation_as_its_description() {
let script = fish_dynamic();
let reading: Vec<&str> = script
.lines()
.filter(|line| line.contains("(worklane tags"))
.collect();
assert_eq!(
reading.len(),
2,
"expected the ls --tag rule and the tags set one: {reading:?}"
);
for line in reading {
assert!(line.contains("(worklane tags | cut -f1,3)"), "{line}");
}
}
/// The one status positional and the one shell positional, which clap does not emit
/// possible values for. Read off the enums, so a fifth status would appear here on
/// its own.
+38 -13
View File
@@ -1217,27 +1217,52 @@ pub fn cmd_campaign_ls(worklane_dir: &Path, ids: bool) -> Result<()> {
Ok(())
}
/// Every tag on the board, with how many tickets carry it.
/// Every tag on the board: the ones the tickets carry, the ones the file declares, and
/// what each declared one means.
///
/// The vocabulary itself, which nothing else could answer: `ls --tag` filters by a tag
/// already known, and the decorated listing does not print tags at all. A grooming sweep
/// starts by asking what the vocabulary *is*, and `assets/PLAN.md` used to have to say
/// that the question could only be answered by reading the tickets.
///
/// **The union of the two vocabularies, not either one.** Since `tags.md` exists there are
/// two: the tags the file declares and the tags the tickets carry. A declared tag nothing
/// carries lists at zero rather than being dropped, and a carried tag nothing declares
/// still lists. Those two cases are the whole reason to declare tags at all, so this is
/// the command that has to show them apart.
///
/// **Alphabetical, and case sensitive.** `--tag` matches a whole value case sensitively,
/// so `bug` and `Bug` are two tags and listing them as one would hide the reason a filter
/// came back short. Sorting puts them next to each other, which is where a near-duplicate
/// is spotted.
///
/// Machine-readable, the second output in the tree that is: the tag, a tab, the count.
/// Fish reads what follows the tab as a description, a script takes `cut -f1`, and neither
/// wants an escape sequence. Every status, done included, for the reason `ls --ids`
/// includes it: a tag retired months ago is still part of the answer to what the
/// vocabulary has been.
/// Machine-readable, the second output in the tree that is: the tag, a tab, the count, and
/// a tab and the annotation's opening line for a tag the file declares. Fish reads what
/// follows the first tab as a description, a script takes `cut -f1`, and neither wants an
/// escape sequence.
///
/// **A carried but undeclared tag is marked by the absence of the third field**, which is
/// where the shape comes from. Anything appended to the tag itself would have a completion
/// offer a tag that does not exist, and anything added to the count would stop the second
/// field being a number. Absence costs neither, and it buys the one property a marker
/// could not: a board with no `tags.md` has every tag undeclared, so it prints two fields
/// a line, which is byte for byte what this printed before the file existed. The shipped
/// fish completion of an older version is still reading that.
///
/// Every status, done included, for the reason `ls --ids` includes it: a tag retired months
/// ago is still part of the answer to what the vocabulary has been.
pub fn cmd_tags(worklane_dir: &Path) -> Result<()> {
// Through the same `load` `tags add` uses, so a file that is there and cannot be read
// is an error here too. The listing is the one tag command that could go on without the
// file, and reporting a vocabulary while silently treating a broken file as no file is
// the wrong half of the answer.
let index = TagIndex::load(worklane_dir)?;
// BTreeMap rather than a sort afterwards: the order is the point, and the counting
// wants a map anyway.
let mut counts: BTreeMap<String, usize> = BTreeMap::new();
// wants a map anyway. Seeded from the vocabulary rather than merged into afterwards,
// which is what puts a declared tag nothing carries in at zero.
let mut counts: BTreeMap<String, usize> =
index.names().map(|tag| (tag.to_string(), 0)).collect();
for status in status_dirs() {
let status_path = worklane_dir.join(status);
@@ -1253,7 +1278,10 @@ pub fn cmd_tags(worklane_dir: &Path) -> Result<()> {
}
for (tag, count) in counts {
println!("{}\t{}", tag, count);
match index.summary(&tag) {
Some(summary) => println!("{tag}\t{count}\t{summary}"),
None => println!("{tag}\t{count}"),
}
}
Ok(())
@@ -1766,8 +1794,7 @@ mod tests {
/// will not share a microsecond, but it is the whole point of the guard.
#[test]
fn a_colliding_stem_takes_the_next_name_and_keeps_the_first() {
let dir = std::env::temp_dir().join(format!("worklane-test-{}", uuid::Uuid::new_v4()));
fs::create_dir_all(&dir).unwrap();
let dir = Fixture::new("worklane-test");
let first = write_new_comment(&dir, "20260820_143012_123456", "first").unwrap();
let second = write_new_comment(&dir, "20260820_143012_123456", "second").unwrap();
@@ -1786,7 +1813,5 @@ mod tests {
let mut names = vec![second.clone(), third.clone(), first.clone()];
names.sort();
assert_eq!(names, vec![first, second, third]);
fs::remove_dir_all(&dir).unwrap();
}
}
+4 -1
View File
@@ -210,7 +210,10 @@ fn run_tui(paths: &[std::path::PathBuf], start: &std::path::Path) -> Result<()>
KeyCode::Char('c') if key.modifiers.contains(KeyModifiers::CONTROL) => {
board.should_quit = true
}
KeyCode::Enter | KeyCode::Char(' ') => board.toggle_detail(),
// The frame's own height while it holds the selection, and the detail
// overlay on a card. `Board::toggle_focused` rather than a condition here,
// for the reason the scroll keys route there.
KeyCode::Enter | KeyCode::Char(' ') => board.toggle_focused(screen),
KeyCode::Left | KeyCode::Char('h') => board.select_column(-1, screen),
KeyCode::Right | KeyCode::Char('l') => board.select_column(1, screen),
// Up and down stay on the selection, open detail view or not, so a
+39
View File
@@ -153,6 +153,45 @@ impl TagIndex {
self.tags.contains_key(tag)
}
/// Every tag the file declares, alphabetical, whatever the board carries.
///
/// The half of the listing the status directories cannot answer. A tag declared and
/// never applied is carried by no ticket, so counting alone drops it, and that tag is
/// most of the reason the file exists: a word the board agreed on and nobody has
/// reached for yet is exactly what a grooming sweep wants to see.
pub fn names(&self) -> impl Iterator<Item = &str> {
self.tags.keys().map(String::as_str)
}
/// The opening line of what a tag means, or `None` for a tag the file does not declare.
///
/// The cut to one line lives here rather than on the parse, the way
/// [`CampaignRow::summary`] takes one line off a description the read carries whole:
/// the annotation is prose with paragraphs in it, and which view wants how much of it
/// is the view's business.
///
/// **`None` is what marks a carried but undeclared tag**, since `cmd_tags` prints no
/// third field for it. Nothing is appended to the tag itself and nothing is added to
/// the count, so `cut -f1` still yields the tag values and a board with no file at all
/// lists what it listed before the file existed.
///
/// A declared tag with nothing said about it answers [`NO_ANNOTATION`] rather than an
/// empty string, because an empty third field is a trailing tab and nothing else: it
/// would be the only difference between declared and not, and it would be invisible in
/// a terminal and in a completion alike. The placeholder is also what the file itself
/// holds under that heading, so the field stays the section's opening line either way.
///
/// [`CampaignRow::summary`]: crate::tui::CampaignRow::summary
/// [`NO_ANNOTATION`]: crate::tag::NO_ANNOTATION
pub fn summary(&self, tag: &str) -> Option<&str> {
let annotation = self.tags.get(tag)?;
Some(match annotation.lines().next() {
Some(line) => line,
None => NO_ANNOTATION,
})
}
/// Declare `tag`, or replace what it means.
///
/// One writer for both, because the file holds one section per tag either way and the
+489 -169
View File
File diff suppressed because it is too large Load Diff
+177 -16
View File
@@ -3077,10 +3077,183 @@ pub fn by_status_order(status: Status, a: &TicketItem, b: &TicketItem) -> std::c
by_stamp.then_with(|| by_priority_then_title(a, b))
}
/// The environment variable that keeps a test's fixture directory on disk.
///
/// Opt-in rather than on-by-default-when-a-test-fails, because the assertions in this crate
/// carry the state they are about: a failing board test prints the rendered rows, a failing
/// listing test prints the listing. The path is what you want when you would rather poke at
/// the files than read the message, which is the less common of the two.
#[cfg(test)]
pub const KEEP_FIXTURES: &str = "WORKLANE_KEEP_FIXTURES";
/// A fixture directory under the system temp directory that removes itself.
///
/// Every unit test in this crate builds its board or its status directory by hand under
/// `std::env::temp_dir()`. The ones that remembered a `remove_dir_all` at the end of the
/// test only cleaned up when their assertions passed, and most had no such line at all, so
/// a full run left one directory per test behind. `/tmp` reached 18363 of them and filled
/// the disk, which failed a link step and then a `git add` with "No space left on device" —
/// an error that names neither the tests nor what they left behind. That is b74dc5a.
///
/// A `Drop` rather than a line at the end of each test, because that is the only shape that
/// runs when an assertion fails, which is exactly when a fixture is most likely to be
/// stranded: unwinding runs destructors, so the guard holds on the failing path without the
/// test having to say anything.
///
/// `assert_fs::TempDir` is a dev-dependency already and is what the integration tests use,
/// and it was still not the answer here. It names its directories `.tmpXXXXXX`, which says
/// nothing about whose they are for the one case that matters — the one left on disk on
/// purpose — and it has no opinion about naming the path when it keeps one. Wrapping it to
/// add both is more code than this.
///
/// `Deref` to `Path`, so a fixture reads as the path it stands for at the call sites that
/// already had one and nothing had to change but the type.
#[cfg(test)]
pub struct Fixture {
/// What is removed: the directory this fixture created at the top.
root: std::path::PathBuf,
/// What the test works with, at or below the root. The two differ only for a fixture
/// that needs a named directory inside a parent it can also throw away.
path: std::path::PathBuf,
/// Whether to leave the directory behind, read once here rather than at drop time.
///
/// At construction because the answer must not be able to change between a test
/// starting and ending, and because it is what [`Fixture::swept`] can then turn off for
/// the tests that are about the guard rather than about this flag.
keep: bool,
}
#[cfg(test)]
impl Fixture {
/// A fresh directory, named after the family of tests that asked for it.
///
/// The prefix earns its place on the kept path: `worklane-tui-` says which suite left it
/// where a random name would not, and the uuid is what makes two fixtures with one
/// prefix two directories, so no test can reach another's.
pub fn new(prefix: &str) -> Self {
let root = std::env::temp_dir().join(format!("{prefix}-{}", uuid::Uuid::new_v4()));
std::fs::create_dir_all(&root).unwrap();
Fixture {
path: root.clone(),
root,
keep: std::env::var_os(KEEP_FIXTURES).is_some(),
}
}
/// The same fixture, swept up whatever the environment says.
///
/// For the tests below, which assert that the directory goes: they are about the guard
/// and not about the flag, so `WORKLANE_KEEP_FIXTURES` in a reader's environment must
/// not be able to fail them.
pub fn swept(mut self) -> Self {
self.keep = false;
self
}
/// The same fixture, pointing at a directory inside it.
///
/// For the tree a project test needs: `<root>/<project>/.worklane`, where the path the
/// test hands to `projects` is the project and what has to be removed is the root above
/// it. Consuming, so one directory never has two guards and therefore never two attempts
/// to remove it.
pub fn child(mut self, name: &str) -> Self {
self.path = self.root.join(name);
self
}
}
#[cfg(test)]
impl AsRef<std::path::Path> for Fixture {
fn as_ref(&self) -> &std::path::Path {
&self.path
}
}
/// Beside `AsRef`, because the two reach different call sites: a parameter bound by
/// `impl AsRef<Path>` is not a coercion site, and a parameter typed `&Path` is.
#[cfg(test)]
impl std::ops::Deref for Fixture {
type Target = std::path::Path;
fn deref(&self) -> &std::path::Path {
&self.path
}
}
#[cfg(test)]
impl Drop for Fixture {
fn drop(&mut self) {
if self.keep {
// Named, since a fixture kept and not findable is a fixture kept for nothing.
eprintln!("kept fixture {}", self.root.display());
return;
}
// Best effort. A directory that will not go must not turn a passing test into a
// failing one, and must not panic a second time out of a drop that is already
// unwinding, which would lose the failure the test was reporting.
std::fs::remove_dir_all(&self.root).ok();
}
}
#[cfg(test)]
mod tests {
use super::*;
/// The guard removes the directory when it goes out of scope, which is what makes the
/// cleanup independent of the assertions passing: unwinding runs destructors, so a
/// failing test drops its fixture on the way out exactly as a passing one does.
#[test]
fn a_fixture_removes_itself_when_its_guard_goes() {
let path = {
let dir = Fixture::new("worklane-guard").swept();
fs::write(dir.join("a.md"), "body").unwrap();
assert!(dir.exists(), "the fixture was not created");
dir.to_path_buf()
};
assert!(!path.exists(), "the fixture outlived its guard: {}", path.display());
}
/// And on the failing path, which is the whole point: a line at the end of a test does
/// not run when an assertion above it does not pass.
#[test]
fn a_fixture_removes_itself_when_the_test_panics() {
// The default hook would print this deliberate panic and make a green run read as a
// red one. Swapped for the length of the call and put straight back, which is as
// narrow as a process-wide hook can be made.
let hook = std::panic::take_hook();
std::panic::set_hook(Box::new(|_| {}));
let caught = std::panic::catch_unwind(|| {
let dir = Fixture::new("worklane-guard").swept();
// Handed out through the payload, so the assertion below has a path to look at
// whether or not the guard did its job.
std::panic::panic_any(dir.to_path_buf());
});
std::panic::set_hook(hook);
let path = *caught
.expect_err("the closure did not panic")
.downcast::<std::path::PathBuf>()
.expect("the panic did not carry the fixture path");
assert!(!path.exists(), "the fixture survived a failing test: {}", path.display());
}
/// Two fixtures with one prefix are two directories, so no test can rely on one another
/// test built — which the shared temp directory is what made possible.
#[test]
fn two_fixtures_with_one_prefix_are_two_directories() {
let first = Fixture::new("worklane-guard");
let second = Fixture::new("worklane-guard");
assert_ne!(first.to_path_buf(), second.to_path_buf(), "one directory, two guards");
let kept = second.to_path_buf();
drop(first);
assert!(kept.exists(), "one fixture going took the other with it");
}
#[test]
fn no_color_disables_colour_on_a_terminal() {
assert!(!colors_wanted(true, Some("1"), Some("xterm-256color")));
@@ -3454,8 +3627,7 @@ mod tests {
/// in `show`, so the two cannot disagree about what a criterion is.
#[test]
fn collect_ticket_items_counts_the_criteria_show_would_number() {
let dir = std::env::temp_dir().join(format!("worklane-count-{}", uuid::Uuid::new_v4()));
fs::create_dir_all(&dir).unwrap();
let dir = Fixture::new("worklane-count");
let write = |name: &str, body: &str| {
fs::write(
@@ -3480,8 +3652,6 @@ mod tests {
counted.contains(&None),
"a ticket with no criteria got a count: {counted:?}"
);
fs::remove_dir_all(&dir).unwrap();
}
/// The count is a directory listing rather than a read: nothing here parses a comment,
@@ -3537,8 +3707,7 @@ mod tests {
/// listing that stops on one malformed ticket is the worse failure.
#[test]
fn collect_ticket_items_reads_the_uuid_and_the_blockers_it_records() {
let dir = std::env::temp_dir().join(format!("worklane-blocked-{}", uuid::Uuid::new_v4()));
fs::create_dir_all(&dir).unwrap();
let dir = Fixture::new("worklane-blocked");
let uuid = |tail: &str| format!("11111111-0000-4000-8000-00000000000{tail}");
let write = |name: &str, relations: &str| {
@@ -3563,8 +3732,6 @@ mod tests {
assert_eq!(of("T1").blockers, vec![uuid("2")]);
assert!(of("T2").blockers.is_empty(), "a regression was read as a blocker");
assert!(of("T3").blockers.is_empty(), "an unreadable section was not survived");
fs::remove_dir_all(&dir).unwrap();
}
/// Whole values, so a filter or a card cannot confuse two tags that share a prefix.
@@ -3591,8 +3758,7 @@ mod tests {
#[test]
fn collect_ticket_items_lists_only_md_files() {
let dir = std::env::temp_dir().join(format!("worklane-stray-{}", uuid::Uuid::new_v4()));
fs::create_dir_all(&dir).unwrap();
let dir = Fixture::new("worklane-stray");
fs::write(
dir.join("11111111-0000-4000-8000-000000000001.md"),
@@ -3608,8 +3774,6 @@ mod tests {
let titles: Vec<&str> = items.iter().map(|item| item.title.as_str()).collect();
assert_eq!(titles, vec!["Real"], "{titles:?}");
fs::remove_dir_all(&dir).unwrap();
}
/// The template ticket, and the shape every insertion test measures against.
@@ -3927,8 +4091,7 @@ mod tests {
/// comparison time, which is what makes an ordered column cost one read per file.
#[test]
fn collect_ticket_items_reads_the_stamps_the_order_sorts_on() {
let dir = std::env::temp_dir().join(format!("worklane-stamps-{}", uuid::Uuid::new_v4()));
fs::create_dir_all(&dir).unwrap();
let dir = Fixture::new("worklane-stamps");
fs::write(
dir.join("aaaa_walked.md"),
@@ -3959,8 +4122,6 @@ mod tests {
assert_eq!(fresh.committed_on, None);
assert_eq!(fresh.submitted_on, None);
assert_eq!(fresh.completed_on, None);
fs::remove_dir_all(&dir).unwrap();
}
/// Removal is scoped to the section for the same reason the write is: a description
+109 -11
View File
@@ -5,10 +5,11 @@
//! under test are the ones that question needs: every status counted, case kept apart,
//! alphabetical order, and an output a shell can parse.
//!
//! `tags add` is the other half of the same question. The listing reports the vocabulary
//! the tickets *carry*; the file reports the one the board *intends*, and the tests below
//! are mostly about the two being allowed to disagree without either one damaging the
//! other.
//! `tags add` is the other half of the same question. The file reports the vocabulary the
//! board *intends* and the tickets carry the one it *has*, and the tests below are mostly
//! about the two being allowed to disagree without either one damaging the other. The
//! listing reports both and marks which is which, so the tests for the output shape are
//! about the marking: which field it lands in, and what a board with no file still prints.
use assert_cmd::Command;
use assert_fs::TempDir;
@@ -380,19 +381,113 @@ fn a_vocabulary_that_cannot_be_read_is_refused_rather_than_replaced() {
assert!(stray.is_empty(), "a temp file was left in .worklane");
}
/// The vocabulary does not touch the listing, which counts tickets. The two disagreeing is
/// the normal state and the thing the file is for.
/// The listing is the union of the two vocabularies, and the two disagreeing is the normal
/// state rather than a fault: a declaration tags no ticket, and tagging a ticket declares
/// nothing.
///
/// Both halves of the disagreement in one assertion, since neither is legible without the
/// other. `chore` is declared and carried by nothing, so it lists at zero with what it
/// means; `bug` is carried and declared by nothing, so it lists with a count and no third
/// field at all.
#[test]
fn a_declared_tag_is_not_a_carried_one() {
fn the_listing_is_the_union_of_the_declared_and_the_carried() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane, "backlog", "11111111", "bug");
run(&temp, &["tags", "add", "chore", "-a", "Housekeeping."]);
// `chore` is declared and carried by nothing, `bug` is carried and declared by nothing,
// and the listing still answers only the second question. Reporting both is 9564ac9.
assert_eq!(tags(&temp), vec!["bug\t1"]);
assert_eq!(tags(&temp), vec!["bug\t1", "chore\t0\tHousekeeping."]);
}
/// The third field is the annotation's *opening* line. An annotation is prose with
/// paragraphs in it, and a second line in this output would be read as a second tag.
#[test]
fn the_annotation_is_cut_to_its_opening_line() {
let temp = TempDir::new().unwrap();
setup_worklane(&temp);
run(
&temp,
&[
"tags",
"add",
"bug",
"-a",
"What it is.",
"-a",
"",
"-a",
"When to use it.",
],
);
assert_eq!(tags(&temp), vec!["bug\t0\tWhat it is."]);
}
/// A tag declared with nothing said about it still carries a third field, and it is the
/// placeholder the file itself holds under that heading.
///
/// The subtle case, and the reason the field is not simply left empty: an empty third field
/// is a trailing tab, so the only difference between a declared tag and an undeclared one
/// would be invisible in a terminal and in a completion alike.
#[test]
fn a_tag_declared_without_an_annotation_is_still_marked_as_declared() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane, "backlog", "11111111", "carried");
run(&temp, &["tags", "add", "declared"]);
assert_eq!(tags(&temp), vec!["carried\t1", "declared\t0\t_No annotation provided._"]);
}
/// `cut -f1` over the listing yields exactly the tag values, undeclared ones included.
///
/// The constraint the whole output shape is built around: whatever marks a carried but
/// undeclared tag must stay out of the first field, or a completion offers a tag that does
/// not exist and `ls --tag` comes back empty for it.
#[test]
fn the_first_field_is_the_bare_tag_whether_it_is_declared_or_not() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane, "backlog", "11111111", "carried,both");
run(&temp, &["tags", "add", "both", "-a", "Carried and declared."]);
run(&temp, &["tags", "add", "declared", "-a", "Declared only."]);
let first: Vec<String> = tags(&temp)
.iter()
.map(|line| line.split('\t').next().unwrap().to_string())
.collect();
assert_eq!(first, vec!["both", "carried", "declared"]);
// And each of them is a value `--tag` can match, which is what the first field is for.
for tag in ["both", "carried"] {
let out = run(&temp, &["ls", "--tag", tag, "--ids"]);
assert_eq!(
String::from_utf8_lossy(&out.stdout).lines().count(),
1,
"--tag {tag} matched nothing"
);
}
}
/// A board with no vocabulary lists what it listed before the file existed, byte for byte.
///
/// Every tag on such a board is carried and undeclared, so the absence of the third field
/// is what keeps the old output shape: a marker in it would have changed every line of
/// every board that predates the file, and the shipped fish completion of an older version
/// is still reading this.
#[test]
fn a_board_with_no_vocabulary_lists_what_it_listed_before_the_file_existed() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane, "backlog", "11111111", "bug, cli");
create_ticket(&worklane, "done", "22222222", "bug");
assert!(!temp.path().join(".worklane").join("tags.md").exists());
let out = run(&temp, &["tags"]);
assert_eq!(String::from_utf8_lossy(&out.stdout), "bug\t2\ncli\t1\n");
}
/// The bare form is the listing, byte for byte, because the shipped fish completion calls it
@@ -409,7 +504,10 @@ fn the_bare_form_and_ls_are_the_same_listing() {
assert!(bare.status.success());
assert_eq!(bare.stdout, group.stdout);
assert_eq!(String::from_utf8_lossy(&bare.stdout), "bug\t1\ncli\t1\n");
assert_eq!(
String::from_utf8_lossy(&bare.stdout),
"bug\t1\nchore\t0\t_No annotation provided._\ncli\t1\n"
);
}
// -------------------------------------------------- changing what a tag means --