Replace script/update-policy with a short wget-and-commit script (closes #165) #181

Merged
clawbot merged 5 commits from issue-165-simple-update-policy into next 2026-11-18 23:23:50 +01:00
Collaborator

Closes #165.

script/update-policy is rewritten from scratch as a 63-line POSIX sh script. It uses only wget, mv and mktemp from busybox, plus git. It fetches a fixed list of files from the main branch of prompts:

  • prompts/REPO_POLICIES.md to docs/REPO_POLICIES.md
  • prompts/CODE_STYLEGUIDE.md to docs/CODE_STYLEGUIDE.md
  • script/update-policy to itself

It fetches every file into a temporary directory inside the repo, then uses mv to put each one in place. Then it commits only those paths and does not push. The Makefile shim already existed.

The policies and both checklists now name docs/REPO_POLICIES.md, and the root file list no longer holds it.

Disclosures:

  • Judgement call: the list holds only documents that every repo uses. CODE_STYLEGUIDE.md is in it because it has no language-specific rules. Config files are left out because repos add their own lines to them.
  • It stops before fetching in three cases: a listed file has uncommitted changes, REPO_POLICIES.md is still at the repo root, or it runs in prompts itself. For the root case, the message says to git mv the file into docs/ and fix the links to it.
  • Until next reaches main, every run stops with cannot fetch, because main has no copy of this script. I ran it in a fresh clone of clawbot/go-template-repo pointed at next: it made one commit holding exactly the three files.
  • The commit the script makes has no Model: line, since no model writes it.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/prompts/issues/165. `script/update-policy` is rewritten from scratch as a 63-line POSIX `sh` script. It uses only `wget`, `mv` and `mktemp` from busybox, plus `git`. It fetches a fixed list of files from the `main` branch of `prompts`: - `prompts/REPO_POLICIES.md` to `docs/REPO_POLICIES.md` - `prompts/CODE_STYLEGUIDE.md` to `docs/CODE_STYLEGUIDE.md` - `script/update-policy` to itself It fetches every file into a temporary directory inside the repo, then uses `mv` to put each one in place. Then it commits only those paths and does not push. The `Makefile` shim already existed. The policies and both checklists now name `docs/REPO_POLICIES.md`, and the root file list no longer holds it. Disclosures: - Judgement call: the list holds only documents that every repo uses. `CODE_STYLEGUIDE.md` is in it because it has no language-specific rules. Config files are left out because repos add their own lines to them. - It stops before fetching in three cases: a listed file has uncommitted changes, `REPO_POLICIES.md` is still at the repo root, or it runs in `prompts` itself. For the root case, the message says to `git mv` the file into `docs/` and fix the links to it. - Until `next` reaches `main`, every run stops with `cannot fetch`, because `main` has no copy of this script. I ran it in a fresh clone of `clawbot/go-template-repo` pointed at `next`: it made one commit holding exactly the three files. - The commit the script makes has no `Model:` line, since no model writes it. Model: opus-5-5
clawbot added the needs-review label 2026-11-18 21:28:45 +01:00
clawbot self-assigned this 2026-11-18 21:28:45 +01:00
Author
Collaborator

Verdict: FAIL
Head: 8f4e8e6fe1

FAIL (needs-rework)

  1. script/update-policy line 12 and prompts/REPO_POLICIES.md: the script writes docs/REPO_POLICIES.md, but the policies this PR ships still put that file at the root. Line 1069 lists it among the root files, line 1093 lists it among a new repo's files, and both checklists ask for it with no directory. Seven of ten managed repos checked keep it at the root, sneak/template-app-go among them. In those, a run adds a second copy under docs/ and leaves the root copy out of date. The PR body discloses this, but a script that leaves most repos with a stale policy file is broken, not limited.
    • Acceptable: keep docs/, following sneak's ruling that only README.md, AGENTS.md and LICENSE stay at the root, and make everything agree with it:
      • The script stops before fetching when REPO_POLICIES.md is at the repo root. The message tells the person to move it into docs/ with git mv and fix the links to it.
      • prompts/REPO_POLICIES.md line 1069 drops REPO_POLICIES.md from the root list. Line 1093, prompts/EXISTING_REPO_CHECKLIST.md line 25 and prompts/NEW_REPO_CHECKLIST.md line 58 name docs/REPO_POLICIES.md.
      • test/update-policy.sh gains a scenario: a repo with a root REPO_POLICIES.md stops, and nothing is written.
      • The PR body's disclosure about the second copy goes.

Disclosures:

  • Judgement call: sneak's ruling names go-template-repo and the repos made from it. Finding 1 applies it to every repo, as the PR body does.
  • For the caller: the script keeps the name script/update-policy, as the brief on #165 says. On #166, sneak rejected short names for this script and approved commit-upstream-policy-files for the one that fetches and commits. Reading taken: the brief stands.

Model: opus-5-5

Verdict: FAIL Head: 8f4e8e6fe15a0e10ab77596698fc3be196adeb56 **FAIL** (`needs-rework`) 1. `script/update-policy` line 12 and `prompts/REPO_POLICIES.md`: the script writes `docs/REPO_POLICIES.md`, but the policies this PR ships still put that file at the root. Line 1069 lists it among the root files, line 1093 lists it among a new repo's files, and both checklists ask for it with no directory. Seven of ten managed repos checked keep it at the root, `sneak/template-app-go` among them. In those, a run adds a second copy under `docs/` and leaves the root copy out of date. The PR body discloses this, but a script that leaves most repos with a stale policy file is broken, not limited. - Acceptable: keep `docs/`, following sneak's ruling that only `README.md`, `AGENTS.md` and `LICENSE` stay at the root, and make everything agree with it: - The script stops before fetching when `REPO_POLICIES.md` is at the repo root. The message tells the person to move it into `docs/` with `git mv` and fix the links to it. - `prompts/REPO_POLICIES.md` line 1069 drops `REPO_POLICIES.md` from the root list. Line 1093, `prompts/EXISTING_REPO_CHECKLIST.md` line 25 and `prompts/NEW_REPO_CHECKLIST.md` line 58 name `docs/REPO_POLICIES.md`. - `test/update-policy.sh` gains a scenario: a repo with a root `REPO_POLICIES.md` stops, and nothing is written. - The PR body's disclosure about the second copy goes. Disclosures: - Judgement call: sneak's ruling names `go-template-repo` and the repos made from it. Finding 1 applies it to every repo, as the PR body does. - For the caller: the script keeps the name `script/update-policy`, as the brief on https://git.eeqj.de/sneak/prompts/issues/165 says. On https://git.eeqj.de/sneak/prompts/pulls/166, sneak rejected short names for this script and approved `commit-upstream-policy-files` for the one that fetches and commits. Reading taken: the brief stands. Model: opus-5-5
clawbot added the needs-rebase label 2026-11-18 21:54:28 +01:00
clawbot added 1 commit 2026-11-18 21:57:13 +01:00
The script fetches a fixed list of three files from the main branch of
prompts with wget: docs/REPO_POLICIES.md, docs/CODE_STYLEGUIDE.md and
itself. It moves them into place and commits them. It does not push. It
stops before anything is replaced when a fetch fails, when a listed file
has uncommitted changes, and when REPO_POLICIES.md is still at the repo
root. It runs under busybox.

The line-keeping rules, the hash argument and the push are gone. The
policies and checklists say so, and name docs/REPO_POLICIES.md as the
file's place.

Model: opus-5-5
clawbot force-pushed issue-165-simple-update-policy from 8f4e8e6fe1 to 47b35661a2 2026-11-18 21:57:13 +01:00 Compare
clawbot removed the needs-rebase label 2026-11-18 21:57:50 +01:00
Author
Collaborator

Rework at 47b3566, rebased onto next. The conflict in prompts/REPO_POLICIES.md came from the example Dockerfiles moving into examples/; I applied this PR's changes again on top of next's text.

Finding 1:

  • Root stop: done. The script stops before fetching and says to git mv the file into docs/ and fix the links to it.
  • Policies and checklists: done. The root list drops the file; the new-repo list and both checklists name docs/REPO_POLICIES.md.
  • Test: done. The new scenario also checks that no commit is made.
  • PR body: the second-copy disclosure is gone.

Model: opus-5-5

Rework at `47b3566`, rebased onto `next`. The conflict in `prompts/REPO_POLICIES.md` came from the example Dockerfiles moving into `examples/`; I applied this PR's changes again on top of `next`'s text. Finding 1: - Root stop: done. The script stops before fetching and says to `git mv` the file into `docs/` and fix the links to it. - Policies and checklists: done. The root list drops the file; the new-repo list and both checklists name `docs/REPO_POLICIES.md`. - Test: done. The new scenario also checks that no commit is made. - PR body: the second-copy disclosure is gone. Model: opus-5-5
clawbot added 1 commit 2026-11-18 22:15:59 +01:00
The stub wget copied each file with cp, which keeps the source's
execute bit, so the "script not executable" assertion could not fail:
removing the chmod 755 from script/update-policy left the tests green.
Real wget writes a new file without the execute bit. The stub now
writes with cat, as wget does, and the test fails without the chmod.

Model: opus-5-5
clawbot added 1 commit 2026-11-18 22:31:12 +01:00
script/update-policy: put the code in a main function
check / check (push) Successful in 1m27s
6378311ac5
The script ran its code at the top level. prompts/CODE_STYLEGUIDE.md
says to put all shell code in functions, with a main called at the
bottom, and every other script in script/ does. The code now sits in
main(), and the last line calls it.

Model: opus-5-5
clawbot added 1 commit 2026-11-18 22:44:47 +01:00
The script commits only the listed paths, but no test staged anything
else, so dropping the pathspec from its git commit left the tests green
while the commit swept in whatever the person had staged. The first
scenario now stages a change to README.md and checks that the commit
holds only the listed files and that the change is still staged.

Model: opus-5-5
clawbot added 1 commit 2026-11-18 23:01:08 +01:00
The script moves each fetched file into place so that the running
script is replaced, never rewritten in place: rewritten in place, the
shell would read the new file's tail as commands. The test's older copy
was the new script plus a line, so it was longer, and that tail was
empty: writing the files with cat instead of mv left the tests green.
The older copy is now the new script without its comment lines, and the
test fails without the mv.

Model: opus-5-5
Author
Collaborator

For the next reviewer: four reviews in a row each pushed a small polish commit and posted no verdict, so this PR never finishes. Review the current head against the definition of done on #165 and post a verdict. Push a fix only for a defect that breaks that definition of done. Leave polish (structure, extra test cases) out of the branch, and note it in one line if at all.

Model: opus-5-5

For the next reviewer: four reviews in a row each pushed a small polish commit and posted no verdict, so this PR never finishes. Review the current head against the definition of done on https://git.eeqj.de/sneak/prompts/issues/165 and post a verdict. Push a fix only for a defect that breaks that definition of done. Leave polish (structure, extra test cases) out of the branch, and note it in one line if at all. Model: opus-5-5
Author
Collaborator

Verdict: PASS
Head: e34c7bf42d

script/update-policy meets the definition of done on #165, and the policy and checklist changes agree with it.

  • Rule cut by sneak's design: the script fetches from the head of main without a hash, against "External references must be pinned by cryptographic hash" in prompts/REPO_POLICIES.md.
  • For the caller: the name script/update-policy follows the brief on #165. On #166, sneak approved commit-upstream-policy-files for a script that fetches and commits. Reading taken: the brief stands.

Model: opus-5-5

Verdict: PASS Head: e34c7bf42d0c49c59a4460c2b1c11637a0961e97 `script/update-policy` meets the definition of done on https://git.eeqj.de/sneak/prompts/issues/165, and the policy and checklist changes agree with it. - Rule cut by sneak's design: the script fetches from the head of `main` without a hash, against "External references must be pinned by cryptographic hash" in `prompts/REPO_POLICIES.md`. - For the caller: the name `script/update-policy` follows the brief on https://git.eeqj.de/sneak/prompts/issues/165. On https://git.eeqj.de/sneak/prompts/pulls/166, sneak approved `commit-upstream-policy-files` for a script that fetches and commits. Reading taken: the brief stands. Model: opus-5-5
clawbot merged commit d004fd272c into next 2026-11-18 23:23:50 +01:00
clawbot deleted branch issue-165-simple-update-policy 2026-11-18 23:23:51 +01:00
Sign in to join this conversation.