The other side reviews a draft (phase 13, step 1)
CI / secret scan (push) Successful in 5s
CI / fmt, clippy, tests (push) Successful in 49s
CI / release (push) Skipped

A lawyer sends a contract version to one of its parties with a link. On
it the other side marks the text up in an editor that keeps every change
visible, as tracked changes do: deleting our text crosses it out in red,
typing is marked as added in green, and the highlighter marks a passage
in yellow with a comment. Restore and Undo take marks back. They send it
back once a round; each later version comes on the same link.

- Migration 0014: review_links (token kept as a SHA-256, one open link a
  party) and review_rounds (the reply written once: their pieces, text,
  SHA-256, name, message; a trigger refuses any other change and every
  delete). Journal entries "sent for review", "review returned" (with the
  fingerprint of their text) and "review link closed"; audit entity
  "review".
- The reply is a list of pieces (same, ins, del, mark). The server checks
  that the pieces without the added ones are exactly the version sent, so
  nothing changes unseen (reviews::check).
- Our review page: their message, the changes numbered with the words
  around them and a box each, the highlights with comments, a git-style
  diff (line numbers, - and + lines, the changed words marked, three lines
  of context per hunk) and their markup. "Take the ticked changes" opens
  the contract page with the version form filled with our text plus those
  changes.
- static/review-editor.js: edits work on the pieces and redraw, so our
  text cannot vanish; keyboard compositions and edits the browser will not
  cancel are compared with the text and taken as edits.
- Property tests (any markup is accepted and taken back exactly; markup
  that changes our text unseen is refused), the fuzz text target runs
  reviews::check, integration tests, and the demo has the label's review
  of the recording agreement.
- PLAN: phase 13.
This commit is contained in:
grabowski committed 2026-11-23 15:31:43 +07:00
1 parent ff716eb9d3
commit a4155548b8
24 files changed
+3004 -6

No files matched your search

+32
View File
@@ -74,6 +74,38 @@
</details>
<datalist id="roles">{% for r in roles %}<option value="{{ r }}"></option>{% endfor %}</datalist>
</section>
<section class="card" id="reviews">
<header><h2>Review by the other side</h2><span class="muted small">a link where a party marks up a version and sends it back</span></header>
{% for l in reviews %}
<div class="item{% if not l.open %} old{% endif %}" id="review-link-{{ l.id }}">
<div class="row"><b>{{ l.party }}</b><span class="muted small">{{ l.state }}</span>
{% if l.open %}<form method="post" action="/contracts/{{ id }}/review-links/{{ l.id }}/close" class="inline-form" data-confirm="Close {{ l.party }}'s review link? It stops working; sending again makes a new one."><input type="hidden" name="csrf" value="{{ csrf }}"><button type="submit" class="btn sm ghost">Close the link</button></form>{% endif %}
</div>
<ul class="rvrounds">
{% for r in l.rounds %}
<li id="round-{{ r.id }}">Version {{ r.version }} sent {{ r.sent }} by {{ r.by }}:
{% if r.replied %}<a href="/contracts/{{ id }}/reviews/{{ r.id }}">sent back {{ r.replied }}</a>, <span class="chip {% if r.changes %}warn{% else %}ok{% endif %}">{{ r.changes }} {% if r.changes == 1 %}change{% else %}changes{% endif %}</span>{% if r.highlights %} <span class="chip plain">{{ r.highlights }} {% if r.highlights == 1 %}highlight{% else %}highlights{% endif %}</span>{% endif %}
{% elif loop.first %}<span class="muted">waiting for them</span>{% else %}<span class="muted">not sent back; a newer version followed</span>{% endif %}</li>
{% endfor %}
</ul>
</div>
{% endfor %}
{% if live_parties and text_versions %}
<details class="addparty"{% if not reviews %} open{% endif %}>
<summary class="btn sm" id="send-review-open">Send a version for review</summary>
<form method="post" action="/contracts/{{ id }}/reviews" class="form" id="send-form">
<input type="hidden" name="csrf" value="{{ csrf }}">
<div class="grid">
{{ fm.select("review_party", "To", "", review_parties, req=true, blank="Choose the party") }}
{{ fm.select("review_version", "Version", text_versions[0][0], text_versions, req=true, blank="Choose") }}
{{ fm.area("review_message", "Message to them", "", rows=3, fcls="wide", hint="Optional: what to look at, by when.") }}
</div>
<div class="formactions"><button type="submit" class="btn pri" id="send-review">Send</button></div>
</form>
</details>
{% elif not live_parties %}<p class="empty-inline">Add the other party above to send them a version to review.</p>
{% else %}<p class="empty-inline">Add a version with a text to send it for review: the editor works on the text.</p>{% endif %}
</section>
{% if reading %}
<section class="card" id="reading">
<header><h2>{% if compare %}Version {{ reading }} against version {{ before }}{% else %}Version {{ reading }}{% endif %}{% if reading_note %}: {{ reading_note }}{% endif %}</h2>