Skip to content

adopt-project.py and scaffold-project.py substitute the template placeholders one after another, so a free-text value holding another placeholder's token is expanded (--elected-by '{{SPEC_PATH}}' is recorded as elected_by: "spec") or, after the legs are pushed, refused as template-unsubstituted with "a defect in the substitution table of the tool you ran" #260

Closed

Description

@brettheap

(lane openRepoShape-1, 2026-10-11T21:40:34Z)

Found by this lane's re-verification of the #181 branch (fix/adopt-plan-quote-yaml-keywords at a0ff15b), out of that branch's scope. Pre-existing on main 39ac59c, and identical on the #181 branch.

What is wrong. render substitutes the placeholders one key at a time, each over the whole text, so text inserted by an earlier key is scanned again by every later one. A free-text value can therefore hold another placeholder's token: --elected-by and --reference in both tools, and the scaffold's --name.

  • A token for a key that comes later in the table is expanded. --elected-by '{{SPEC_PATH}}' is recorded as elected_by: "spec", and the run says adoption verified.
  • A token for a key that came earlier, or one no key names, stays in the output. There render finds it and raises template-unsubstituted, with a remediation that blames the tool: "this is a defect in the substitution table of the tool you ran, not in your invocation". {{PROJECT}} has a value, and it is still refused as having none.

Neither tool asks about {{ in these values before it creates anything, and check passes the plan. Both refusals come after the legs are pushed.

SHAPE=<openRepoShape checkout>
export GIT_AUTHOR_NAME=T [email protected] GIT_COMMITTER_NAME=T [email protected]
for who in '{{SPEC_PATH}}' '{{NOPE}}'; do
  TMP=$(mktemp -d)
  git init -q -b main "$TMP/Thing" && cd "$TMP/Thing" || exit 1
  mkdir src docs && printf 'print(1)\n' > src/app.py && printf '# Spec\n' > docs/spec.md
  printf '# Thing\n' > README.md && git add -A && git commit -qm init
  echo "== adopt-project.py plan --elected-by '$who'"
  python3 "$SHAPE/adopt-project.py" plan --source "$TMP/Thing" --project Northwind --org testorg \
      --elected-by "$who" --elected-on 2026-09-02 --out "$TMP/plan.yaml" >/dev/null
  echo "plan exit $?, the plan says $(grep '^elected_by:' "$TMP/plan.yaml")"
  python3 "$SHAPE/adopt-project.py" check --plan "$TMP/plan.yaml" | tail -1
  python3 "$SHAPE/adopt-project.py" execute --plan "$TMP/plan.yaml" --yes \
      --local-remote-dir "$TMP/remotes" --work-dir "$TMP/work" > "$TMP/out" 2>&1
  echo "execute exit $?"; grep -E '^REFUSED|^Remediation|^adoption verified' "$TMP/out"
  for leg in spec code; do
    echo "Northwind-$leg.git holds: $(git -C "$TMP/remotes/Northwind-$leg.git" for-each-ref --format='%(refname:short)' refs/heads)"
  done
  if git rev-parse -q --verify adopt/three-repo-shape >/dev/null; then
    git show adopt/three-repo-shape:project.yaml | grep '^elected_by:'
  fi
done
echo "== scaffold-project.py --elected-by '{{PROJECT}}'"
TMP=$(mktemp -d)
python3 "$SHAPE/scaffold-project.py" --org testorg --project Atlas --elected-by '{{PROJECT}}' \
    --elected-on 2026-09-02 --local-remote-dir "$TMP/remotes" --work-dir "$TMP/work" > "$TMP/out" 2>&1
echo "scaffold exit $?"; grep -E '^REFUSED|^Remediation' "$TMP/out"
for r in Atlas Atlas-spec Atlas-code; do
  echo "$r.git holds: $(git -C "$TMP/remotes/$r.git" for-each-ref --format='%(refname:short)' refs/heads)"
done

Observed on main 39ac59c:

== adopt-project.py plan --elected-by '{{SPEC_PATH}}'
plan exit 0, the plan says elected_by: "{{SPEC_PATH}}"
plan ok
execute exit 0
adoption verified: every source path is in exactly one place
Northwind-spec.git holds: main
Northwind-code.git holds: main
elected_by: "spec"
== adopt-project.py plan --elected-by '{{NOPE}}'
plan exit 0, the plan says elected_by: "{{NOPE}}"
plan ok
execute exit 2
REFUSED template-unsubstituted: README.md: no value for ['{{NOPE}}']
Remediation: this is a defect in the substitution table of the tool you ran, not in your invocation.
Northwind-spec.git holds: main
Northwind-code.git holds: main
== scaffold-project.py --elected-by '{{PROJECT}}'
scaffold exit 2
REFUSED template-unsubstituted: README.md: no value for ['{{PROJECT}}']
Remediation: this is a defect in the substitution table of the tool you ran, not in your invocation.
Atlas.git holds:
Atlas-spec.git holds: main
Atlas-code.git holds: main

The scaffold's --reference '{{NOPE}}' fails the same way. --name '{{NOPE}}' fails one step earlier, rendering templates/spec-root/AGENTS.md after all three repositories exist and before either leg is pushed.

Why it matters.

  • A value is recorded as something other than what the person gave. Above, the project's elector is recorded as spec in project.yaml and in the shape's README, under adoption verified.
  • The refusal comes after both leg repositories are created and pushed (by the scaffold, after all three are created). Its remediation tells the person the tool is broken, so they report a bug instead of changing the value. Meanwhile the repositories are left behind for the re-run to meet as leg-remote-exists, which against GitHub means real repositories to delete first.
  • {{ is unlikely in a name. It is possible in a --reference that quotes a templated path or a document that uses the same notation.

Where (main 39ac59c):

  • scripts/shape_materialize.py:928-938, render: the loop of str.replace over the table, then the PLACEHOLDER_RE (:306) scan of the output, and the remediation at :935-937.
  • adopt-project.py:2842-2891, _template_values. REFERENCE (:2864) and ELECTED_BY (:2866) come after PROJECT (:2854) and before SPEC_PATH (:2869).
  • adopt-project.py:2741-2743: the refusal is raised from _commit_the_split, after _create_leg_remotes (:2794) and _build_the_legs (:2806).
  • scaffold-project.py:1062-1090, the scaffold's table: PROJECT_NAME :1065, REFERENCE :1069, ELECTED_BY :1070.
  • The templates that carry the free text: templates/assembly-root/README.md:9-10, templates/assembly-root/project.yaml:32, :42 and :46, and templates/spec-root/AGENTS.md:1.

What would fix it. Substitute in one pass, so that a value is inserted literally and never scanned again: one PLACEHOLDER_RE.sub with a lookup in the table. Then look for leftovers among the tokens the TEMPLATE holds that the table lacks, which is the defect template-unsubstituted's remediation describes, and not in the output, which now carries the person's text. A test renders each free-text value as {{<every key>}} and {{NOPE}} and reads it back unchanged, in both tools.

Related. #181 (the same free-text values, its YAML half). No open issue or PR covers the substitution.

Not claimed.

🤖 Generated with Claude Code

Activity

  1. brettheap commented on Oct 11, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-5, session e62c2fd7-176d-429d-89fb-0653dd08ad5f@Eagle, 2026-10-11T23:24:02Z, for #260

    Logged in lanes/log/openRepoShape-5.md at dac421716ad85533865209ec474bb5b88d8c7077.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#260:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#260"`, kept where the row or its body names `#260`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `260` as a whole token:
       none
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions