Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ the documentation says what holds; how it came about is in git.
the cards of `work start` per account and the heartbeat over all of them —
before any work on sign-in, `profiles`, the configuration file or the store.
- [Rich text in both directions](stable/rich-text.md): Markdown to HTML and
back, the allowlist of the server, the shapes of a document, sources, files,
mentions and references to other records — before any
back, the allowlist of the server, the shapes of a document, decisions
blocks and their rows, sources, files, mentions and references to other
records — before any
work on descriptions, comments, messages or documents.
- [First steps](stable/first-steps.md): What `setup` asks and in which order,
why it needs a terminal, what `doctor` checks and why it always exits 0 —
Expand Down
64 changes: 64 additions & 0 deletions docs/decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2954,3 +2954,67 @@ account with a list of its session, each with its own token. **Why:** no
account may report another's cards, and the mod knows nothing of profiles.
**Implemented as:** `work.File.Accounts`, `cli.beatEveryAccount`, see
[Profiles](stable/profiles.md#state-per-account).

<a id="c-197"></a>
## C-197 — A decisions block is a marker line, its attributes in one order

*Applies to: every text sent as Markdown, every text shown as Markdown*

`<!-- minka:decisions tool="…" label="…" status="…" decided-in="…" applies-to="…" -->`
on a line of its own becomes `<minka-decisions>`; read back, the element is
that marker with its attributes in this order, so a block read, edited and
sent back stays the same element. **Why:** an HTML comment is hidden by every
Markdown tool, as the markers of tiles and variables are.
**Implemented as:** `markdown.DecisionsElementOf`, `richtext.DecisionsMarker`,
see [Rich text](stable/rich-text.md#decisions-blocks).

<a id="c-198"></a>
## C-198 — A malformed decisions marker is refused before anything is sent

*Applies to: every text sent as Markdown*

A marker with an unknown or doubled attribute, no tool, a value not in double
quotes or not an identifier is exit 1 (`usage`) with the form and where the
IDs come from; an identifier in capitals is lowercased and an empty filter
left out. Whether the IDs name what the project has is Minka's
(`decisionBlockInvalid`, exit 9). **Why:** sent on, the marker would stand in
the text as visible source, where a misplaced tiles marker only loses a shape.
**Implemented as:** `markdown.Result.Refusal`, `cli.markdownToHTML`.

<a id="c-199"></a>
## C-199 — The rows of a block stand apart from the body and are never sent

*Applies to: `docs show`, `posts show`, the document a 409 prints, every text sent as Markdown*

The body of a view holds a block's marker alone; its rows follow after the
body under `## Decisions blocks`, one entry per block named by its position
and attributes, as a quote that opens with "Read out, not part of the text:".
A text sent as Markdown that holds such a quote is refused, exit 1, before
anything is sent. **Why:** an agent sends back what it read, and dropping rows
on the way back fails silently both ways, by lazy continuation and by a moved
or deleted marker. **Implemented as:** `cli.renderDecisionBlocks`,
`markdown.RefusalReadOutRows`.

<a id="c-200"></a>
## C-200 — An exported page carries the marker and the rows, read anew

*Applies to: `docs export`*

A page's file holds each block's marker and its rows as the reading view
prints them, in HTML a comment and a quote; a page with a block is never taken
from the cache. **Why:** an export is read as files, where a hidden marker
alone would show nothing, and the rows change without the page.
**Implemented as:** `export.readOutDecisions`, `export.holdsDecisionBlocks`.

<a id="c-201"></a>
## C-201 — `docs show --body` and `posts show --body` print the body alone

*Applies to: `docs show`, `posts show`*

`--body` prints only the body as Markdown on standard output, also where
standard output is no terminal, and the `--expect` of a document on standard
error; beside
`--json` or `--quiet` it is exit 1. **Why:** no other output yields exactly
the editable body, and cutting the text view at the next heading cuts a body
with headings of its own. **Implemented as:** `cli.bodyAlone`,
`cli.writeBodyAlone`.
24 changes: 23 additions & 1 deletion docs/stable/docs-and-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ callouts, Mermaid diagrams, link tiles, blocks of variables and their
placeholders. How each is written and shown in Markdown is in
[The shapes of a document](rich-text.md#the-shapes-of-a-document).

A body also holds decisions blocks, a stored query on the decisions of a
Decisions tool (E-422, E-473). `docs show` prints each as its marker in the
body and its rows in a section after it, read out and never sent back;
`docs show --body` prints the body alone, as `docs edit --body` takes it;
`--json` carries the rows in `decisionBlocks`; `docs edit` and `docs create`
write the marker. How, and
which views print rows, is in [Decisions blocks](rich-text.md#decisions-blocks).
A locked document (`locked`, E-413) takes no new title, no new body and no
restored version (`docs versions restore`), and its blocks show the copies of
the lock; `docs show` says `Locked: yes`. The CLI has
no command to lock or unlock: that is done on the document's page in Minka.

## A file goes into a tool in two requests

Minka takes a file into a tool in two steps: `POST projects/{id}/uploads`
Expand Down Expand Up @@ -348,6 +360,8 @@ often they are named.
| 422 `contentTypeMismatch`, 413 `tooLarge` | `docs uploads create <file>`, storing it, as `uploads create` | 9 |
| 422 `documentTitleMissing`, `documentTitleTooLong`, `documentTitleHasControlCharacters` | `docs create`, `docs edit` | 9 |
| 422 `documentBodyTooLong`, `documentBodyNotReadable` | `docs create`, `docs edit` | 9 |
| 422 `decisionBlockInvalid` | `docs create`, `docs edit` with a block naming what the project has not got, or more than 20 blocks; after the length of the body, before everything after it; never on a locked document. Minka's message names the attribute, the hint where the IDs come from | 9 |
| 422 `documentLocked` | `docs edit` writing the title or the body of a locked document, from the edit after the length of the body and the archive (its blocks go unchecked), before `--expect`; `docs versions restore` of a locked document, after the archive; the hint says it is unlocked on the web | 9 |
| 422 `documentAudienceMissing` | unreachable: the audience is held here | — |
| 422 `notifyIdsMissing`, `notifyIdsWithoutChosenAudience` | `docs create --audience` and `--notify` that do not go together | 9 |
| 422 `personNotAProjectMember` | `docs create --notify` naming somebody outside the project | 9 |
Expand Down Expand Up @@ -657,6 +671,12 @@ its file, in lower case.
is the stored HTML in a minimal page: the same fields as `meta` elements and
`link rel="canonical"`, the title as `h1`, no script and no style.

- **Decisions blocks** carry their marker and right below it their rows, the
quote `docs show` prints after the body, in HTML the marker as a comment
and the rows as a quote ([C-200](../decisions.md#c-200)): an export is read
as files, where the marker alone shows nothing. A page with its rows sent
back with `docs edit` is refused; the marker alone goes back.

- **Headings** carry the anchors Minka's page gives them (E-304), counted over
every heading of the body in document order, as `search` names them. In
Markdown the anchor is `<a id="h-…"></a>` on the line above the heading:
Expand Down Expand Up @@ -705,7 +725,9 @@ and the body kept is at least as new as the version named, since the tree is
read before the pages. A reference that leads elsewhere — a card, a post, a
page outside the export — carries the title and address Minka gives it when
the page is read, which change without the page, so such a page is read on
every run, and so is one that refers to a page gone when it was read. Every
every run, and so is one that refers to a page gone when it was read. A page
with a decisions block is read on every run as well: its rows change without
it. Every
page's file is rendered anew from its body, on every run and against this
run's tree: title, address and navigation come from the tree, and a
reference into the export takes the title of its target from the tree too.
Expand Down
14 changes: 12 additions & 2 deletions docs/stable/posts.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,16 @@ body without an element Minka serves is kept as the characters it consists of
([C-068](../decisions.md#c-068)), so Markdown is converted here and
`--body-format html` draws the notice. Unlike a document, **a post says
something**: a body with no word and no file — an empty one, one of blanks —
is `postBodyMissing`. A mention or a file alone is enough.
is `postBodyMissing`. A mention or a file alone is enough; a decisions block
alone is not.

A body holds decisions blocks as a document's does (E-473): `posts show`
prints each as its marker in the body and its rows in a section after it,
read out and never sent back, `posts show --body` prints the body alone,
`--json` carries the rows in `decisionBlocks`, and `posts create` and `edit`
write the marker. A post is never locked, so its rows are always live. How, and
what Minka refuses with `decisionBlockInvalid`, is in
[Decisions blocks](rich-text.md#decisions-blocks).

`categoryId` null or empty files it under no kind. One that is no identifier
is `postCategoryUnknown`, which the CLI never sends ([C-013](../decisions.md#c-013)).
Expand Down Expand Up @@ -204,7 +213,7 @@ passed. A body that is no JSON object (400) comes first wherever one is read,
and is unreachable from here.

- **A new post:** the tool (404), the title, the body (`postBodyTooLong`,
`postBodyNotReadable`, `postBodyMissing`), a `categoryId` that is no
`postBodyNotReadable`, `decisionBlockInvalid`, `postBodyMissing`), a `categoryId` that is no
identifier, the audience (`postAudienceMissing`, unreachable), a `notifyIds`
entry that is no identifier (`personNotAProjectMember`, unreachable), then
`notifyIdsMissing` / `notifyIdsWithoutChosenAudience`, then
Expand Down Expand Up @@ -242,6 +251,7 @@ edit, and before the text of a comment; it never comes before
| 404 | every command, for a tool or post that is unknown, foreign, a draft, in the trash or hidden from a client; a comment that is not one's own | 2 |
| 422 `postTitleMissing`, `postTitleTooLong`, `postTitleHasControlCharacters` | `posts create`, `posts edit` | 9 |
| 422 `postBodyMissing`, `postBodyTooLong`, `postBodyNotReadable` | `posts create`, `posts edit` | 9 |
| 422 `decisionBlockInvalid` | `posts create`, `posts edit` with a block naming what the project has not got, or more than 20 blocks; the hint says where the IDs come from | 9 |
| 422 `postCategoryUnknown` | `--category` naming a kind the project does not offer | 9 |
| 422 `notifyIdsMissing`, `notifyIdsWithoutChosenAudience` | `posts create --audience` and `--notify` that do not go together | 9 |
| 422 `personNotAProjectMember` | `posts create --notify` naming somebody outside the project | 9 |
Expand Down
74 changes: 73 additions & 1 deletion docs/stable/rich-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ server: markup is only a tag of a served element that is written out up to its
closing angle bracket. `a<i und b<s` stays plain text. The elements are those
of the allowlist in `internal/markdown`, the shapes' `aside`, `header`, `dl`,
`dt` and `dd` among them, and beside them the three that a text carries rather
than writes: `action-text-attachment`, `minka-embed` and `minka-ref`.
than writes: `action-text-attachment`, `minka-embed` and `minka-ref`, and
the decisions block's `minka-decisions`.

## The shapes of a document

Expand Down Expand Up @@ -140,6 +141,77 @@ the view stays the editable text of C-008 ([C-134](../decisions.md#c-134)):
document's title and counts as a backlink. The conversion has nothing to do
for it, see below. A link with words of its own stays a mere link.

## Decisions blocks

A decisions block is a stored query on the decisions of one Decisions tool
(Minka's E-422, E-473): `<minka-decisions tool label status decided-in
applies-to>`, identifiers only, the tool required and every filter optional.
Minka lists the rows afresh on every reading and never stores them.

**The marker** ([C-197](../decisions.md#c-197)). In Markdown a block is an HTML
comment on a line of its own:

```
<!-- minka:decisions tool="<id>" label="<id>" status="<id>" decided-in="<id>" applies-to="<id>" -->
```

It becomes the element with the same attributes, in this order; read back, the
element is the marker in this order again, so a block read, edited and sent
back is the same element. Only the form is checked here: an identifier in
capitals is lowercased, an empty filter is left out, and a marker with an
unknown or doubled attribute, no tool, a value not in double quotes or no
identifier is refused before anything is sent, exit 1 with the form and where
the IDs come from ([C-198](../decisions.md#c-198)). A marker inside a paragraph
is no block and stays visible text, as any other HTML there. Whether the IDs
name a tool, label, status, event or card of the project is Minka's to say:
`decisionBlockInvalid`, exit 9, its message naming the attribute.

**What Minka checks** (E-473). In a document and a post only: at most 20
blocks; no tool, a value that is no identifier, a tool that is no Decisions
tool of the project, a label of neither the project nor that tool, a status not
of that tool, a `decided-in` that is no event of the project, an `applies-to`
that is neither an event nor a card of it. A block the stored text holds
already, with the same five values, passes unchecked, so editing around a
block whose label is gone still works. The check comes after the length of the
text; a locked document answers `documentLocked` before it. Anything inside
the element and any other attribute is dropped. A post whose body is a block
alone says nothing (`postBodyMissing`). Every other rich text stores the
element unchecked and has no rows over the API.

**The rows** ([C-199](../decisions.md#c-199)). A document and a post carry
`decisionBlocks`, one per element in the order of the body, `position`
counting the elements from 0: the query, the `tool` the reader sees (`null`
otherwise), an English `summary`, `frozen` in a locked document, the
`decisions` with `shortId`, `title`, `status`, the votes, `today` in a frozen
block, and Minka's own `markdown`. `--json` passes them through.

Rows are read out, never written. In `docs show`, `posts show` and the
document a 409 prints, the body holds each block as its marker alone, so it is
the text an edit takes back. The rows follow in a section of their own after
the body, `## Decisions blocks (N)`, one entry per block in the order of the
body, headed by its position and its marker's attributes so a reader finds the
marker it belongs to, the rows from the structured fields as a quote:

```
### Position 0: tool="…" status="…"

> Read out, not part of the text: Decisions · status In force
> - DEC-2 We meet on Mondays — In force · 5 for, 0 against, 0 abstaining · unanimous
> - DEC-7 The tent stands by the pond — In force · today: superseded by DEC-9
```

`(as locked)` follows the summary of a frozen block; a block without decisions
lists `(no decisions)`, one of a tool the reader cannot see reads `(a
Decisions tool you cannot see)`. `docs show --body` and `posts show --body`
print the body alone as Markdown, the one output that is exactly what `--body`
of an edit takes back ([C-201](../decisions.md#c-201)). An exported page,
which is read and not sent back, carries the same quote right below each
marker; its rows go there only while position and tool agree. A text sent as
Markdown that holds a quote opening with `Read out, not part of the text:` is
refused before anything is sent, exit 1, wherever the quote stands: it can
only have been copied in. Every other view of a text prints the marker alone:
the versions of a document, descriptions, comments and the rest carry no rows.

## References to another record

Minka turns `#MNK-1`, `/go/card/MNK-1`, `/go/item/<id>`, `/go/line/<id>` and
Expand Down
13 changes: 13 additions & 0 deletions docs/work-in-progress/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,19 @@ Dogfooding waits for the internal alpha. The smoke token `minka-cli-smoke`

## Checked against the fake only

- Decisions blocks in documents and posts (MNK-VX): the marker and its round
trip, the rows read out apart from the body in `docs show` and `posts show`
and below the marker in `docs export`, `--body` of both, the
refusals `decisionBlockInvalid` and `documentLocked` with their hints, and a
page with a block read on every export. Built against Minka's code at the
merge of its #1014 and the fake, not live-checked. **The fake does not
mirror**: the order of the rows of a block of one meeting (Minka orders them
by its agenda), the visibility of a decision beyond trash, clients and
drafts, a status from before the tool had any in the summary, and locking
and unlocking over the API, which the CLI has no command for; a test locks
a document with `Server.LockDocument`. `bodySource` is taken to hold the
element as `body` does.

- Profiles (MNK-TP): `--profile`, `$MINKA_PROFILE`, `profiles list|rename|
remove|default`, the file written with the hosts for older versions beside
the profiles, the store per account and the heartbeat over every account.
Expand Down
54 changes: 54 additions & 0 deletions internal/api/decisionblocks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package api

// DecisionBlock is one decisions block of a document's or a post's body as
// its reader may see it: the query the body stores and the decisions it
// lists now. Position counts the minka-decisions elements of the body from 0,
// so each block's rows belong where its element stands.
type DecisionBlock struct {
Position int `json:"position"`
ToolID string `json:"toolId"`
LabelID *string `json:"labelId"`
StatusID *string `json:"statusId"`
DecidedInID *string `json:"decidedInId"` // the event the decisions were taken in
AppliesToID *string `json:"appliesToId"` // the event or card they apply to
Tool *DecisionsToolReference `json:"tool"` // nil where the reader sees no such tool in the project
Summary string `json:"summary"` // the tool and every filter by name, in English
// Frozen says the rows are the copies made when the document was
// locked; each may then say what changed since in Today.
Frozen bool `json:"frozen"`
Decisions []DecisionBlockEntry `json:"decisions"`
// Markdown is the same as a list whose words are escaped, so that none
// becomes markup.
Markdown string `json:"markdown"`
}

// DecisionBlockEntry is a decision as a decisions block lists it.
type DecisionBlockEntry struct {
ID string `json:"id"`
ShortID *string `json:"shortId"` // nil for a decision its tool has not numbered
Title string `json:"title"`
Status DecisionStatus `json:"status"` // in a frozen block the status at the lock
VotesFor *int `json:"votesFor"`
VotesAgainst *int `json:"votesAgainst"`
Abstentions *int `json:"abstentions"`
VotesNote *string `json:"votesNote"`
Today *DecisionBlockToday `json:"today"` // only in a frozen block
AppURL string `json:"appUrl"`
}

// DecisionBlockToday is what changed in a decision since a locked document
// copied it.
type DecisionBlockToday struct {
Status *DecisionStatus `json:"status"` // nil while the status is the one copied
SupersededBy *DecisionBlockLater `json:"supersededBy"` // the newest visible decision superseding it
Reworded bool `json:"reworded"`
}

// DecisionBlockLater is the decision that superseded one a frozen block
// copied.
type DecisionBlockLater struct {
ID string `json:"id"`
ShortID *string `json:"shortId"`
Title string `json:"title"`
AppURL string `json:"appUrl"`
}
Loading