fix(observe): an observer edit must not delete evidence they never saw (bd-2218) - #44
Open
hyasin270 wants to merge 1 commit into
Open
fix(observe): an observer edit must not delete evidence they never saw (bd-2218)#44hyasin270 wants to merge 1 commit into
hyasin270 wants to merge 1 commit into
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's wrong
The Flow prefills each Evidence box with the first
PREFILL_TEXT_CAPcharacters of the AI draft. When the leader edits that box,applyObserverEditswrites 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
74abad00raised 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:
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:
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:main, passes hereFull
tests/observesuite run with--runInBand. The only two failures (seed-field-officers,observe-subject-flags) fail identically on unmodifiedmain— 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