Skip to content

fix(observe): an observer edit must not delete evidence they never saw (bd-2218) - #44

Open
hyasin270 wants to merge 1 commit into
mainfrom
bd-2218-preserve-unseen-evidence
Open

fix(observe): an observer edit must not delete evidence they never saw (bd-2218)#44
hyasin270 wants to merge 1 commit into
mainfrom
bd-2218-preserve-unseen-evidence

Conversation

@hyasin270

Copy link
Copy Markdown
Contributor

What's wrong

The Flow prefills each Evidence box with the first PREFILL_TEXT_CAP characters of the AI draft. When the leader edits that box, applyObserverEdits writes the returned value straight over the original — deleting everything past the cap.

Nothing in the Flow signals that more text existed, so the one person who could catch it never sees it. The shortened text is what feeds the teacher's report.

Why the 300 → 600 change didn't close it

74abad00 raised the cap. That rescues the large majority of notes, but it moved the threshold, not the mechanism.

Measured against NIETE prod on 2026-07-21:

v1 evidence/improvement fields 338
over the old 300 cap 227 (67%)
already over the new 600 cap 9, across 5 of 13 sessions (longest 681, p99 654)
v2 coach-edited fields at exactly 300 chars 156

Text does not stop at exactly 300 characters 156 times by chance — that is the earlier cap already landing in the copy that feeds the report.

The fix

Compare against the full original, and keep the part the leader never saw:

const full   = String(orig[field] || '');
const shown  = full.slice(0, PREFILL_TEXT_CAP);   // all they ever saw
const unseen = full.slice(PREFILL_TEXT_CAP);      // '' unless the draft ran long
if (val !== shown && val !== full) textChanged += 1;
if (val !== shown) ind[field] = unseen ? `${val}${unseen}` : val;

The edit is honoured in full. An edit may shorten what was reviewed; it must not touch what wasn't.

Testing

Red-first, bot/tests/observe/observe-evidence-unseen-tail.test.js:

  • editing a capped Evidence box keeps the text past the cap — fails on current main, passes here
  • leaving a capped box untouched keeps the full original — guard, passes throughout
  • a field shorter than the cap is replaced exactly, no tail bolted on — guard, passes throughout

Full tests/observe suite run with --runInBand. The only two failures (seed-field-officers, observe-subject-flags) fail identically on unmodified main — pre-existing, unrelated.

Note for the reviewer

Reported by Warda and Mubashar. They have been told on the card that the 600 cap does not cover every case, so this closes a promise already made to them.

Closes: bd-2218

…w (bd-2218)

The Flow prefills each Evidence box with the first PREFILL_TEXT_CAP characters
of the AI draft. When the leader edited that box, applyObserverEdits wrote the
returned value straight over the original — so everything past the cap was
deleted. Nothing in the Flow signals that more text existed, so the one person
who could have caught it never saw it, and the shortened text is what feeds the
teacher's report.

Raising the cap 300 -> 600 (74abad0) moved the threshold, not the mechanism.
Measured on NIETE prod 2026-07-21: 9 evidence notes across 5 of the 13 recorded
observations already exceed 600 (longest 681, p99 654), and 156 coach-edited
fields sit at exactly 300 characters — text does not stop at exactly 300 chars
156 times by chance; that is the earlier cap landing in v2.

The edit is still honoured in full; the unreviewed remainder is preserved
behind it. An edit may shorten what was reviewed, never what wasn't.

Tested red-first: the tail-preservation case fails on current main and passes
here; the untouched-field and short-field guards pass throughout. Full
tests/observe suite run --runInBand — the only two failures
(seed-field-officers, observe-subject-flags) fail identically on unmodified
main.

Closes: bd-2218
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant