Skip to content

docs: the published scoring formula stopped being the one the code uses - #28

Merged
matinsaurralde merged 2 commits into
masterfrom
fix/21-stale-docs
Aug 4, 2026
Merged

matinsaurralde merged 2 commits into
masterfrom
fix/21-stale-docs

Conversation

@matinsaurralde

Copy link
Copy Markdown
Owner

README.md and ARCHITECTURE.md both published

score = (frequency × 0.4) + (recency × 0.4) + (context × 0.2)

which survived two releases past the point of being true — through the fix that normalised frequency (that formula's central defect: frequency was a raw count against terms bounded by 1) and through the feature that added prefix and picks.

Anyone reading it to understand why a result ranked where it did was reading a description of code that no longer exists. That is worse than no documentation.

Also corrected:

  • vars.json was described as the variable store; it now only records which variables exist, with the values in the Keychain.
  • ARCHITECTURE's decision index stopped at ADR-004 while eleven exist.

Making the mechanical parts mechanical

Nothing detects prose going stale. Three checks that can be automated now are:

  1. every ADR is linked from the decision index;
  2. no link to docs/decisions/ is broken;
  3. the published formula names every W_* weight in mem.ranking — derived from the module rather than a hard-coded list, so adding a sixth feature fails this test until someone writes it down.

The check needed a second attempt

Bounding it to a fixed 400-character window reached past the formula into the bullet list beneath it, so deleting a term from the formula still passed — the term was still named in the surrounding prose. A test that cannot fail is worse than no test, and this one was verified the only way that means anything: by deleting a term and watching it go red.

It is now bounded at the first blank line after score =.

1358 passed.

`README.md` and `ARCHITECTURE.md` both showed

    score = (frequency × 0.4) + (recency × 0.4) + (context × 0.2)

which survived two releases past the point of being true: through the fix
that normalised frequency (that formula's central defect) and through the
feature that added prefix and picks. Anyone reading it to understand why a
result ranked where it did was reading a description of code that no longer
exists.

Also corrected: `vars.json` is described as the variable store, when it now
only records which variables exist and the values are in the Keychain; and
ARCHITECTURE's decision index stopped at ADR-004 while eleven exist.

Nothing detects prose going stale, so the parts that can be mechanical now
are:

- every ADR must be linked from the decision index;
- no link to `docs/decisions/` may be broken;
- the published formula must name every `W_*` weight in `mem.ranking`,
  derived from the module rather than a hard-coded list, so a sixth feature
  fails this test until it is written down.

The last one needed a second attempt. Bounding the check to a fixed
400-character window reached past the formula into the bullet list beneath
it, so deleting a term from the formula still passed — the term was named in
the surrounding prose. It is now bounded at the first blank line, and
verified by deleting a term and watching it fail.
The privacy list promises plain-text storage; variable values are now
deliberately not plain text. Both are true and the exception is the point —
"readable with cat" is the wrong property for a password — but a reader
hitting the two claims in sequence has no way to know that without being
told.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6e5fa7176

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/test_e2e.py
Comment on lines +657 to +658
formula = self._formula_in(REPO_ROOT / name)
unmentioned = [f for f in features if f not in formula]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Verify formula coefficients, not only feature names

When a later ranking change alters a weight without renaming its W_* constant, this check still passes as long as the feature name remains in the formula; for example, changing W_PICKS from 0.40 to 0.30 would leave both documents publishing the obsolete coefficient. Since this test is intended to prevent the published formula from diverging from the code, it also needs to compare the documented numeric weights with the constants.

Useful? React with 👍 / 👎.

Comment thread tests/test_e2e.py
Comment on lines +621 to +623
path.name
for path in sorted((REPO_ROOT / "docs" / "decisions").glob("*.md"))
if path.name not in index

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict the ADR check to decision-index links

Checking whether the filename occurs anywhere in ARCHITECTURE.md does not prove that it is linked from the decision index. This already produces a false negative for ADR-010: its filename also appears in the variable-store section, so removing its new index entry would still leave this test green. Parse the decision-index links, or at least require the filename in that section's Markdown link targets.

Useful? React with 👍 / 👎.

@matinsaurralde
matinsaurralde merged commit 413dbf6 into master Aug 4, 2026
5 checks passed
@matinsaurralde
matinsaurralde deleted the fix/21-stale-docs branch August 4, 2026 05:39
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