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

+53
View File
@@ -0,0 +1,53 @@
{% extends "base.html" %}
{% import "_review_marks.html" as rm %}
{% block main %}
<div class="phead">
<div class="crumbs"><a href="/contracts">Contracts</a> <span class="sep">/</span> <a href="/contracts/{{ id }}#reviews">{{ head.code }}</a></div>
<div class="pagehead"><h1>{{ party }}'s review of version {{ review_version }}</h1></div>
<p class="meta">Sent {{ round.sent }} by {{ round.by }}.{% if replied %} Sent back {{ round.replied }} by {{ round.reply_name }}: {{ round.changes }} {% if round.changes == 1 %}change{% else %}changes{% endif %}, {{ round.highlights }} {% if round.highlights == 1 %}highlight{% else %}highlights{% endif %}.{% endif %}</p>
</div>
{% if not replied %}
<section class="card"><h2>Nothing back yet</h2><p>{{ party }} has not sent this version back yet.</p></section>
{% else %}
{% if reply_message %}
<section class="card" id="reply-message">
<header><h2>Their message</h2></header>
<p class="pre">{{ reply_message }}</p>
</section>
{% endif %}
<section class="card" id="take">
<header><h2>The changes</h2></header>
{% if changes %}
<form method="post" action="/contracts/{{ id }}/reviews/{{ round.id }}/take" id="take-form">
<input type="hidden" name="csrf" value="{{ csrf }}">
<p class="hint">Tick the changes to take. The contract page then opens with the version form filled with version {{ review_version }} and those changes, to finish and add as the next version.</p>
<ol class="rvchanges">
{% for c in changes %}
<li id="change-{{ c.n }}"><label class="check"><input type="checkbox" name="take" value="{{ c.n }}" checked><span class="rvn">{{ c.n }}</span><span class="rvchange"><span class="muted">{{ c.before }}</span>{% if c.removed %}<del>{{ c.removed }}</del>{% endif %}{% if c.added %}<ins>{{ c.added }}</ins>{% endif %}<span class="muted">{{ c.after }}</span></span></label></li>
{% endfor %}
</ol>
<div class="formactions"><button type="submit" class="btn pri" id="take-changes">Take the ticked changes</button></div>
</form>
{% else %}
<p class="empty-inline">They changed nothing{% if highlights %}; they highlighted what is listed below{% endif %}.</p>
{% endif %}
</section>
{% if highlights %}
<section class="card" id="highlights">
<header><h2>Highlighted</h2></header>
<ul class="rvhl">{% for h in highlights %}<li><mark>{{ h.text }}</mark>{% if h.comment %}<div class="sub">{{ h.comment }}</div>{% endif %}</li>{% endfor %}</ul>
</section>
{% endif %}
<section class="card" id="diff">
<header><h2>As a diff</h2><span class="muted small">our version {{ review_version }} against their text</span></header>
{% if git %}
<div class="gitdiff">{% for l in git %}{% if l.op == "hunk" %}<div class="gl hunk"><span class="gn"></span><span class="gn"></span><span class="gt">@@ line {{ l.old or l.new }} @@</span></div>{% else %}<div class="gl {{ l.op }}"><span class="gn">{{ l.old or "" }}</span><span class="gn">{{ l.new or "" }}</span><span class="gt"><span class="gs" aria-hidden="true">{% if l.op == "removed" %}-{% elif l.op == "added" %}+{% else %} {% endif %}</span>{% for s in l.segs %}{% if s.hl %}<b>{{ s.text }}</b>{% else %}{{ s.text }}{% endif %}{% endfor %}</span></div>{% endif %}{% else %}<p class="empty-inline">No line changed.</p>{% endfor %}</div>
{% else %}<p class="empty-inline">The texts are too long to compare here.</p>{% endif %}
</section>
<section class="card" id="markup">
<header><h2>As they marked it</h2></header>
{{ rm.marked(shown) }}
<p class="muted small mono hashline">Their text, SHA-256 {{ reply_sha }}</p>
</section>
{% endif %}
{% endblock %}