Skip to content

BUG-47: file:line citations in docs/14, docs/15 and docs/16 go stale when the code moves, and no check finds it #178

Closed
0 of 1 issue completed

Description

@ephico2real2

Part of #14

What is wrong: docs/14-authorization.md, docs/15-keycloak-integration.md and docs/16-data-model.md cite code as file:line. A change to a cited file moves its lines, and the citation then points at other code. No test finds this. Four citations are wrong on main at b83391c, after PR #177 changed main.py, core/docs.py and routers/admin.py.

Where: on b83391c:

  • docs/14-authorization.md:81 cites cmapi/src/cmapi/core/docs.py:135-138 for the "Requires" line. Those lines hold codes = list(problems). The "Requires" line is at :143-144.
  • docs/14-authorization.md:128 cites cmapi/src/cmapi/main.py:87 for the token dependency. That line is a return JSONResponse(...) of an exception handler. The dependency is at :98.
  • docs/14-authorization.md:178 cites cmapi/src/cmapi/routers/admin.py:78 for the environment check of a prune. That line is a field of KpiDatabase. The check is at :112.
  • docs/15-keycloak-integration.md:103 cites cmapi/src/cmapi/main.py:62-63 for the Swagger UI PKCE settings. They are at :63-64.

The three documents hold 79 such citations (47, 12 and 20). The other 75 are not checked yet.

How to prove it: git show b83391c:cmapi/src/cmapi/core/docs.py | sed -n 135,138p prints no "Requires" text. After the fix, a check in the service suite fails when the text of a cited line range is not the text that was recorded for it, and a change that moves a cited line fails that check until the citation is updated.

Measured or inferred: Measured on 2026-11-13 on macOS, by reading each of the four cited ranges with git show b83391c:<file> | sed -n.

Severity: Low. The documents send a reader to the wrong code. No behaviour of the service is wrong.

What must hold after the fix: Each file:line citation of the three documents points at the code that the sentence names. A check in CI fails when a cited range changes or moves. The check can move a citation by itself when the cited text is at one other place in the file, so the cost of a refactor stays small.

Research: The handover records the cause as a lesson after PR #152 ("Check them after each change to a cited file"), and a rule that a person must remember did not hold for PR #177. Options: (1) cite a symbol and not a line; (2) record a hash of each cited range in a lock file and check it in CI; (3) GitHub permalinks to a commit, which never go stale and never show the current code. Research the options and choose in the pull request.

Solution (inline, not applied): Not written here.

Class: TDT. The documents drifted from the code, and the fix adds the check that stops the drift.

Sub-issues

Sub-issues

0 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    bug
    class:TDT
    status:open
    sev:low
    Backlog
    on Nov 13, 2026
  2. added
    In-QA
    and removed
    Backlog
    on Nov 13, 2026
  3. ephico2real2 commented on Nov 13, 2026

    @ephico2real2
    OwnerAuthor

    In-QA: pull request for branch doc-citations. Measured on main at 8afac6d: 28 of the 89 citations were at other lines than their text, more than the four that this issue named. Each is corrected from history, and scripts/doc-citations.py --check now runs in the service suite.

  4. added
    Done
    and removed
    In-QA
    on Nov 13, 2026
  5. ephico2real2 commented on Nov 13, 2026

    @ephico2real2
    OwnerAuthor

    Done: pull request #192 merged to main as ea955c0. GitHub Actions run 43511953308 was green on the exact head 547ea72 (six jobs). 28 of 89 citations were at other lines on 8afac6d; each is corrected, and scripts/doc-citations.py --check runs in the service suite (9 cases prove the script).

  6. added a commit that references this issue on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Donebugclass:TDTsev:lowstatus:open

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions