enhance-wiring
Goal
Finish the enhance-existing write path that was swept into HEAD unwired and untested, so a related duplicate folds into the existing bug.
Implementation Sketch
Deliver the enhance-wiring slice of the graph-native relatedness + dedup capability per the plan mission; ground every claim against the verified intel-graph facts in the overview.
Work Items
- VERIFY-FIRST — the
related_enhancebranch inappend_open_bug(added by s-6924d386’s dedup-verdict wiring, which runs before this section) may already callenhance_bug_entryas part of realizing itsenhanced_existingexit_reason. Confirm the call is present, correctly threaded (bug_id, context, provenance), and relies onenhance_bug_entry’s own internalrequire_write_unlockcall for the open-bugs unlock discipline (do NOT add a second unlock check in the wiring code). If the branch exists but does not yet callenhance_bug_entry, wire the call in. Import from the publicscripts.plan_corpus.bug_tracker.apire-export —enhance_bug_entrymoved to_field_setters_text.pyunder refactor e4ba1fb70;api.pykeeps the import path valid via re-export, never import the private module path. Do NOT re-authorenhance_bug_entryitself. - Test enhance_bug_entry’s genuinely-unpinned legs (test_write_choke_validation.py already pins the happy path at :235 and corrupted-entry rejection at :176 via e4ba1fb70 — do not re-duplicate those): the exact provenance-line format (
[enhanced <provenance>] <context>, default provenanceadd-bug), idempotent noop when the line is already present innote, ApiError when bug_id is a closed or missing entry (closed-bug -> file new, not enhance), and BugTrackerLockError when no live open-bugs unlock is held (test_write_path_unlock.py currently has zero enhance_bug_entry coverage — this leg is unpinned today). Extend the existing_bug/_seed_open_directfixtures and the autouse unlock fixture rather than inventing a new fixture path. Also exercise the wiredrelated_enhancepath end-to-end through the realpython -m scripts.add_bug_runtime appendproduction CLI entry point, not only a seam-injected directenhance_bug_entry(...)call. - Resolve the public extractor wrappers tokenize_words/extract_paths (verified already dead today: zero callers of the public names anywhere in the repo, production or test — relatedness.py’s own dispatch logic calls the private _tokenize_words/_extract_paths directly, and the wrappers exist in TWO public surfaces: signals.py:360-376 canonical, plus relatedness.py’s all re-export). If section 02 (relatedness-graph-rewrite) and every other consuming section land with no genuine external consumer of the public names, delete both the wrapper functions and the relatedness.py re-export. Otherwise collapse to ONE public home (signals.py; relatedness.py’s re-export is documented as a transitional shim) and add a dedicated wrapper-contract test for the surviving surface. No uncalled dead scaffolding and no duplicate public surface left behind.
Fresh intel (regenerated)
VERDICT: enhance-wiring is a pure Python-tooling section whose CODE terrain is structurally invisible to the code-symbol graph (the ori repo indexes compiler_repo/ Rust + .ori only — 0 Python symbols, verified), but whose SUBSTRATE — the related-nodes graph query the whole plan rides on — is live and was probed end-to-end this session. Three decisive facts the section’s work inherits:
enhance_bug_entryis real, tested-at-the-choke, and UNCALLED. It lives atscripts/plan_corpus/bug_tracker/_field_setters_text.py:142(moved out ofapi.pyby the e4ba1fb70 module split; originally swept in at e559cc38 under an unrelated BUG-04-139 commit, verified viagit show).grepconfirms zero production callers; the literalrelated_enhancebranch it documents exists ONLY in docstrings (_field_setters_text.py:151,_result_types.py:80) — no verdict enum, no branch inappend_open_bug, and NObug_dedup.pyanywhere. The wiring target (bug_tracker_io.py:append_open_bug) currently has exactly two paths: redirect-on-signals or append.- [JOIN] The verdict layer this wiring consumes does not exist yet, and the walk order says that is fine.
dag-asciiorder: s-f7b5e470 (related-nodes query, in-progress in the graph snapshot) -> s-c7999cd5 (relatedness-graph-rewrite) -> s-6924d386 (bug-dedup-module) -> s-d35ea8d5 (THIS) -> skill-surface -> tests-and-docs -> 4 plan-side twins. enhance-wiring runs AFTER bug-dedup-module delivers therelated_enhanceverdict. The section’s job is the WRITE leg only: branchappend_open_bugon the dedup verdict -> callenhance_bug_entryunder the open-bugs unlock. Re-authoring verdict logic here is cross-section scope bleed. - [JOIN] The live
related-nodesprobe exposes the exact failure mode the downstream branch must gate against. Probed live: plain-English text returnscount: 0(theinput_refs-empty short-circuit atquery_graph.py:2666fires BEFORE the fulltext leg — only backtick/error-code-bearing text ranks at all), while backticked text returns hits that (a) include CLOSED bugs (resolved/oberows returned), and (b) rank on common-English title tokens (an unrelated typeck bug outranked genuine tracker-family bugs).enhance_bug_entry’s open-entry-onlyApiErroris therefore the LAST-LINE guard, not a corner case — the w-e85ae8eb closed-bug test is load-bearing, and the upstream verdict (s-6924d386 scope) must gate on score/status, nevercount>0.
Decisions forced before work: (a) treat w-137a5f98 as verify-first wiring of an existing function — the plan-fold already says “do NOT re-author”; (b) w-e85ae8eb’s matrix must SUBTRACT what already landed — test_write_choke_validation.py (e4ba1fb70) already pins the happy path + corrupted-entry rejection; the genuinely-unpinned legs are provenance-line format, idempotent noop, closed/missing-id ApiError, and the no-unlock BugTrackerLockError (test_write_path_unlock.py has zero enhance coverage — verified); (c) w-3f100236’s wrapper disposition: tokenize_words/extract_paths now live canonically in signals.py with relatedness.py re-exporting them — importer inventory shows only in-package tests + __main__.py/api.py/bug_tracker_io.py consumers, none of which import the two wrappers by name from outside the package.
(full dossier: enhance-wiring—s-d35ea8d5.intel.md)