Skip to content

fix(bug-lookup): also search the project's own bug-logs drafts - #531

Closed
saingge wants to merge 1 commit into
MendixMau:masterfrom
saingge:fix/bug-lookup-project-drafts
Closed

saingge wants to merge 1 commit into
MendixMau:masterfrom
saingge:fix/bug-lookup-project-drafts

Conversation

@saingge

@saingge saingge commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Branch fix/bug-lookup-project-drafts, one commit on origin/master 393d253. Lane 3 (direct).

What changed and why

bin/bug-lookup.sh read only the toolkit ledger (bug-logs/mxcli-bugs.md). The drafts a session writes
for a bug it hit go to the project's own bug-logs/ (the convention bin/harvest-learnings.sh reads),
so the lookup that runs before experimenting on an error could not see them. Field case: a refusal was
logged, then hit again days later, because the lookup found nothing.

Run from inside a wired project, it now also searches that project's bug-logs/**.md after the
ledger and marks each hit (project draft: <file>:<line>).

  • The ledger's output and ranking are unchanged: drafts are ranked in a separate pass, so they never
    move the ledger's IDF. The ledger's own awk is the same program, now held in a variable and run twice.
  • --full N and --index stay ledger-only.
  • A ranked draft is shown only at the same 40% coverage floor as the best ledger hit.
  • The project is found with project-bin/_common.sh (mxtk_walk_root from $PWD), as
    bin/check-requirements.sh does. MXTK_PROJECT_DIR=<dir> names it; MXTK_PROJECT_DIR= (empty)
    turns drafts off. Outside any project nothing changes.
  • The skill-routing row for bin/bug-lookup.sh is untouched.

Impact

Row Answer
Process none. No step or gate added or removed; the lookup shows more.
Dependencies bin/bug-lookup.sh now sources project-bin/_common.sh in a subshell to find the project (the same file bin/check-requirements.sh and bin/status.sh use). Its own fixture and a new synthetic fixture folder. No new tool.
Context cost none: no routed or always-loaded file, and no routing-row text, touched. A lookup in a project with drafts prints up to 3 more ranked lines, or up to 6 more entries for a one-word query (headers only above 6).
Behaviour NOT RUN: a script change, no baseline-routed text.
Runtime One extra find and one extra awk pass over the project's bug-logs/ per lookup. Measured on 43 files: not timed separately.

Field evidence

A Mendix 10.24 app, mxcli v0.27.0, 43 files in bug-logs/, run from the project root (read-only; the
project tree was unchanged afterwards):

  • bug-lookup.sh "cannot be spliced" at 393d253: no project drafts, 5 lines of ledger output.
  • The same query with this change: the same ledger lines, then a "Project drafts" section with 3 hits
    from 3 different files. Each <file>:<line> points at a ## heading, and each entry mentions "splice"
    (2, 3 and 5 times).

