Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bf0fd1bfe |
@@ -25,16 +25,25 @@
|
||||
## Ticket File Format
|
||||
- Filenames: `<uuid_v4>_<slug>.md`
|
||||
- The slug is the title through `slug()`: lowercased, alphanumerics plus `-` and `_` kept, spaces turned into dashes. `Ticket 06` lands as `<uuid>_ticket-06.md`. Derive fixture filenames through `slug()`, never by hand
|
||||
- Metadata fields parsed by `parse_ticket_field()`: `ID`, `Priority`, `Tags`, `Due`, `Owner`, `Created At`, `Committed On`, `Submitted On`, `Completed On`, `Campaign`, `Status`. The last four are the ones no ticket is born with: `add` writes none of them, so they are inserted on demand, against `METADATA_ORDER`, which is also what keeps `Status` last
|
||||
- The three stamps are `mv`'s, written by `set_status_stamp` from `Status::stamp_field`, and they **accumulate**: entering a status writes its field, re-entering restamps, and arriving anywhere removes the fields of every status *after* the target. One arrival rule keyed off `Status::ALL`, not a case per move, which is why a backward move truncates the journey at the target (`done` back to `reviewing` drops `Completed On`, anything back to `backlog` drops all three) and a forward skip under `-f` stamps only where it lands rather than fabricating the stages it jumped. A ticket that walks the whole flow ends with `Created At`, `Committed On`, `Submitted On` and `Completed On` side by side, so presence means *got this far and has not been sent back past it*, not *is here now* — `Status` is what says where it is. Not the history log either: these answer how far and when, once per stage, and every change along the way is the log's. `backlog` has no stamp, `Created At` already answers for it
|
||||
- **Each status column is ordered by its own entry stamp, through `by_status_order`.** Priority is the clock in the backlog and that column keeps priority then title; past it the question changes, so committed sorts by `Committed On` ascending, reviewing by `Submitted On` ascending, and done by `Completed On` descending. Said once: the head of every column is what the reader acts on next. An unstamped ticket sinks below every stamped one in its column, because a missing time is unknown rather than ancient and unknown must not claim the head of a queue; equal stamps and both-unstamped fall through to `by_priority_then_title`. One function keyed on the `Status`, taken by both `cmd_ls` branches, `list_ids`, `columns_of` and `campaign::members`, which is why those loops walk `Status::ALL` rather than `status_dirs()`. The stamps are read in `collect_ticket_items`' existing pass, the rule `criteria` and `tags` already hold, and compared as strings: `%Y-%m-%d %H:%M:%S` is lexicographic in chronological order, the property `Due` already relies on, so nothing parses a date at sort time
|
||||
- Metadata fields parsed by `parse_ticket_field()`: `ID`, `Priority`, `Tags`, `Due`, `Owner`, `Created At`, `Committed On`, `Submitted On`, `Completed On`, `Discarded On`, `Campaign`, `Status`. The last five are the ones no ticket is born with: `add` writes none of them, so they are inserted on demand, against `METADATA_ORDER`, which is also what keeps `Status` last
|
||||
- The four stamps are `mv`'s, written by `set_status_stamp` from `Status::stamp_field`, and they **accumulate**: entering a status writes its field, re-entering restamps, and arriving anywhere removes the fields of every status *after* the target. One arrival rule keyed off `Status::ALL`, not a case per move, which is why a backward move truncates the journey at the target (`done` back to `reviewing` drops `Completed On`, anything back to `backlog` drops all three) and a forward skip under `-f` stamps only where it lands rather than fabricating the stages it jumped. A ticket that walks the whole flow ends with `Created At`, `Committed On`, `Submitted On` and `Completed On` side by side, so presence means *got this far and has not been sent back past it*, not *is here now* — `Status` is what says where it is. Not the history log either: these answer how far and when, once per stage, and every change along the way is the log's. `backlog` has no stamp, `Created At` already answers for it
|
||||
- **`Discarded` is last in `Status::ALL`, and that placement is what makes the stamp rule fall out right.** Nothing sits after it, so a discard clears nothing: a ticket abandoned from reviewing keeps `Committed On` and `Submitted On`, and the file still says how far it got before it was dropped. It also makes every move out of discarded a backward move, so un-discarding needs `-f` without a rule of its own. `Discarded On` is its stamp, and `Completed On` stays untouched, because a discarded ticket was never done
|
||||
- **Each status column is ordered by its own entry stamp, through `by_status_order`.** Priority is the clock in the backlog and that column keeps priority then title; past it the question changes, so committed sorts by `Committed On` ascending, reviewing by `Submitted On` ascending, and done and discarded by their stamp descending. Said once: the head of every column is what the reader acts on next. An unstamped ticket sinks below every stamped one in its column, because a missing time is unknown rather than ancient and unknown must not claim the head of a queue; equal stamps and both-unstamped fall through to `by_priority_then_title`. One function keyed on the `Status`, taken by both `cmd_ls` branches, `list_ids`, `columns_of` and `campaign::members`, which is why those loops walk `Status::ALL` (or `Status::FLOW`) rather than `status_dirs()`. The stamps are read in `collect_ticket_items`' existing pass, the rule `criteria` and `tags` already hold, and compared as strings: `%Y-%m-%d %H:%M:%S` is lexicographic in chronological order, the property `Due` already relies on, so nothing parses a date at sort time
|
||||
- Format: `**Field Name**: value`
|
||||
- Ticket structure: `# Title` → `## Description` → `## Acceptance Criteria` → `## Implementation Plan` → `## Metadata`
|
||||
- A **campaign** file carries `ID`, `Codename`, `Owner` and `Created At`, in that order, and no `Status`. `Codename` sits directly under the ID because that is what it is, a second way to say which campaign this is; it is written by `campaign add --codename` alone and is `_Not set_` when the flag was not given. It is not in `METADATA_ORDER`, which is the anchor list for the *upsert* on a ticket, and nothing upserts a campaign
|
||||
- History entries stored in `.worklane/history/<ticket_uuid>/<stamp>_<kind>.md`, with the kind's marker (`**Comment**`, `**Status**`, `**Owner**`, `**Tags**`, `**Campaign**`), then the body, then `**Author**` and `**Time**`. See The History Log
|
||||
|
||||
## Status Workflow
|
||||
`backlog` → `committed` → `reviewing` → `done`
|
||||
`backlog` → `committed` → `reviewing` → `done`, and `discarded` off to one side
|
||||
|
||||
- **`Status::ALL` and `Status::FLOW` are two different questions, and picking the wrong one is the mistake to watch for here.** `ALL` is every directory that can hold a ticket, which is what the tree walkers want: `status_dirs`, `RelationIndex::load`, `collect_ticket_items`' callers, `cmd_tags`, `list_ids`, the resolver and the digest all have to see a discarded ticket or it becomes unaddressable. `FLOW` is the four stages work moves through, which is what the *board* draws: a discarded column on screen is a136d13's ticket, not a side effect of the status existing, and keeping it out of `FLOW` is also what keeps done the last drawn column so hiding it stays a prefix
|
||||
- **Discarding is not a stage, so the walk rules do not apply to entering it.** `mv --status discarded` is allowed from any status with no `-f`, because a backlog ticket that turns out to be a duplicate should not have to be walked through committed and reviewing to be abandoned. Leaving it needs `-f`, which comes free from the backward-move rule
|
||||
- **The two dependency guards look opposite ways, and `mv` picks by direction.** `check_blockers` asks what this ticket waits on and gates work moves; `check_dependents` asks who waits on this ticket and gates the discard. A ticket being abandoned owes nothing to its own blockers, but the tickets blocked *by* it recorded a dependency on work that is about to be declared never-happening, so those plans get a look before the ground moves. `-f` is the caller saying they looked. Both name every offender rather than the first, and both skip targets that are themselves done or discarded
|
||||
- **Discarded satisfies a block the way done does.** There is nothing left to wait for, and whether the dependent still makes sense was asked at discard time by the guard above, which is what makes it safe to pass here rather than a second place to re-ask
|
||||
- **Both terminal statuses are hidden by default and counted anyway.** `ls` leaves done and discarded out of the decorated listing and keeps them in the summary counts, and `--ids` and the status positional still reach both: a ticket nobody will work still has to be nameable by a completion or a script
|
||||
- **A campaign counts a discarded member as finished.** The work was decided out of the campaign rather than left in it, and counting it outstanding would hold a campaign open forever over a ticket nobody will ever do
|
||||
- **`mv` creates the target directory before moving into it.** A board made before a status existed has no directory for it, and the first move into one is the wrong place to refuse. `init` gets all five from `status_dirs()`
|
||||
|
||||
**How to use worklane is in `assets/SKILL.md`, not here.** That document is what
|
||||
`worklane install-skill` ships, so it is the one place the flow, the move-as-you-work
|
||||
@@ -45,7 +54,7 @@ and this file is for what someone changing worklane's own code needs.
|
||||
## Testing
|
||||
- Run: `cargo test`
|
||||
- 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
|
||||
- `setup_worklane()` creates temp `.worklane/` with the four flow 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. **The fixtures deliberately do not create `discarded/`**, so every discard test runs against a board that predates the status and `mv_creates_the_discarded_directory_on_a_board_that_predates_it` is not the only thing exercising the on-demand creation
|
||||
- `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
|
||||
@@ -447,7 +456,7 @@ and this file is for what someone changing worklane's own code needs.
|
||||
- Unknown values (`_None_`, `_Not set_`) → grey (38;5;8)
|
||||
- Priority ramp → brightred (1), red (2), orange (3), cyan (4), grey (5). Green is deliberately absent: it means title
|
||||
- Relation kind mark → brightred `×` blocked by and blocks, cyan `→` relates to, orange `←` regression of and regressed by. A small ramp inside one column, the way the priority meter is: the mark says which kind of edge the row is, so none of these three is a colour standing in for the uuid or the title beside it. Brightred on the cross rather than red, because the id one cell to its right is red and the two would blend. It is the colour and the glyph a held-up card already carries, which is the point: one vocabulary for blocking
|
||||
- Relation status mark → grey `○` backlog, orange `◐` committed, cyan `◐` reviewing, green `●` done, grey `?` for a target the board does not hold. The second ramp in that column: the shape says how far the target has got and the colour tells the two middle stages apart, since both are half circles. **Green is here and deliberately absent from the priority ramp**, where it would sit on a whole line and read as a title; on a one-cell mark with no title behind it, it is the obvious colour for finished and nothing else wants it. Orange keeps the meaning it already has, Status, and grey keeps unset for the one row with no status to show
|
||||
- Relation status mark → grey `○` backlog, orange `◐` committed, cyan `◐` reviewing, green `●` done, grey `●` discarded, grey `?` for a target the board does not hold. Discarded takes the full circle of done in the grey of the untouched pile: nothing is left to do, and it is not an achievement. The *pair* is what has to be unique, which is the same bargain the two half circles already take, and `every_status_has_a_mark` pins it against `status_dirs`. The second ramp in that column: the shape says how far the target has got and the colour tells the two middle stages apart, since both are half circles. **Green is here and deliberately absent from the priority ramp**, where it would sit on a whole line and read as a title; on a one-cell mark with no title behind it, it is the obvious colour for finished and nothing else wants it. Orange keeps the meaning it already has, Status, and grey keeps unset for the one row with no status to show
|
||||
- Markdown link → cyan, markers and url kept. Not a new meaning for the colour: the plan numbers, the criterion numbers and the `relates to` mark are already cyan inside a rendered body, and a link is the same kind of thing, a pointer the reader may follow rather than a value. The url is not hidden behind the text the way a renderer would hide it, because `show` prints to a terminal worklane cannot assume will make it clickable, and a link whose target cannot be read is worse than a long line
|
||||
- Chrome → grey. The footer's key names, a rendered `[ ]`, and the overlay's page indicator. Not a new slot: grey already means "what a reader skips", which is the other half of the unset-value meaning, and none of these is a value. The indicator in orange would read as the title it faces across the overlay, in cyan as a timestamp, and in the priority ramp's colours as a level
|
||||
- Campaign label → its codename through `tag_color`, bold, marked `~`. The colour is what groups a campaign across the cards that carry it, which is exactly what a tag's colour is for, and one word is one colour in every view because `tag_color` is a pure function of it. The mark and the bold are what tell it from a tag on a row that holds both: the mark is not `#`, or the row would read as a list of tags with a stranger in it, and not `@`, which reads as a person on every board anyone has used. `Codename` in a metadata table takes the colour without the mark, since the field name has already said what it is
|
||||
|
||||
Generated
+1
-1
@@ -1503,7 +1503,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "worklane"
|
||||
version = "0.30.0"
|
||||
version = "0.31.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"assert_cmd",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "worklane"
|
||||
version = "0.30.0"
|
||||
version = "0.31.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -5,12 +5,12 @@ 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, `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` 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. Discarded tickets are not drawn yet, `worklane ls discarded` is where they are read. 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, discarded 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 |
|
||||
| `worklane show <id>` | Shows ticket by UUID prefix (4+ chars), title substring, or filename substring. A campaign is addressed the same way, plus its exact codename, which wins over all three. Ends with the ticket's history: every comment on it and every change to its status, owner or tags, oldest first, each naming who made it |
|
||||
| `worklane mv <id> --status <target> [-f]` | Moves ticket between statuses. Default: forward only, one stage at a time. `-f` bypasses both restrictions. Records a `status` entry in the ticket's history, after the move: a refused or no-op move records nothing. `--actor` names the writer of that entry |
|
||||
| `worklane mv <id> --status <target> [-f]` | Moves ticket between statuses. Default: forward only, one stage at a time. `-f` bypasses both restrictions. `--status discarded` is exempt and reachable from anywhere, for a ticket that will not be done; leaving `discarded` is a backward move and needs `-f`. Discarding is refused while open tickets are blocked by the ticket, `-f` overrides. Records a `status` entry in the ticket's history, after the move: a refused or no-op move records nothing. `--actor` names the writer of that entry |
|
||||
| `worklane set <ticket>` | Replaces fields with `--title`, `--description`, `--acceptance`, `--plan`, `--tags`, `--due`, `--priority`. At least one required. Changing the title renames the file, keeping the UUID. `--clear <field>` returns a field to unset instead, repeatable, taking `due`, `tags`, `priority`, `description`, `acceptance` or `plan`, and writing back exactly what `add` writes for a field it was never given. No `title`, which addresses the ticket, and no `owner`, which is `chown`'s. Replacing and clearing the same field in one call is refused. `--tags` records a `tags` entry in the ticket's history, with the tags before and after, and it is the only field of this command's that is logged; `--actor` names the writer of that entry |
|
||||
| `worklane append <ticket>` | Adds to a section with `--description`, `--acceptance`, `--plan`. At least one required. The description gains a paragraph; list items go on the end, steps numbered on from the last |
|
||||
| `worklane relate <ticket>` | Records an edge to another ticket with `--blocked-by`, `--regression-of` or `--relates-to`, each repeatable. At least one required. Only the ticket named is written; `show` derives the other end by scanning. `mv` refuses to move a ticket blocked by one that is not done, unless `-f` |
|
||||
@@ -51,7 +51,7 @@ asks worklane for the one thing only the board knows:
|
||||
|
||||
```
|
||||
worklane show <TAB> every ticket, id and title, done included
|
||||
worklane mv <TAB> the same, then --status <TAB> for the four
|
||||
worklane mv <TAB> the same, then --status <TAB> for the five
|
||||
worklane chown alice <TAB> the ticket, which is the second argument here
|
||||
worklane chown --clear <TAB> the ticket, which the flag carries here
|
||||
worklane relate x --blocked-by <TAB>
|
||||
|
||||
+47
-18
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: worklane
|
||||
description: Manage tickets on a local worklane kanban board with the `worklane` CLI, backed by markdown files in a `.worklane/` directory. Use whenever you need to file, find, read, update, comment on or move a ticket, when asked what is on the board or what to pick up next, and when reporting work you are not going to do in the change at hand. Covers the four statuses, how a ticket is addressed, what belongs in each section, and the argument traps that silently swallow a flag.
|
||||
description: Manage tickets on a local worklane kanban board with the `worklane` CLI, backed by markdown files in a `.worklane/` directory. Use whenever you need to file, find, read, update, comment on or move a ticket, when asked what is on the board or what to pick up next, and when reporting work you are not going to do in the change at hand. Covers the five statuses, how a ticket is addressed, what belongs in each section, and the argument traps that silently swallow a flag.
|
||||
---
|
||||
|
||||
# worklane
|
||||
@@ -20,7 +20,7 @@ a person, not for you: it takes over the screen and does not return until quit.
|
||||
|
||||
## The flow
|
||||
|
||||
`backlog` → `committed` → `reviewing` → `done`
|
||||
`backlog` → `committed` → `reviewing` → `done`, with `discarded` off to one side
|
||||
|
||||
**Move the ticket as you work it, not afterwards.** `worklane mv <id> --status committed`
|
||||
before writing any code, and `--status reviewing` once it is done and the tests pass. The
|
||||
@@ -35,11 +35,39 @@ skipping move, for correcting a mistake.
|
||||
A move is also refused while the ticket is blocked by one that is not done yet, see
|
||||
[Relating tickets](#relating-tickets).
|
||||
|
||||
`mv` stamps the time as it goes: `Committed On`, `Submitted On` and `Completed On`, one
|
||||
field for the status the ticket is in now, shown by `show` among the rest of the
|
||||
metadata. Only the current one is kept, so the stamp says how long the ticket has been
|
||||
where it is, not how long each earlier stage took. Nothing else writes them, and moving
|
||||
a ticket back removes the stamp of the status it left.
|
||||
`mv` stamps the time as it goes: `Committed On`, `Submitted On`, `Completed On` and
|
||||
`Discarded On`, shown by `show` among the rest of the metadata. They **accumulate**, so a
|
||||
ticket that walked the whole flow carries all of them side by side and the journey is
|
||||
legible; presence means it got that far and has not been sent back past it, not that it
|
||||
is there now, which is what `Status` says. Moving a ticket back drops the stamps of every
|
||||
stage after where it lands.
|
||||
|
||||
## Discarding a ticket
|
||||
|
||||
`worklane mv <id> --status discarded` is where a ticket goes that will not be done: a
|
||||
duplicate, something obsolete, something that turned out to be wrong. It keeps the record
|
||||
and the relations, which deleting the file by hand would destroy.
|
||||
|
||||
```
|
||||
worklane mv 1b78a24 --status discarded
|
||||
```
|
||||
|
||||
Reachable from any status and needs no `-f`, because discarding is not a stage of work: a
|
||||
backlog ticket does not have to be walked through `committed` to be abandoned. **Say why
|
||||
in a comment before you discard it.** The status records that it will not happen and
|
||||
nothing records what was decided, and that is the question somebody asks in six months.
|
||||
|
||||
What it means everywhere else:
|
||||
|
||||
- `ls` leaves it out of the listing and keeps it in the counts, the way it treats `done`.
|
||||
`ls discarded` and `--ids` still reach it
|
||||
- A campaign counts a discarded member as **finished**: the work left the campaign rather
|
||||
than sitting in it unfinished
|
||||
- A discarded ticket **blocks nothing**, so a ticket waiting on it can move
|
||||
- Discarding a ticket that open tickets are blocked by is **refused**, naming them: their
|
||||
plans depended on this work, so they need a look first. `-f` says you looked
|
||||
- Getting it back is a backward move, so it needs `-f`:
|
||||
`worklane mv 1b78a24 --status backlog -f`
|
||||
|
||||
## Reading the board
|
||||
|
||||
@@ -54,7 +82,7 @@ worklane show 1b78a24 # one ticket, body and history
|
||||
`ls` prints a seven-character id per ticket. That is what you address it by.
|
||||
|
||||
`worklane ls --ids` prints the same tickets as an id, a tab and a title, one per line and
|
||||
unstyled, with done included and the filters still applying. That is the form to parse
|
||||
unstyled, with done and discarded included and the filters still applying. That is the form to parse
|
||||
when you want the ids themselves: `worklane ls --ids | cut -f1`. The decorated listing is
|
||||
for reading, not for cutting up.
|
||||
|
||||
@@ -159,7 +187,7 @@ one command here that does not start with the ticket. The user is free text and
|
||||
checked against nothing. Swap the two and the call fails, because the username has to
|
||||
resolve as a ticket. `--clear` replaces both arguments with the ticket alone.
|
||||
|
||||
`worklane init` creates `.worklane/` with the four status directories and the campaigns
|
||||
`worklane init` creates `.worklane/` with the five status directories and the campaigns
|
||||
directory beside them, for a repo that has no board yet.
|
||||
|
||||
## Relating tickets
|
||||
@@ -176,9 +204,10 @@ on B. **Only one side is stored**, on the ticket you name, and `show` derives th
|
||||
end for the ticket at the far side, so never record both directions.
|
||||
|
||||
`--blocked-by` is enforced: `mv` refuses to move a ticket while a ticket it is blocked by
|
||||
is not in `done`, whichever move it is, and names every open blocker. `-f` moves it
|
||||
anyway, beside the backward and skipping moves it already allows. The other two kinds are
|
||||
reference data and never refuse anything.
|
||||
is not in `done` or `discarded`, whichever move it is, and names every open blocker. `-f`
|
||||
moves it anyway, beside the backward and skipping moves it already allows. It is enforced
|
||||
from the other end too: discarding a ticket that open tickets are blocked by is refused,
|
||||
naming them. The other two kinds are reference data and never refuse anything.
|
||||
|
||||
Recording a relation the ticket already holds reports no change. A ticket cannot relate
|
||||
to itself, and a target that later disappears shows as `_missing_` rather than silently
|
||||
@@ -187,15 +216,15 @@ going away.
|
||||
`show` marks each row twice, kind then status. The kind is `×` for `blocked by` and
|
||||
`blocks`, `→` for `relates to`, `←` for `regression of` and `regressed by`; both
|
||||
directions of one kind carry one mark, and the label is what says which end you are on.
|
||||
The status is the target's own: `○` backlog, `◐` committed or reviewing, `●` done, and
|
||||
`?` for a target the board no longer holds. So `blocked by × ● (1b78a24)` is a blocker
|
||||
The status is the target's own: `○` backlog, `◐` committed or reviewing, `●` done or
|
||||
discarded, and `?` for a target the board no longer holds. So `blocked by × ● (1b78a24)` is a blocker
|
||||
that is finished and `blocked by × ○ (1b78a24)` is one nobody has started. The board
|
||||
draws the same block.
|
||||
|
||||
Colour is what tells committed from reviewing, since both are `◐`, and **your output is a
|
||||
pipe, so you do not get the colour**. Read `◐` as under way, and if it matters which
|
||||
stage, `worklane show` on that target says so in its Status field. `●` and `○` are
|
||||
unambiguous without it, which are the two answers usually being asked for.
|
||||
Colour is what tells committed from reviewing apart, and done from discarded, since each
|
||||
pair shares a glyph, and **your output is a pipe, so you do not get the colour**. Read
|
||||
`◐` as under way and `●` as nothing left to do, and if it matters which of the two,
|
||||
`worklane show` on that target says so in its Status field. `○` is unambiguous without it.
|
||||
|
||||
## Campaigns
|
||||
|
||||
|
||||
+7
-3
@@ -207,11 +207,11 @@ pub fn resolved_for(content: &str, worklane_dir: &Path) -> Result<Resolved> {
|
||||
})
|
||||
}
|
||||
|
||||
/// The members of a campaign, grouped by status in flow order.
|
||||
/// The members of a campaign, grouped by status in flow order, discarded last.
|
||||
///
|
||||
/// Read through `collect_ticket_items`, the source `ls` and the board already use, so
|
||||
/// there is no second parser and the rows print the way every other listing does.
|
||||
/// Empty groups are kept: a campaign's shape is the four statuses, and a caller that
|
||||
/// Empty groups are kept: a campaign's shape is the statuses, and a caller that
|
||||
/// wants only the filled ones can say so.
|
||||
pub fn members(worklane_dir: &Path, uuid: &str) -> Result<Vec<(&'static str, Vec<TicketItem>)>> {
|
||||
let mut grouped = Vec::new();
|
||||
@@ -251,9 +251,13 @@ pub struct Standing {
|
||||
impl Standing {
|
||||
pub fn of(grouped: &[(&'static str, Vec<TicketItem>)]) -> Self {
|
||||
Self {
|
||||
// Discarded counts as finished: the work was decided out of the campaign,
|
||||
// not left in it, and one abandoned ticket must not hold a campaign open
|
||||
// forever. The same predicate `mv` gates on, so "nothing outstanding" means
|
||||
// one thing across the tool.
|
||||
done: grouped
|
||||
.iter()
|
||||
.filter(|(status, _)| *status == DONE)
|
||||
.filter(|(status, _)| !is_open(status))
|
||||
.map(|(_, items)| items.len())
|
||||
.sum(),
|
||||
total: grouped.iter().map(|(_, items)| items.len()).sum(),
|
||||
|
||||
+1
-1
@@ -568,7 +568,7 @@ mod tests {
|
||||
status.as_str()
|
||||
);
|
||||
}
|
||||
assert!(script.contains("-a 'backlog committed reviewing done' -d status"));
|
||||
assert!(script.contains("-a 'backlog committed reviewing done discarded' -d status"));
|
||||
for shell in ["fish", "bash", "zsh", "elvish", "powershell"] {
|
||||
assert!(script.contains(shell), "the shell positional is never offered {shell}");
|
||||
}
|
||||
|
||||
+73
-9
@@ -113,11 +113,12 @@ pub fn cmd_ls(args: &LsArgs, worklane_dir: &Path) -> Result<()> {
|
||||
println!(" [{}] {} {}", status.to_uppercase(), count, label);
|
||||
}
|
||||
|
||||
// Show all tickets except done grouped by status. Over `Status::ALL` rather
|
||||
// than the names, because each column is ordered by its own entry stamp and the
|
||||
// comparator is keyed on the status, not on the directory it was read from.
|
||||
// Show all tickets except the two terminal statuses, grouped by status. Over
|
||||
// `Status::ALL` rather than the names, because each column is ordered by its own
|
||||
// entry stamp and the comparator is keyed on the status, not on the directory it
|
||||
// was read from.
|
||||
for status in Status::ALL {
|
||||
if status.as_str() == DONE {
|
||||
if !is_open(status.as_str()) {
|
||||
continue;
|
||||
}
|
||||
let status_path = worklane_dir.join(status.as_str());
|
||||
@@ -524,7 +525,10 @@ fn check_blockers(worklane_dir: &Path, content: &str, title: &str) -> Result<()>
|
||||
|
||||
for blocker in &blockers {
|
||||
match index.get(&blocker.target) {
|
||||
Some(target) if target.status == DONE => {}
|
||||
// Discarded satisfies a block the way done does: there is nothing left to
|
||||
// wait for. Whether the dependent still makes sense was asked when the
|
||||
// blocker was discarded, which is `check_dependents`' refusal.
|
||||
Some(target) if !is_open(&target.status) => {}
|
||||
Some(target) => open.push(format!(
|
||||
" ({}) {} [{}]",
|
||||
color_text(short_id(&target.uuid), Color::Red),
|
||||
@@ -552,6 +556,49 @@ fn check_blockers(worklane_dir: &Path, content: &str, title: &str) -> Result<()>
|
||||
))
|
||||
}
|
||||
|
||||
/// Refuse discarding a ticket while open tickets are blocked by it.
|
||||
///
|
||||
/// The mirror of [`check_blockers`], asked at the other end of the edge: those tickets
|
||||
/// recorded a dependency on work that is about to be declared never-happening, so their
|
||||
/// plans need a look before the ground moves. `-f` is the caller saying they looked.
|
||||
///
|
||||
/// Tickets already done or discarded do not hold it up: a dependency that was satisfied
|
||||
/// or abandoned is nobody's plan anymore.
|
||||
fn check_dependents(worklane_dir: &Path, uuid: &str, title: &str) -> Result<()> {
|
||||
let index = RelationIndex::load(worklane_dir)?;
|
||||
|
||||
// Every open dependent, not the first, for the reason `check_blockers` names them
|
||||
// all.
|
||||
let waiting: Vec<String> = index
|
||||
.iter()
|
||||
.filter(|ticket| is_open(&ticket.status))
|
||||
.filter(|ticket| {
|
||||
ticket
|
||||
.relations
|
||||
.iter()
|
||||
.any(|relation| relation.kind == RelationKind::BlockedBy && relation.target == uuid)
|
||||
})
|
||||
.map(|ticket| {
|
||||
format!(
|
||||
" ({}) {} [{}]",
|
||||
color_text(short_id(&ticket.uuid), Color::Red),
|
||||
ticket.title,
|
||||
color_text(&ticket.status, Color::Orange),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
if waiting.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
Err(anyhow!(
|
||||
"Cannot discard '{}' while open tickets are blocked by it:\n{}\nUse --force (-f) to discard it anyway.",
|
||||
color_text(title, Color::Green),
|
||||
waiting.join("\n"),
|
||||
))
|
||||
}
|
||||
|
||||
/// A status is a [`Status`] rather than a string, so an unknown one is clap's to refuse
|
||||
/// and nothing here has to check. What is left is the order of the flow, which is
|
||||
/// `Status::ALL`.
|
||||
@@ -573,7 +620,13 @@ pub fn cmd_mv(
|
||||
.unwrap();
|
||||
let target_idx = Status::ALL.iter().position(|status| *status == target).unwrap();
|
||||
|
||||
if !force && target_idx < current_idx {
|
||||
// Discarding is not a stage of work, so the walk rules below do not apply to
|
||||
// entering it: a ticket is abandoned from wherever it stands. They do apply to
|
||||
// leaving it, which with discarded last in `Status::ALL` is always a backward move,
|
||||
// so un-discarding needs `-f` with no rule of its own.
|
||||
let discarding = target == Status::Discarded;
|
||||
|
||||
if !force && !discarding && target_idx < current_idx {
|
||||
return Err(anyhow!(
|
||||
"Cannot move backward from {} to {}. Use --force (-f) to allow.",
|
||||
color_text(¤t_status, Color::Orange),
|
||||
@@ -581,7 +634,7 @@ pub fn cmd_mv(
|
||||
));
|
||||
}
|
||||
|
||||
if !force && target_idx != current_idx + 1 && target_idx != current_idx {
|
||||
if !force && !discarding && target_idx != current_idx + 1 && target_idx != current_idx {
|
||||
return Err(anyhow!(
|
||||
"Can only move one stage forward at a time. Use --force (-f) to skip stages."
|
||||
));
|
||||
@@ -597,14 +650,25 @@ pub fn cmd_mv(
|
||||
|
||||
// After the no-op above, so a ticket is never refused for a move it is not making,
|
||||
// and behind `force`, which is where the other two overrides of a rule the board
|
||||
// keeps true already live.
|
||||
// keeps true already live. The two guards look opposite ways: a ticket being worked
|
||||
// must not run ahead of what it waits on, and a ticket being abandoned owes nothing
|
||||
// to its own blockers but must not be pulled out from under the tickets waiting on
|
||||
// it.
|
||||
if !force {
|
||||
check_blockers(&worklane_dir, &resolved, &title)?;
|
||||
match discarding {
|
||||
true => check_dependents(&worklane_dir, &parse_ticket_field(&resolved, "ID"), &title)?,
|
||||
false => check_blockers(&worklane_dir, &resolved, &title)?,
|
||||
}
|
||||
}
|
||||
|
||||
let current_path = worklane_dir.join(¤t_status);
|
||||
let target_path = worklane_dir.join(target_status);
|
||||
|
||||
// A board created before a status existed has no directory for it, and the first
|
||||
// move into one is the wrong place to refuse. Idempotent for every board that has
|
||||
// it.
|
||||
fs::create_dir_all(&target_path)?;
|
||||
|
||||
// Updated before the file is even located, so a ticket without a Status field is
|
||||
// refused for that reason rather than for whatever the lookup notices first.
|
||||
let content = set_status_field(&resolved, target_status, &title)?;
|
||||
|
||||
+39
-11
@@ -2013,9 +2013,11 @@ fn columns_of(worklane_dir: &Path) -> (Vec<Column>, CampaignIndex, TagIndex) {
|
||||
// `unwrap_or_default` on the campaigns index already avoids.
|
||||
let tags = TagIndex::load(worklane_dir).unwrap_or_default();
|
||||
|
||||
// Over `Status::ALL` rather than the names: each column is ordered by its own entry
|
||||
// stamp, so the build needs the status itself and not just the directory to read.
|
||||
let mut columns: Vec<Column> = Status::ALL
|
||||
// Over `Status::FLOW`, not `Status::ALL`: the board draws the stages work moves
|
||||
// through, and a discarded column on screen is a136d13's ticket, not a side effect
|
||||
// of the status existing. Each column is ordered by its own entry stamp, so the
|
||||
// build needs the status itself and not just the directory to read.
|
||||
let mut columns: Vec<Column> = Status::FLOW
|
||||
.into_iter()
|
||||
.map(|status| {
|
||||
// An absent or unreadable directory is an empty column, not a missing one:
|
||||
@@ -2245,7 +2247,7 @@ fn mark_blocked(columns: &mut [Column]) {
|
||||
for column in columns.iter_mut() {
|
||||
for card in column.cards.iter_mut() {
|
||||
card.blocked = card.ticket.blockers.iter().any(|blocker| {
|
||||
matches!(status_of.get(blocker.as_str()), Some(status) if *status != DONE)
|
||||
matches!(status_of.get(blocker.as_str()), Some(status) if is_open(status))
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2258,8 +2260,9 @@ fn mark_blocked(columns: &mut [Column]) {
|
||||
/// left as one project's column after another's: an overview whose order depended on
|
||||
/// the argument order would bury a p1 under another project's p5.
|
||||
fn merge(per_project: &[Vec<Column>], projects: &[Project]) -> Vec<Column> {
|
||||
status_dirs()
|
||||
Status::FLOW
|
||||
.into_iter()
|
||||
.map(Status::as_str)
|
||||
.enumerate()
|
||||
.map(|(index, status)| {
|
||||
let mut cards: Vec<Card> = Vec::new();
|
||||
@@ -3999,11 +4002,15 @@ mod tests {
|
||||
assert!(shown.ends_with('┐'), "{shown}");
|
||||
}
|
||||
|
||||
/// Hiding is a prefix of the columns, which only holds while done is last. The
|
||||
/// board leans on that, so the assumption is pinned rather than assumed.
|
||||
/// Hiding is a prefix of the columns, which only holds while done is last of what
|
||||
/// the board draws. The board leans on that, so the assumption is pinned rather
|
||||
/// than assumed. Discarded being last overall is the other decided order: the stamp
|
||||
/// arrival rule truncates by `Status::ALL`, so discarded after done is what lets a
|
||||
/// discard keep the journey the ticket made.
|
||||
#[test]
|
||||
fn the_done_column_is_last() {
|
||||
assert_eq!(status_dirs().last(), Some(&DONE));
|
||||
assert_eq!(Status::FLOW.last().map(|status| status.as_str()), Some(DONE));
|
||||
assert_eq!(status_dirs().last(), Some(&DISCARDED));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -4574,8 +4581,8 @@ mod tests {
|
||||
|
||||
board.toggle_done(SCREEN);
|
||||
let row = headings(&board, 120, 20);
|
||||
for status in status_dirs() {
|
||||
assert!(row.contains(&format!("{status} (0)")), "{row}");
|
||||
for status in Status::FLOW {
|
||||
assert!(row.contains(&format!("{} (0)", status.as_str())), "{row}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6360,6 +6367,27 @@ mod tests {
|
||||
assert!(marked_blocked(&one_board(&dir), "The waiter"));
|
||||
}
|
||||
|
||||
/// A discarded blocker holds nothing up, the answer `mv` gives it: there is nothing
|
||||
/// left to wait for.
|
||||
///
|
||||
/// The board reaches it through `is_open` rather than through the blocker being
|
||||
/// absent from the columns, which is what it would be today, since `columns_of`
|
||||
/// builds `Status::FLOW` and discarded is not in it. That distinction is the point of
|
||||
/// this test: when a136d13 draws the discarded column the blocker arrives in the map,
|
||||
/// and a rule written as `!= DONE` would start marking these cards while `mv` kept
|
||||
/// letting them move. The fixture writes the directory directly for that reason.
|
||||
#[test]
|
||||
fn a_discarded_blocker_marks_nothing() {
|
||||
let dir = board_dir();
|
||||
std::fs::create_dir_all(dir.join(DISCARDED)).unwrap();
|
||||
write_ticket(&dir, DISCARDED, BLOCKER, "The blocker", "");
|
||||
write_ticket(&dir, "backlog", WAITER, "The waiter", &blocked_by(BLOCKER));
|
||||
|
||||
assert!(!marked_blocked(&one_board(&dir), "The waiter"));
|
||||
assert!(!is_open(DISCARDED), "the rule the board and mv share");
|
||||
assert!(is_open("backlog") && is_open("committed") && is_open("reviewing"));
|
||||
}
|
||||
|
||||
/// The answer `mv` gives a dangling uuid: a bookkeeping fault, not a dependency.
|
||||
#[test]
|
||||
fn a_blocker_the_board_does_not_hold_marks_nothing() {
|
||||
@@ -7985,7 +8013,7 @@ mod tests {
|
||||
.collect();
|
||||
assert_eq!(titles, vec!["In v1".to_string(), "Also in v1".to_string()], "{titles:?}");
|
||||
// Every column is kept, empty ones included: a campaign's shape is the flow.
|
||||
assert_eq!(board.current().columns.len(), status_dirs().len());
|
||||
assert_eq!(board.current().columns.len(), Status::FLOW.len());
|
||||
}
|
||||
|
||||
/// The frame says which campaign the columns belong to, and how far it has got, from
|
||||
|
||||
+82
-18
@@ -1437,7 +1437,7 @@ pub fn parse_tags(content: &str) -> Vec<String> {
|
||||
/// Directly after ID, because that is where `campaign_body` writes it, so a campaign given
|
||||
/// a codename later ends up with the same file as one filed with it. Nothing ever upserts
|
||||
/// it on a ticket, so its place in a ticket's order costs nothing.
|
||||
const METADATA_ORDER: [&str; 12] = [
|
||||
const METADATA_ORDER: [&str; 13] = [
|
||||
"ID",
|
||||
CODENAME_FIELD,
|
||||
"Priority",
|
||||
@@ -1448,6 +1448,7 @@ const METADATA_ORDER: [&str; 12] = [
|
||||
COMMITTED_ON_FIELD,
|
||||
SUBMITTED_ON_FIELD,
|
||||
COMPLETED_ON_FIELD,
|
||||
DISCARDED_ON_FIELD,
|
||||
CAMPAIGN_FIELD,
|
||||
"Status",
|
||||
];
|
||||
@@ -1532,6 +1533,7 @@ fn insert_metadata_field(content: &str, field: &str, value: &str, title: &str) -
|
||||
pub const COMMITTED_ON_FIELD: &str = "Committed On";
|
||||
pub const SUBMITTED_ON_FIELD: &str = "Submitted On";
|
||||
pub const COMPLETED_ON_FIELD: &str = "Completed On";
|
||||
pub const DISCARDED_ON_FIELD: &str = "Discarded On";
|
||||
|
||||
/// Stamp the field of the status being entered and drop the ones after it.
|
||||
///
|
||||
@@ -2196,6 +2198,12 @@ impl RelationIndex {
|
||||
self.tickets.iter().find(|ticket| ticket.uuid == uuid)
|
||||
}
|
||||
|
||||
/// Every ticket the index holds, for a caller asking about the derived direction:
|
||||
/// which tickets point *at* one, which no single `get` can answer.
|
||||
pub fn iter(&self) -> impl Iterator<Item = &RelatedTicket> {
|
||||
self.tickets.iter()
|
||||
}
|
||||
|
||||
/// The relations other tickets hold pointing at `uuid`, as the kind reads from
|
||||
/// this end and the ticket that holds it.
|
||||
///
|
||||
@@ -2288,11 +2296,14 @@ pub const REGRESSION_MARK: &str = "\u{2190}";
|
||||
/// nobody has picked up, orange for work in hand, cyan for work waiting on a reader,
|
||||
/// green for done. Green is the one the priority ramp deliberately leaves out because it
|
||||
/// means a title, and it is safe on a one-cell mark that no title sits behind.
|
||||
const STATUS_MARKS: [(&str, &str, Color); 4] = [
|
||||
const STATUS_MARKS: [(&str, &str, Color); 5] = [
|
||||
("backlog", "\u{25cb}", Color::Grey),
|
||||
("committed", "\u{25d0}", Color::Orange),
|
||||
("reviewing", "\u{25d0}", Color::Cyan),
|
||||
("done", "\u{25cf}", Color::Green),
|
||||
// The full circle of done in the grey of the untouched pile: nothing is left to do,
|
||||
// and it is not an achievement. The pair is what is unique, as with the two halves.
|
||||
("discarded", "\u{25cf}", Color::Grey),
|
||||
];
|
||||
|
||||
/// The mark for a status, or `?` for a target the board no longer holds.
|
||||
@@ -2675,35 +2686,54 @@ pub fn trim_blank_ends(values: &[String]) -> &[String] {
|
||||
/// A status, as clap accepts it and as the directory is named.
|
||||
///
|
||||
/// An enum rather than the string it was, so an unknown status is a usage error at parse
|
||||
/// time with the four listed, the way `priority_level` and `iso_date` refuse a bad level
|
||||
/// time with the five listed, the way `priority_level` and `iso_date` refuse a bad level
|
||||
/// or date. That is the bargain the scalars already take, see AGENTS.md: nothing is
|
||||
/// written, the exit code is 2, and no handler has to check. It also gives every shell
|
||||
/// that completes possible values the four names for free.
|
||||
/// that completes possible values the five names for free.
|
||||
///
|
||||
/// The variants are in flow order, which is the order `mv` reads to decide whether a
|
||||
/// move goes forward, and the order [`status_dirs`] hands the two views.
|
||||
/// The variants are in flow order with `Discarded` last, which is the order `mv` reads
|
||||
/// to decide whether a move goes forward and the order the stamp arrival rule truncates
|
||||
/// by. Discarded sits after done deliberately: entering it clears nothing, so a ticket
|
||||
/// discarded from reviewing keeps the journey it made, and leaving it is always a
|
||||
/// backward move, which is what makes un-discarding need `-f` for free.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
|
||||
pub enum Status {
|
||||
Backlog,
|
||||
Committed,
|
||||
Reviewing,
|
||||
Done,
|
||||
Discarded,
|
||||
}
|
||||
|
||||
impl Status {
|
||||
/// Every status, in flow order. The one list, which [`status_dirs`], `mv` and every
|
||||
/// caller of [`by_status_order`] read rather than spelling the four names again.
|
||||
pub const ALL: [Status; 4] = [
|
||||
/// Every status, in flow order with discarded last. The one list, which
|
||||
/// [`status_dirs`], `mv` and every caller of [`by_status_order`] read rather than
|
||||
/// spelling the five names again.
|
||||
pub const ALL: [Status; 5] = [
|
||||
Status::Backlog,
|
||||
Status::Committed,
|
||||
Status::Reviewing,
|
||||
Status::Done,
|
||||
Status::Discarded,
|
||||
];
|
||||
|
||||
/// The stages work moves through: every status but discarded, which work never
|
||||
/// moves through, it only ends up in.
|
||||
///
|
||||
/// What the board draws its columns from, so done stays the last drawn column and
|
||||
/// hiding it stays a prefix of the list. Showing a discarded column is a136d13's,
|
||||
/// not a side effect of the status existing.
|
||||
pub const FLOW: [Status; 4] = [
|
||||
Status::Backlog,
|
||||
Status::Committed,
|
||||
Status::Reviewing,
|
||||
Status::Done,
|
||||
];
|
||||
|
||||
/// The field `mv` stamps on entering this status, for the three that have one.
|
||||
/// The field `mv` stamps on entering this status, for the four that have one.
|
||||
///
|
||||
/// Derived from the status rather than spelled at the call site, so the mapping is
|
||||
/// in one place and a fifth status either brings its own stamp or explicitly has
|
||||
/// in one place and a new status either brings its own stamp or explicitly has
|
||||
/// none.
|
||||
pub const fn stamp_field(self) -> Option<&'static str> {
|
||||
match self {
|
||||
@@ -2711,6 +2741,7 @@ impl Status {
|
||||
Status::Committed => Some(COMMITTED_ON_FIELD),
|
||||
Status::Reviewing => Some(SUBMITTED_ON_FIELD),
|
||||
Status::Done => Some(COMPLETED_ON_FIELD),
|
||||
Status::Discarded => Some(DISCARDED_ON_FIELD),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2722,6 +2753,7 @@ impl Status {
|
||||
Status::Committed => "committed",
|
||||
Status::Reviewing => "reviewing",
|
||||
Status::Done => "done",
|
||||
Status::Discarded => "discarded",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2734,11 +2766,34 @@ pub fn status_dirs() -> Vec<&'static str> {
|
||||
/// in the summary and leaves it out of the listing, and the board hides its column until
|
||||
/// asked. Named because that rule now has two readers.
|
||||
///
|
||||
/// It is deliberately last in `status_dirs()`. The board leans on that: hiding done drops
|
||||
/// the final column, so the other three keep their indices and the selection only has to
|
||||
/// be handled when it is sitting on done itself.
|
||||
/// It is deliberately last in [`Status::FLOW`], which is what the board draws. The board
|
||||
/// leans on that: hiding done drops the final column, so the other three keep their
|
||||
/// indices and the selection only has to be handled when it is sitting on done itself.
|
||||
pub const DONE: &str = Status::Done.as_str();
|
||||
|
||||
/// Where a ticket that will not be done ends up: the other terminal status, and the
|
||||
/// other one `ls` leaves out of the listing.
|
||||
///
|
||||
/// A discarded ticket counts as finished wherever progress is measured, since nothing is
|
||||
/// left to do, and blocks nothing. What it is not is done: the two directories keep
|
||||
/// "the work landed" and "the work was abandoned" answerable apart.
|
||||
pub const DISCARDED: &str = Status::Discarded.as_str();
|
||||
|
||||
/// Whether a ticket in this status still has something outstanding.
|
||||
///
|
||||
/// The two terminal statuses do not: done landed and discarded never will, so in both
|
||||
/// cases there is nothing left to wait for and nothing left to plan around. One spelling
|
||||
/// for all three readers, because `mv` refuses a move on it, refuses a discard on it and
|
||||
/// the board draws its blocked mark from it, and two views disagreeing about what counts
|
||||
/// as open would be the difference nobody can explain later.
|
||||
///
|
||||
/// Takes the status as a string because that is what the callers hold: the directory a
|
||||
/// ticket was found in, not a parsed [`Status`]. An unrecognised value reads as open,
|
||||
/// which is the safe direction: it surfaces rather than silently satisfying a block.
|
||||
pub fn is_open(status: &str) -> bool {
|
||||
status != DONE && status != DISCARDED
|
||||
}
|
||||
|
||||
/// Lowest and highest level a ticket can carry. 1 is the most urgent, which is
|
||||
/// what the `p1` to `p3` tags this replaced already meant.
|
||||
pub const PRIORITY_RANGE: std::ops::RangeInclusive<u8> = 1..=5;
|
||||
@@ -2867,6 +2922,8 @@ pub struct TicketItem {
|
||||
pub submitted_on: Option<String>,
|
||||
/// The same for done.
|
||||
pub completed_on: Option<String>,
|
||||
/// The same for discarded.
|
||||
pub discarded_on: Option<String>,
|
||||
}
|
||||
|
||||
impl TicketItem {
|
||||
@@ -2882,6 +2939,7 @@ impl TicketItem {
|
||||
Status::Committed => self.committed_on.as_deref(),
|
||||
Status::Reviewing => self.submitted_on.as_deref(),
|
||||
Status::Done => self.completed_on.as_deref(),
|
||||
Status::Discarded => self.discarded_on.as_deref(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3076,6 +3134,7 @@ pub fn collect_ticket_items(status_path: impl AsRef<Path>) -> Result<Vec<TicketI
|
||||
committed_on: parse_stamp(&content, Status::Committed),
|
||||
submitted_on: parse_stamp(&content, Status::Reviewing),
|
||||
completed_on: parse_stamp(&content, Status::Done),
|
||||
discarded_on: parse_stamp(&content, Status::Discarded),
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
@@ -3104,7 +3163,8 @@ pub fn by_priority_then_title(a: &TicketItem, b: &TicketItem) -> std::cmp::Order
|
||||
/// always printed. Past the backlog the question changes: committed asks what has waited
|
||||
/// longest, reviewing what was handed over first, done what just landed. The head of
|
||||
/// every column is therefore what the reader acts on next, which is ascending by entry
|
||||
/// stamp in committed and reviewing and descending in done, the way a changelog reads.
|
||||
/// stamp in committed and reviewing and descending in done and discarded, the way a
|
||||
/// changelog reads.
|
||||
///
|
||||
/// A ticket with no stamp sinks below every stamped one in its column. A missing time is
|
||||
/// unknown, not ancient, and unknown must not claim the head of a queue ahead of a wait
|
||||
@@ -3118,7 +3178,7 @@ pub fn by_priority_then_title(a: &TicketItem, b: &TicketItem) -> std::cmp::Order
|
||||
pub fn by_status_order(status: Status, a: &TicketItem, b: &TicketItem) -> std::cmp::Ordering {
|
||||
let by_stamp = match (a.entry_stamp(status), b.entry_stamp(status)) {
|
||||
(Some(left), Some(right)) => match status {
|
||||
Status::Done => right.cmp(left),
|
||||
Status::Done | Status::Discarded => right.cmp(left),
|
||||
_ => left.cmp(right),
|
||||
},
|
||||
(Some(_), None) => std::cmp::Ordering::Less,
|
||||
@@ -4132,7 +4192,11 @@ mod tests {
|
||||
_ => None,
|
||||
},
|
||||
completed_on: match status {
|
||||
Status::Done => stamp,
|
||||
Status::Done => stamp.clone(),
|
||||
_ => None,
|
||||
},
|
||||
discarded_on: match status {
|
||||
Status::Discarded => stamp,
|
||||
_ => None,
|
||||
},
|
||||
}
|
||||
@@ -5190,7 +5254,7 @@ Plain line with **bold** and a [link](http://x.test/a).
|
||||
);
|
||||
}
|
||||
|
||||
assert_eq!(seen.len(), 4, "{seen:?}");
|
||||
assert_eq!(seen.len(), status_dirs().len(), "{seen:?}");
|
||||
}
|
||||
|
||||
/// An unrecognised value reads as missing rather than as a fifth stage of the flow.
|
||||
|
||||
@@ -1703,3 +1703,43 @@ fn a_campaign_with_no_description_section_is_refused() {
|
||||
assert_eq!(fs::read_to_string(&path).unwrap(), before, "the file was written");
|
||||
}
|
||||
}
|
||||
|
||||
/// A discarded member counts as finished. The work was decided out of the campaign
|
||||
/// rather than left in it, and counting it as outstanding would hold the campaign open
|
||||
/// forever over a ticket nobody will ever do.
|
||||
#[test]
|
||||
fn a_discarded_member_counts_as_finished() {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let _worklane = board(&temp);
|
||||
|
||||
run(&temp, &["assign", "v1 release", MEMBER]);
|
||||
run(&temp, &["assign", "v1 release", OTHER]);
|
||||
|
||||
// Two members, one done and one in the backlog: open and half finished.
|
||||
let listing = stdout(&run(&temp, &["campaign", "ls"]));
|
||||
assert!(listing.contains("v1 release | 1/2 done [open]"), "{listing}");
|
||||
|
||||
let discarded = run(&temp, &["mv", MEMBER, "--status", "discarded"]);
|
||||
assert!(discarded.status.success(), "{}", stderr(&discarded));
|
||||
|
||||
let listing = stdout(&run(&temp, &["campaign", "ls"]));
|
||||
assert!(listing.contains("v1 release | 2/2 done [done]"), "{listing}");
|
||||
}
|
||||
|
||||
/// `campaign show` groups the members by status, and a discarded one has a group to
|
||||
/// land in rather than dropping out of the campaign it belongs to.
|
||||
#[test]
|
||||
fn campaign_show_lists_a_discarded_member() {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let _worklane = board(&temp);
|
||||
|
||||
run(&temp, &["assign", "v1 release", MEMBER]);
|
||||
assert!(
|
||||
run(&temp, &["mv", MEMBER, "--status", "discarded"])
|
||||
.status
|
||||
.success()
|
||||
);
|
||||
|
||||
let shown = stdout(&run(&temp, &["campaign", "show", "aa11"]));
|
||||
assert!(shown.contains("The member"), "the discarded member is gone: {shown}");
|
||||
}
|
||||
|
||||
@@ -62,10 +62,10 @@ fn no_other_shell_gets_the_fish_half() {
|
||||
#[test]
|
||||
fn fish_is_offered_every_status() {
|
||||
let out = script("fish");
|
||||
for status in ["backlog", "committed", "reviewing", "done"] {
|
||||
for status in ["backlog", "committed", "reviewing", "done", "discarded"] {
|
||||
assert!(out.contains(status), "fish is never offered {status}");
|
||||
}
|
||||
assert!(out.contains("-a 'backlog committed reviewing done' -d status"));
|
||||
assert!(out.contains("-a 'backlog committed reviewing done discarded' -d status"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -903,3 +903,47 @@ fn ls_ids_prints_the_same_order_the_listing_does() {
|
||||
let seen = positions(&stdout, ["Oldest", "Newest", "Unstamped"]);
|
||||
assert!(seen[0] < seen[1] && seen[1] < seen[2], "{stdout}");
|
||||
}
|
||||
|
||||
/// Discarded is the other terminal status, so the decorated listing leaves it out the
|
||||
/// way it leaves done out: it is counted in the summary and not listed. The positional
|
||||
/// and `--ids` still reach it, since a ticket nobody will work still has to be nameable.
|
||||
#[test]
|
||||
fn ls_hides_discarded_but_counts_and_can_name_it() {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let worklane = setup_worklane(&temp);
|
||||
temp.child(".worklane")
|
||||
.child("discarded")
|
||||
.create_dir_all()
|
||||
.unwrap();
|
||||
|
||||
create_ticket_with_id(
|
||||
&worklane,
|
||||
"backlog",
|
||||
"Still open",
|
||||
"aaaaaaa1-0000-0000-0000-000000000001",
|
||||
"bug",
|
||||
);
|
||||
create_ticket_with_id(
|
||||
&worklane,
|
||||
"discarded",
|
||||
"Abandoned",
|
||||
"ccccccc3-0000-0000-0000-000000000003",
|
||||
"bug",
|
||||
);
|
||||
|
||||
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
||||
cmd.current_dir(temp.path()).arg("ls");
|
||||
let stdout = get_stdout(&mut cmd);
|
||||
assert!(stdout.contains("Still open"), "{stdout}");
|
||||
assert!(!stdout.contains("Abandoned"), "discarded was listed: {stdout}");
|
||||
assert!(stdout.contains("DISCARDED"), "discarded is not counted: {stdout}");
|
||||
|
||||
// Nameable both ways, the way done is.
|
||||
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
||||
cmd.current_dir(temp.path()).args(["ls", "--ids"]);
|
||||
assert!(get_stdout(&mut cmd).contains("Abandoned"));
|
||||
|
||||
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
||||
cmd.current_dir(temp.path()).args(["ls", "discarded"]);
|
||||
assert!(get_stdout(&mut cmd).contains("Abandoned"));
|
||||
}
|
||||
|
||||
+216
@@ -1144,3 +1144,219 @@ fn mv_does_not_restamp_a_no_op_move() {
|
||||
|
||||
assert_eq!(ticket_at(&worklane, "committed", &filename), before);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- discarded --
|
||||
|
||||
/// Discarding is not a stage of work, so it is reachable from wherever the ticket
|
||||
/// stands and needs no `-f`: a backlog ticket that turns out to be a duplicate should
|
||||
/// not have to be walked through committed and reviewing to be abandoned.
|
||||
#[test]
|
||||
fn mv_discards_from_every_status_without_force() {
|
||||
for from in ["backlog", "committed", "reviewing", "done"] {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let worklane = setup_worklane(&temp);
|
||||
let filename = stamped_ticket(&worklane, from);
|
||||
|
||||
let out = move_ticket(&temp, "cccc3333", "discarded", false);
|
||||
assert!(
|
||||
out.status.success(),
|
||||
"discarding from {from}: {}",
|
||||
String::from_utf8_lossy(&out.stderr)
|
||||
);
|
||||
assert!(
|
||||
worklane.join("discarded").join(&filename).exists(),
|
||||
"the ticket did not land in discarded from {from}"
|
||||
);
|
||||
assert_eq!(md_files(&worklane.join(from)).len(), 0, "left behind in {from}");
|
||||
}
|
||||
}
|
||||
|
||||
/// The fixture board has the four directories the tool shipped with. The first discard
|
||||
/// on a board that predates the status creates the fifth rather than refusing.
|
||||
#[test]
|
||||
fn mv_creates_the_discarded_directory_on_a_board_that_predates_it() {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let worklane = setup_worklane(&temp);
|
||||
let filename = stamped_ticket(&worklane, "backlog");
|
||||
assert!(
|
||||
!worklane.join("discarded").exists(),
|
||||
"the fixture already had the directory"
|
||||
);
|
||||
|
||||
let out = move_ticket(&temp, "cccc3333", "discarded", false);
|
||||
assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr));
|
||||
assert!(worklane.join("discarded").join(&filename).exists());
|
||||
}
|
||||
|
||||
/// Leaving discarded is a backward move, which is the rule that already needs `-f`.
|
||||
/// Un-discarding is a correction rather than a stage, so it is allowed under it.
|
||||
#[test]
|
||||
fn leaving_discarded_needs_force() {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let worklane = setup_worklane(&temp);
|
||||
let filename = stamped_ticket(&worklane, "backlog");
|
||||
assert!(
|
||||
move_ticket(&temp, "cccc3333", "discarded", false)
|
||||
.status
|
||||
.success()
|
||||
);
|
||||
|
||||
let refused = move_ticket(&temp, "cccc3333", "backlog", false);
|
||||
assert!(!refused.status.success());
|
||||
assert!(
|
||||
String::from_utf8_lossy(&refused.stderr).contains("--force"),
|
||||
"{}",
|
||||
String::from_utf8_lossy(&refused.stderr)
|
||||
);
|
||||
assert!(worklane.join("discarded").join(&filename).exists());
|
||||
|
||||
let forced = move_ticket(&temp, "cccc3333", "backlog", true);
|
||||
assert!(forced.status.success(), "{}", String::from_utf8_lossy(&forced.stderr));
|
||||
assert!(worklane.join("backlog").join(&filename).exists());
|
||||
}
|
||||
|
||||
/// The guard looks the other way round from `check_blockers`: a ticket being abandoned
|
||||
/// owes nothing to what it waits on, but the tickets waiting on *it* recorded a
|
||||
/// dependency on work that is about to be declared never-happening.
|
||||
#[test]
|
||||
fn mv_refuses_to_discard_a_ticket_open_tickets_are_blocked_by() {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let worklane = setup_worklane(&temp);
|
||||
create_gated_pair(&worklane, &temp, "backlog");
|
||||
|
||||
let out = move_ticket(&temp, "bbbb2222", "discarded", false);
|
||||
assert!(!out.status.success());
|
||||
|
||||
let stderr = String::from_utf8_lossy(&out.stderr);
|
||||
assert!(stderr.contains("Gated Task"), "the dependent is not named: {stderr}");
|
||||
assert!(stderr.contains("--force"), "{stderr}");
|
||||
assert!(
|
||||
!worklane.join("discarded").exists(),
|
||||
"a refused discard made the directory"
|
||||
);
|
||||
}
|
||||
|
||||
/// `-f` is the caller saying they looked at the dependents.
|
||||
#[test]
|
||||
fn mv_discards_a_blocked_from_ticket_with_force() {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let worklane = setup_worklane(&temp);
|
||||
create_gated_pair(&worklane, &temp, "backlog");
|
||||
|
||||
let out = move_ticket(&temp, "bbbb2222", "discarded", true);
|
||||
assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr));
|
||||
}
|
||||
|
||||
/// A dependent that is itself finished or abandoned is nobody's plan, so it does not
|
||||
/// hold up the discard.
|
||||
#[test]
|
||||
fn a_done_or_discarded_dependent_does_not_hold_up_a_discard() {
|
||||
for status in ["done", "discarded"] {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let worklane = setup_worklane(&temp);
|
||||
create_gated_pair(&worklane, &temp, "backlog");
|
||||
|
||||
assert!(
|
||||
move_ticket(&temp, "aaaa1111", status, true).status.success(),
|
||||
"the dependent could not be moved to {status}"
|
||||
);
|
||||
|
||||
let out = move_ticket(&temp, "bbbb2222", "discarded", false);
|
||||
assert!(
|
||||
out.status.success(),
|
||||
"a {status} dependent held up the discard: {}",
|
||||
String::from_utf8_lossy(&out.stderr)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A discarded blocker satisfies the block the way a done one does: there is nothing
|
||||
/// left to wait for. Whether the dependent still makes sense was asked when the blocker
|
||||
/// was discarded, which is the refusal above.
|
||||
#[test]
|
||||
fn a_discarded_blocker_does_not_block() {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let worklane = setup_worklane(&temp);
|
||||
let filename = create_gated_pair(&worklane, &temp, "backlog");
|
||||
|
||||
assert!(
|
||||
move_ticket(&temp, "bbbb2222", "discarded", true)
|
||||
.status
|
||||
.success()
|
||||
);
|
||||
|
||||
let out = move_ticket(&temp, "aaaa1111", "committed", false);
|
||||
assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr));
|
||||
assert!(worklane.join("committed").join(&filename).exists());
|
||||
}
|
||||
|
||||
/// Entering discarded clears no stamp, which is what discarded being last in
|
||||
/// `Status::ALL` buys: a ticket abandoned from reviewing keeps the journey it made, so
|
||||
/// the log still says how far it got before it was dropped.
|
||||
#[test]
|
||||
fn discarding_keeps_the_stamps_the_ticket_already_had() {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let worklane = setup_worklane(&temp);
|
||||
let filename = stamped_ticket(&worklane, "backlog");
|
||||
|
||||
assert!(
|
||||
move_ticket(&temp, "cccc3333", "committed", false)
|
||||
.status
|
||||
.success()
|
||||
);
|
||||
assert!(
|
||||
move_ticket(&temp, "cccc3333", "reviewing", false)
|
||||
.status
|
||||
.success()
|
||||
);
|
||||
let before = ticket_at(&worklane, "reviewing", &filename);
|
||||
let committed_on = field(&before, "Committed On").expect(&before);
|
||||
let submitted_on = field(&before, "Submitted On").expect(&before);
|
||||
|
||||
assert!(
|
||||
move_ticket(&temp, "cccc3333", "discarded", false)
|
||||
.status
|
||||
.success()
|
||||
);
|
||||
|
||||
let after = ticket_at(&worklane, "discarded", &filename);
|
||||
assert_eq!(
|
||||
field(&after, "Committed On").as_deref(),
|
||||
Some(committed_on.as_str()),
|
||||
"{after}"
|
||||
);
|
||||
assert_eq!(
|
||||
field(&after, "Submitted On").as_deref(),
|
||||
Some(submitted_on.as_str()),
|
||||
"{after}"
|
||||
);
|
||||
assert!(field(&after, "Discarded On").is_some(), "no discard stamp: {after}");
|
||||
assert!(
|
||||
field(&after, "Completed On").is_none(),
|
||||
"a discard claimed the ticket was done"
|
||||
);
|
||||
}
|
||||
|
||||
/// The other end of the same rule: a forced move back out of discarded truncates the
|
||||
/// journey at the target the way every backward move does.
|
||||
#[test]
|
||||
fn un_discarding_drops_the_discard_stamp() {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let worklane = setup_worklane(&temp);
|
||||
let filename = stamped_ticket(&worklane, "backlog");
|
||||
|
||||
assert!(
|
||||
move_ticket(&temp, "cccc3333", "discarded", false)
|
||||
.status
|
||||
.success()
|
||||
);
|
||||
assert!(
|
||||
move_ticket(&temp, "cccc3333", "committed", true)
|
||||
.status
|
||||
.success()
|
||||
);
|
||||
|
||||
let content = ticket_at(&worklane, "committed", &filename);
|
||||
assert!(field(&content, "Discarded On").is_none(), "{content}");
|
||||
assert!(field(&content, "Committed On").is_some(), "{content}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user