[erk-pr] Plan: Sweep remaining plan_number/plan_id references in src/#9161
Closed
[erk-pr] Plan: Sweep remaining plan_number/plan_id references in src/#9161
Conversation
Member
Author
|
Plan Queued for Implementation submission-queuedstatus: queued
queued_at: '2026-03-10T13:24:24.813202+00:00'
submitted_by: schrockn
validation_results:
pr_is_open: true
has_erk_pr_title: true
expected_workflow: plan-implement
trigger_mechanism: label-based-webhook
pr_number: 9161
Plan submitted by schrockn at 2026-03-10T13:24:24.813202+00:00. The Workflow run: https://github.com/dagster-io/erk/actions/runs/22904638057 |
Contributor
|
⚙️ GitHub Action Started workflow-startedstatus: started
started_at: '2026-03-10T13:25:56Z'
workflow_run_id: '22904638057'
workflow_run_url: https://github.com/dagster-io/erk/actions/runs/22904638057
branch_name: plnd/O9109-sweep-remaining-plan-03-10-1321
pr_number: 9161
Setup completed successfully. Branch: |
Contributor
|
🚀 Starting implementation Worktree: |
schrockn
added a commit
that referenced
this pull request
Mar 10, 2026
Member
Author
|
🚀 Starting implementation Worktree: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Systematically sweep src/erk/ for remaining plan_number, plan_id, plan_url, and plan_title references that should be renamed to pr_ equivalents, covering ~50-60 non-TUI files across pipelines, commands, exec scripts, and core modules.
original-plan
Plan: Sweep remaining plan_number/plan_id references in src/
Part of Objective #9109, Node 3.6
Context
Objective #9109 renames "plan" terminology to "pr" across all APIs. Phases 1-2 are complete (PRs #9110, #9120, #9130, #9140, #9144, #9146 merged). Phase 3 nodes 3.1-3.5 are in progress (#9152 covers TUI layer). Node 3.6 sweeps for any remaining
plan_number,plan_id,plan_url,plan_titlereferences insrc/erk/that should have been renamed.Key distinction: Only rename fields/params where "plan_number" means "the PR number of an erk-plan". Do NOT rename conceptual references to "plan" (plan mode, plan files, plan save workflow, plan labels).
Scope
86 files in
src/erk/still containplan_number|plan_id|plan_url|plan_title. After excluding TUI files (covered by #9152), ~70 files remain. Many are intentional (plan-as-concept). The sweep must categorize each and rename only the "PR identifier" uses.Rename Rules
plan_number(param/field)pr_numberplan_id(param/field)pr_idplan_url(param/field)pr_urlplan_title(param/field)pr_title"plan_number"(string literal)"pr_number""plan_url"(string literal)"pr_url"DO NOT rename:
plan_save.py,plan_context_provider.py)PlanContext,PlanValidationSuccess)extract_plan_title()in exit_plan_mode_hook.py)add_plan_label,add_plan_labels)Implementation Phases
Phase A: Core pipeline files (highest impact)
These files have dataclass fields and function signatures that propagate through the codebase:
src/erk/cli/commands/implement_shared.pyTargetInfo.plan_number->pr_numbertarget_type="plan_number"->"pr_number"string literaltarget_type="plan_url"->"pr_url"string literalsrc/erk/cli/commands/land_pipeline.pyLandState.plan_id->pr_idresolve_plan_id()->resolve_pr_id()state.plan_id->state.pr_idsrc/erk/cli/commands/pr/submit_pipeline.pySubmitState.plan_id(line 104) ->pr_idplan_idin workflow dispatch dicts (lines 287, 489, 514)plan_titlein dispatch dicts (lines 289, 516)_detect_plan_number_from_context()->_detect_pr_number_from_context()plan_urlin DispatchResult construction (lines 177, 182)src/erk/cli/commands/pr/dispatch_cmd.pyDispatchContext.plan_title->pr_titleDispatchContext.plan_url->pr_url_build_workflow_run_url(plan_url=...)->pr_url_build_pr_url(plan_url=...)->pr_url"plan_id","plan_title"->"pr_number","pr_title"Phase B: Command files
src/erk/cli/commands/implement.pyplan_numberparameter (line 137) ->pr_numbertarget_info.plan_numberreferences ->pr_number"plan_number"/"plan_url"target type checks (lines 451, 457)src/erk/cli/commands/land_cmd.pyplan_idlocal variables ->pr_idplan_number=int(plan_id)->pr_number=int(pr_id)(line 1098)src/erk/cli/commands/objective_helpers.pyplan_numbervariable ->pr_number(lines 38, 42, 46, 51)plan_number: intparameter (line 79) ->pr_numberplan_idfrom resolve call (line 34) ->pr_idsrc/erk/cli/commands/exit_plan_mode_hook.pyHookInput.plan_saved_plan_number->saved_pr_numberHookInput.plan_number->pr_numberHookInput.plan_title->pr_title(but only if it means PR title, not plan.md title)extract_plan_title()- KEEP (extracts from plan.md file)Phase C: Exec scripts
plan_id/plan_numberas PR identifiers - sweep each:plan_save.py,push_and_create_pr.py,close_pr.py,close_prs.pyincremental_dispatch.py,post_workflow_started_comment.pyland_execute.py,setup_impl.py,setup_impl_from_pr.pyget_plan_info.py,get_plan_metadata.py,get_pr_for_plan.pyupload_impl_session.py,impl_init.pydetect_plan_from_branch.py,register_one_shot_plan.pyplan_id/plan_numberparams/variables that represent PR numbersPhase D: Remaining files
Other CLI commands:
land_learn.py,land_stack.py,reconcile_cmd.py,reconcile_pipeline.pyone_shot_remote_dispatch.py,one_shot/cli.pyconsolidate_learn_plans_dispatch.pybranch/checkout_cmd.py,branch/create_cmd.pywt/delete_cmd.py,wt/create_cmd.pypr/subcommands:shared.py,close_cmd.py,checkout_cmd.py,log_cmd.py,check_cmd.py,rewrite_cmd.py,metadata_helpers.py,submit_cmd.py,view/operation.py,view/cli.py,list/cli.pyCore modules:
github_parsing.py:parse_plan_number_from_urlusagecore/plan_context_provider.py: field renames inside PlanContext classcore/commit_message_generator.pycore/file_utils.pyadmin.pylearn/learn_cmd.pyPhase E: Workflow dispatch dict keys
Many exec scripts and dispatch commands emit JSON with
"plan_id","plan_number","plan_title"keys. These are consumed by GitHub Actions workflows and Claude commands/skills. Changes here require coordinating with:.github/workflows/(already covered by node 4.x PRs).claude/commands/and.claude/skills/(covered by node 4.2-4.3)Strategy: Rename the dict keys in src/ now. Workflow/skill consumers will be updated in Phase 4 nodes.
Files to modify
~50-60 files in
src/erk/cli/andsrc/erk/core/(excludingsrc/erk/tui/which is handled by #9152).Verification
ruff check src/- no lint errorsty check src/- no type errorspytest tests/unit/ -x- all unit tests passpytest tests/integration/ -x- all integration tests passgrep -r "plan_number\|plan_id\b\|plan_url\|plan_title" src/erk/ --include="*.py"should only show:plan-header
To replicate this PR locally, run:
Workflow run: https://github.com/dagster-io/erk/actions/runs/22904638057
Remotely executed: Run #22904638057