Checklist

  • No client data anywhere in the diff (guard plain and with LEAKGUARD_BASE=origin/master, then a read of the diff). The fixture is invented text with Shop.* names, labelled synthetic in its first line.
  • Size: 5 files, +133/-15; the counted part (script plus test) is 111 lines of change; the rest is two fixture files and CHANGELOG.
  • Test tier: T1 (group P in test-bug-lookup.sh, which targets the changed script) + T2 (the field run above).
  • Golden input: the draft fixture follows the layout of real drafts (a ## BUG-DRAFT-<slug>: title (date) heading, version line, expected/actual/workaround bullets, a ## Provenance section); only the text is invented.
  • Both layouts: n/a. The script takes the project from the working directory; mxtk_walk_root handles the layouts.
  • Both platforms: ran on macOS only, under bash and /bin/bash 3.2.57, with one awk (20200816) on PATH. Not run under mawk, gawk or Git Bash. The new awk uses only POSIX features the file's other awk blocks already use (ENVIRON, -v, index, tolower).
  • CHANGELOG line under ## Unreleased, credited.
  • [n/a] New skill; new bug entries; new project-bin file.

Verification

bash tests/wave2/test-bug-lookup.sh
  == P: project drafts
  ok   one word: ledger says nothing, the draft entry follows in full, marked, exit 0
  ok   drafts off (MXTK_PROJECT_DIR empty): the same word exits 1
  ok   ranked: the best draft is listed first, marked, exit 0 although the ledger has no match
  ok   ranked: a draft below the 40% coverage floor is not listed
  ok   ranked ledger query no draft matches: output identical to drafts off
  ok   --full 1 and --index: ledger only, identical to drafts off
  ok   found from a subfolder of the wired project (no variable set)
  ok   outside any project (the toolkit itself): no drafts, exit 1
  bug-lookup: PASS=28 FAIL=0          (same under /bin/bash 3.2.57)

# master's bin/bug-lookup.sh (393d253), test from this branch
  FAIL one word / FAIL ranked / FAIL cwd discovery
  bug-lookup: PASS=25 FAIL=3

bin/check-portability.sh      -> clean (305 files)
bin/check-pr-discipline.sh    -> clean
bin/check-no-client-data.sh   -> no client data detected
LEAKGUARD_BASE=origin/master bin/check-no-client-data.sh -> no new capitalised words

The existing 17 checks (the 40-query dev set, the 18-query held-out set, --full, --index, usage) pass
unchanged, with drafts off by default in the test.

Open points for the maintainer

  • --index and --full do not include drafts. Easy to add, but it changes what --index counts.
  • From reading mxtk_walk_root (not tested): if the toolkit is cloned inside a project folder and the lookup runs there, the walk would return that project and its drafts would be searched. MXTK_PROJECT_DIR= avoids it.

bin/bug-lookup.sh read only the toolkit ledger, so a bug a session had already
written down in the project's bug-logs/ was invisible to the lookup that runs
before experimenting on the same error. Run from inside a wired project, it now
also searches that project's bug-logs/**.md after the ledger, and marks each
hit "(project draft: <file>:<line>)".

The ledger's output and ranking are unchanged: drafts are ranked in a separate
pass, so they never move the ledger's IDF; --full and --index stay ledger-only.
A ranked draft needs the same 40% coverage as the best ledger hit. The project
is found with project-bin/_common.sh (mxtk_walk_root from $PWD);
MXTK_PROJECT_DIR=<dir> names it and MXTK_PROJECT_DIR= (empty) turns drafts off.

Field: a Mendix 10.24 app with mxcli v0.27.0, 43 files in bug-logs/. The query
"cannot be spliced" listed no project drafts at 393d253; it lists 3, from 3
files, each pointing at a "## " line whose entry mentions splice. The project
was not written.

Test: group P of tests/wave2/test-bug-lookup.sh on synthetic drafts. With
master's bug-lookup.sh (393d253) 3 of its checks fail (25 pass); with the
change 28 of 28 pass, also under /bin/bash 3.2.57. Only one awk was on PATH,
so the other awks were not run.
@MendixMau

Copy link
Copy Markdown
Owner

Thanks @saingge! Independent review: MERGE. We moved your commit unchanged, with your authorship, into #557, so CI runs without fork approval and we can handle CHANGELOG conflicts. This PR closes when #557 merges; the merge commit carries a Co-authored-by line for you.


Generated by Claude Code

MendixMau added a commit that referenced this pull request Oct 22, 2026
… from #531)

Run from inside a wired project, bin/bug-lookup.sh now also searches that project's bug-logs/**.md after the ledger, in a separate ranking pass (ledger output and IDF unchanged; --full and --index stay ledger-only). MXTK_PROJECT_DIR names the project; empty turns drafts off. Fixture test-bug-lookup.sh group P 28/28. Contributed by @saingge in #531.

Review: MERGE — additive; ledger output unchanged; no timing change. Security review: safe.

Co-authored-by: saingge <262679532+saingge@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jQvaonym9V1wKKfAEPmRr
@MendixMau MendixMau closed this Oct 22, 2026
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.

2 participants