Skip to content

Tooling: lint/script to catch in-body namespace-qualified refs after rename #20847

@rjwalters

Description

@rjwalters

Architectural follow-up from /sweep of epic #20732 (7 AlphaProof Nexus integrations).

Problem

Three of the seven AlphaProof Nexus port PRs (#20836, #20838, #20839) needed a Doctor cycle for the same class of bug: after the sed-style namespace rename (namespace Erdos741namespace Erdos741APN_I, etc.), in-body references inside tactic invocations like delta Erdos741.foo at h, simp_all [Erdos152.D_set], change Erdos26.X_seq kept the old namespace prefix.

The naïve sed s/^namespace Erdos741/namespace Erdos741APN_I/ only catches the ^namespace/^end lines, missing every in-body occurrence. The errors only surface at docker-build time. PR #20837 had one such leftover marked non-blocker; #20838 had three; #20839 had two — same root cause, three Doctor cycles burned.

Proposal

A small pre-PR check (script or Lean linter) that, given a file with namespace Foo declared, flags any token of the form Foo.<Ident> inside the file body. The flagged occurrences can then be either qualified to the renamed namespace or stripped to the unqualified form before the PR opens.

Rough sketch (Bash/grep is enough for the common case):

ns=$(grep -oP "^namespace \K\S+" "$file" | head -1)
old_ns=$(git log -p -- "$file" | grep -oP "^-namespace \K\S+" | head -1)
[ -n "$old_ns" ] && grep -n "\b${old_ns}\.[A-Z]" "$file"

More robust as a Lean-syntax-aware linter, but grep-based catches >90% of cases.

Acceptance

  • Script or check available in the repo (e.g., scripts/lint/check-renamed-namespace-refs.sh).
  • A future port of an AlphaProof Nexus file would catch the namespace-leftovers before the builder opens the PR.
  • Optional: integrate into the builder skill prompt so this is part of the pre-push checklist.

This is a small tooling investment; /architect or /hermit could scope it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions