Files
Worktrunk Bot 05a301250f chore(clawpatch): point two stale entrypoint symbols at the live code (#3765)
Nightly sweep finding: two `.config/clawpatch/features/*.json`
entrypoints name symbols that no longer exist.

**`feat_custom_template_expansion.json`.** `expand_command_template` was
deleted by #3635 ("derive the hook preview from the execution path"),
which folded the preview render into `render_template_preview` in
`src/commands/command_executor.rs` and left `expand_template` in
`src/config/expansion.rs` as the single runtime render. The feature file
kept pointing at the old name, so the one thing it exists to do — send a
reader to the code that renders a project-supplied template before the
approval gate sees it — lands nowhere.

- **Entrypoint** → `src/config/expansion.rs::expand_template`. The
module doc calls it "a single generic function" for template rendering,
and it's what the feature's own summary is about ("expansion happens
before the approval gate sees the final string").
- **`ownedFiles` reordered and re-reasoned.** `expansion.rs` moves first
and its reason now names the render functions. `command_executor.rs` is
added — that's where #3635 put `render_template_preview` and the
foreground step pipeline, so the file the code moved *into* was missing
from a file list that still described where it came from.
`hook_commands.rs` stays, with its reason updated to what it actually
holds now (`run_hook`, the `hook show --expanded` rows).

**`feat_custom_switch_resolve.json`.** Entrypoint `handle_switch` →
`handle_switch_command`. The function was renamed when #3049 moved
switch/remove orchestration out of `main.rs`; the definition today is
`pub fn handle_switch_command` at `src/commands/worktree/switch.rs`.

This second one is why the sweep's original audit reported only one
stale symbol: it grepped each `entrypoints[].symbol` as a plain
substring, and `handle_switch` matches inside `handle_switch_command`
(and `handle_switch_output`, `handle_switch_created_output`, …), so a
renamed symbol whose new name merely extends the old one reads as
present. Re-run anchored on a definition —
`\b(fn|struct|enum|trait|type|const|static|mod)\s+<symbol>\b` inside the
declared `path` — all 14 features now resolve, and no other entrypoint
has this shape.

Following the convention of the last edit to this directory (3554f4979,
which fixed `interrupt_exit_code` → `interrupt_signal` in the
signal-handling feature), symbol names are corrected in place and
`updatedAt` is left alone.

No test accompanies this — nothing in the suite reads
`.config/clawpatch/`, which is why both references went stale silently.
A sync test is conceivable, but it would be a new check on a
hand-authored threat-model index whose schema this repo doesn't own; I'd
rather flag the idea than build it unasked. If one is ever added, it
should anchor on the definition, not a substring grep, for the reason
above.

---------

Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
2026-08-07 16:11:34 -07:00

122 lines
3.4 KiB
JSON

{
"schemaVersion": 1,
"featureId": "feat_custom_switch_resolve",
"title": "wt switch + branch resolution: ref-injection, PR fetching, network policy",
"summary": "`wt switch` resolves user-supplied references (branch names, pr:N, mr:N, gh URLs) and may create worktrees. Branch names can contain hyphens, slashes, special chars — must be passed to git without interpretation as flags. PR/MR fetch is the one place where shelling out to `gh`/`glab` is allowed and must not happen on background paths. See CLAUDE.md > Network Access policy and Worktree Model.",
"kind": "library",
"source": "manual",
"confidence": "high",
"entrypoints": [
{
"path": "src/commands/worktree/switch.rs",
"symbol": "handle_switch_command",
"route": null,
"command": "wt switch"
}
],
"ownedFiles": [
{
"path": "src/commands/worktree/switch.rs",
"reason": "switch command top-level"
},
{
"path": "src/commands/worktree/resolve.rs",
"reason": "PR/MR/branch resolution"
},
{
"path": "src/commands/worktree/types.rs",
"reason": "switch types/options"
},
{
"path": "src/git/remote_ref/mod.rs",
"reason": "remote ref parsing (PR/MR URLs)"
},
{
"path": "src/git/remote_ref/github.rs",
"reason": "GitHub PR fetch and owner/repo URL derivation from the forge remote"
},
{
"path": "src/git/remote_ref/gitlab.rs",
"reason": "GitLab MR fetch and project URL parsing"
},
{
"path": "src/git/remote_ref/gitea.rs",
"reason": "Gitea PR fetch and URL parsing"
},
{
"path": "src/git/remote_ref/azure.rs",
"reason": "Azure DevOps PR fetch and source-branch validation"
},
{
"path": "src/git/repository/branch.rs",
"reason": "branch name handling"
}
],
"contextFiles": [
{
"path": "src/git/repository/mod.rs",
"reason": "repository operations"
},
{
"path": "src/commands/worktree/mod.rs",
"reason": "worktree module"
},
{
"path": "src/commands/hooks.rs",
"reason": "post-switch hook invocation"
},
{
"path": "CLAUDE.md",
"reason": "network policy, branch name handling"
}
],
"tests": [
{
"path": "tests/integration_tests/switch.rs",
"command": "cargo test --test integration switch"
}
],
"tags": [
"rust",
"network-policy",
"ref-injection",
"user-input"
],
"trustBoundaries": [
"user-input",
"network",
"process-exec"
],
"status": "needs-fix",
"lock": null,
"findingIds": [
"fnd_sig-feat-custom-switch-resolve-d_5219fbb9db",
"fnd_sig-feat-custom-switch-resolve-2_faf6ce371c",
"fnd_sig-feat-custom-switch-resolve-d_db7a89a910",
"fnd_sig-feat-custom-switch-resolve-b_d9afa10eef",
"fnd_sig-feat-custom-switch-resolve-d_2ef4bb00aa",
"fnd_sig-feat-custom-switch-resolve-c_24711332c6"
],
"patchAttemptIds": [],
"analysisHistory": [
{
"runId": "20260516T210804-353f93",
"kind": "review",
"summary": "3 finding(s)",
"provider": "codex",
"model": null,
"createdAt": "2026-05-16T21:14:00.797Z"
},
{
"runId": "20260517T050139-b247d5",
"kind": "review",
"summary": "3 finding(s)",
"provider": "codex",
"model": null,
"createdAt": "2026-05-17T05:12:27.656Z"
}
],
"createdAt": "2026-05-16T21:00:00.000Z",
"updatedAt": "2026-05-19T00:00:00.000Z"
}