You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG-73: doc-citations --relocate crashes when two lines cite the same code line, and --write then records the wrong text #292
BacklogNot started: the work waits in the backlogbugSomething isn't workingsev:mediumIncorrect data, a weak control or a slow service, with no direct lossstatus:openNo fix yet
What is wrong. On PR #288 (after the review fixes), F3 added one line at cmapi/src/cmapi/routers/requests.py:111, so five citations in docs/14-authorization.md moved down by one. docs/14 cites requests.py:128 twice, at lines 177 and 192.
File "scripts/doc-citations.py", line 172, in relocate
lock[f"{c.doc}|{c.path}|{new_start}-{new_end}"] = lock.pop(c.key)
KeyError: 'docs/14-authorization.md|cmapi/src/cmapi/routers/requests.py|128-128'
The lock key has no document line, so two citations of one code line share one key, and the second pop fails.
Worse. The check's message for an ambiguous move says to run --write. Run after the crash, --write re-recorded the five keys with the new text at the old line numbers (row = repo.get(request_id) in place of requests:approve), and --check then reported 0 problems. So the check can be made to pass while every citation points at the wrong line. The coordinator caught it by reading the lock's diff and corrected the citations by hand.
Fix to research. Make the lock key unique per citation (include the document line, or de-duplicate before relocating). Make --write refuse to record a text that differs from the recorded one for a key unless the citation's line number changed, so it cannot hide a move.
How to prove it. A test with one document that cites the same code line twice, then a one-line insertion above it. --relocate moves both citations, and a --write with no citation change leaves the lock's text unchanged. It fails on main.
BacklogNot started: the work waits in the backlogbugSomething isn't workingsev:mediumIncorrect data, a weak control or a slow service, with no direct lossstatus:openNo fix yet
Activity
#286 PR-A: the review's seven findings, each with its test (coordinat…