Require places on every record, add the audit checklist and the monthly place check
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
73b13c3d48
commit
e6bc42c373
7 files changed
+123
-8
No files matched your search
@@ -38,7 +38,7 @@ A worker starts with nothing from this session. Give it one line and let the bri
|
||||
|
||||
**7. Stop: the owner decides.** Put one list in front of the owner, with your recommendation on each item: borderline candidates (trails near the floor, partly built, networks, routes with thin author pages), the trails 40 to 50 miles that are well known, every `hold`, every record a verifier found closed, merged or no longer walkable (workers never propose removing one), every `declined` request and every change a holder might dispute, the changes that touch a length, an end or a track licence, and any track that is more than 15% off without a settled explanation. Decisions about what belongs are the owner's: the inclusion rule is in `README.md`, and the reasons already given are in `left-out.toml`. The owner's answers go into `<staging>/owner.csv`. An approved candidate is written up by a `briefs/find-missing-trails.md` worker, reviewed as in phase 6, and joins the list. Nothing is applied before this stop.
|
||||
|
||||
**8. Apply and rebuild.** Dispatch one `briefs/apply.md` worker, and only one. It applies the accepted proposals by targeted edits with their history entries, runs `tools/elevation.py` for new tracks, adds the `SOURCES.md` rows, rebuilds the shared files with `tools/build_index.py`, and runs the validator, `tools/check_history.py`, `python3 -m unittest discover tools/tests` and the web tests, and it writes the `CHANGELOG.md` entry. *Check yourself:* `git diff --stat` matches the accepted list; read the hunks yourself for anything that touches a length, an end, a licence or a track; read the changelog entry and fix its wording; rerun the validator and the history check with your own hands; no `trail.toml` outside the accepted ids changed. A change to a fact with no history entry, or a ship with no changelog entry in the same commit, is not done.
|
||||
**8. Apply and rebuild.** Dispatch one `briefs/apply.md` worker, and only one. It applies the accepted proposals by targeted edits with their history entries, runs `tools/elevation.py` for new tracks, adds the `SOURCES.md` rows, rebuilds the shared files with `tools/build_index.py`, and runs the validator, `tools/check_history.py`, `python3 -m unittest discover tools/tests` and the web tests, and it writes the `CHANGELOG.md` entry. A new record, or one whose track changed, also needs its places: the validator fails a record with no `places_checked` or a track that changed after it was measured, so the worker runs `tools/place_trails.py` for those ids. `docs/audit.md` is the monthly checklist this runbook is the first step of. *Check yourself:* `git diff --stat` matches the accepted list; read the hunks yourself for anything that touches a length, an end, a licence or a track; read the changelog entry and fix its wording; rerun the validator and the history check with your own hands; no `trail.toml` outside the accepted ids changed. A change to a fact with no history entry, or a ship with no changelog entry in the same commit, is not done.
|
||||
|
||||
**9. Build, check, ship, follow up.** Build the site (`python3 web/build.py --out _site`) and read the built HTML for three trails that changed, one new trail, the "Considered and left out" page and the home page counts. Then commit on the branch, with the changelog entry in the same commit. Pushing to `main` starts the deploy, which publishes to the public. Ship only if the owner has said, in this run or as a standing instruction, that a finished refresh may go out; otherwise show them the branch and stop. Afterwards, go through the open issues on the project's tracker (https://github.com/swaits/longhikes/issues): answer those the refresh settled, warmly and without making the person do more work. A holder's or author's own statement in an issue is enough to rely on, quoted with its address.
|
||||
|
||||
|
||||
@@ -15,10 +15,11 @@ Everything staged so far was written without touching the repository, so that ma
|
||||
3. `python3 tools/refresh.py apply`. It changes the named lines and adds the history entries.
|
||||
4. For each new track (a proposal with a track file), `python3 tools/elevation.py <id>`: it writes `elevation.json` from the track. For a replaced track, `--force`.
|
||||
5. Add the rows named in `sources_md` fields to `SOURCES.md`, by hand, in the existing form and place. Where a record was removed or a track dropped, take the row's counts and lists with it.
|
||||
6. `python3 tools/build_index.py` rebuilds `trails.csv`, `index.geojson` and the counts in `README.md`. Do not edit those files by hand. It also appends any new record to the end of `trail-numbers.txt` (a trail's permanent number); commit that line with the record and never change, remove or reorder the lines already there.
|
||||
7. `python3 tools/validate.py` must end `OK <n> trails`. `python3 tools/check_history.py` must end `OK history`. A failure that names a record you changed is yours: find the cause, and if it is a proposal that was wrong, say so in your report and revert that record from git (`git checkout -- <id>`, then apply the rest without it, by `--only`). A failure in a record you did not touch is reported.
|
||||
8. Run all the test suites: `python3 -m unittest discover tools/tests` and `python3 -m unittest discover -s web/tests`. The web tests hold counts of trails, tracks and emblems; if one fails only because a count moved with the change, update that count. Any other failure is a real failure: stop and report it.
|
||||
9. Write the entry at the top of `CHANGELOG.md`, in the voice of the entries already there (read the top two): a dated heading with a short title, then plain bullets saying what changed for contributors and, where a visitor can see it, what a visitor will see. State the counts that changed (trails, tracks, emblems). Say what was checked and left unchanged only where it matters. The orchestrator reads and edits it.
|
||||
6. Place each new record, and each record whose track was replaced: the validator fails a record with no `places_checked`, or whose track changed after its places were measured. For an id with a track, run `.venv-places/bin/python tools/place_trails.py propose`, read the proposal for those ids, and `apply` it (the tool's libraries are in that virtual environment, set up from `tools/place_trails.requirements.txt`). For a new trail with no track, find the places it is in on a page that names the trail there, and run `place_trails.py stated <id> <kind> <slug> <page address> "<the sentence that says so>"` for each; where it is in none, run `place_trails.py stamp <id>`. Report any place you could not find in the registry or the outlines instead of inventing it.
|
||||
7. `python3 tools/build_index.py` rebuilds `trails.csv`, `index.geojson` and the counts in `README.md`. Do not edit those files by hand. It also appends any new record to the end of `trail-numbers.txt` (a trail's permanent number); commit that line with the record and never change, remove or reorder the lines already there.
|
||||
8. `python3 tools/validate.py` must end `OK <n> trails`. `python3 tools/check_history.py` must end `OK history`. A failure that names a record you changed is yours: find the cause, and if it is a proposal that was wrong, say so in your report and revert that record from git (`git checkout -- <id>`, then apply the rest without it, by `--only`). A failure in a record you did not touch is reported.
|
||||
9. Run all the test suites: `python3 -m unittest discover tools/tests` and `python3 -m unittest discover -s web/tests`. The web tests hold counts of trails, tracks and emblems; if one fails only because a count moved with the change, update that count. Any other failure is a real failure: stop and report it.
|
||||
10. Write the entry at the top of `CHANGELOG.md`, in the voice of the entries already there (read the top two): a dated heading with a short title, then plain bullets saying what changed for contributors and, where a visitor can see it, what a visitor will see. State the counts that changed (trails, tracks, emblems). Say what was checked and left unchanged only where it matters. The orchestrator reads and edits it.
|
||||
|
||||
## The hard part
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
name: Places
|
||||
|
||||
# The monthly check that every record's places still match the published outlines. It downloads
|
||||
# the current outlines, measures every track again and fails with the list of differences.
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 6 1 * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/longhikes-places
|
||||
key: places-outlines-${{ github.run_id }}
|
||||
restore-keys: |
|
||||
places-outlines-
|
||||
- run: pip install -r tools/place_trails.requirements.txt
|
||||
- run: python tools/place_trails.py --check
|
||||
+3
-2
@@ -16,8 +16,9 @@ Issues and pull requests are taken at https://github.com/swaits/longhikes. That
|
||||
2. Keep every field name in `trail.toml` (see docs/schema.md). Say in the commit message which fields changed and why.
|
||||
3. If you change a track, name its source and licence. A track may only be included when its source's terms allow redistribution. United States federal data is public domain. OpenStreetMap data is ODbL and needs the credit "© OpenStreetMap contributors". A track whose holder, author or recorder has stated in writing that it may be shared, without naming a licence, uses `licence = "stated-permission"`: quote the statement exactly in `source.licence_text`, say who made it (by role), where (a page or issue address) and when. It is not public domain or Creative Commons, and nothing may present it as either. If a publisher's own track may not be passed on, do not include it: keep the record, use an OpenStreetMap track if one is already recorded for the trail, or include no track and say why in `source.line_absent_reason`.
|
||||
4. Update `release.txt` when track files change: source, licence, and the date read.
|
||||
5. Add an entry at the end of the record's `[[history]]`: the date, what changed, the fields, the page it was read on, who asked (by role, never a private person's name) and the outcome. See "History and conflicts" below.
|
||||
6. Rebuild the generated files and check everything:
|
||||
5. A new record, or one with a new track, needs its places: the validator fails a record with no `places_checked`. With a track, run `tools/place_trails.py` (its libraries are listed in `tools/place_trails.requirements.txt`); with none, name the page that puts the trail in each park, range or wilderness area, and use `place_trails.py stated`, or `place_trails.py stamp` when it is in none.
|
||||
6. Add an entry at the end of the record's `[[history]]`: the date, what changed, the fields, the page it was read on, who asked (by role, never a private person's name) and the outcome. See "History and conflicts" below.
|
||||
7. Rebuild the generated files and check everything:
|
||||
|
||||
```bash
|
||||
python3 tools/build_index.py
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# The monthly audit of everything
|
||||
|
||||
A written checklist for the owner. It does not repeat the refresh runbook; it points at it. Work
|
||||
down the list in order and stop at the first step that fails.
|
||||
|
||||
1. **Refresh the records.** Run `/refresh-trails` (the full run once a quarter, `light` in the
|
||||
months between). It verifies every record against the pages it cites, re-checks the left-out
|
||||
list, looks for missing trails and updates tracks and emblems. The runbook is
|
||||
`.claude/skills/refresh-trails/SKILL.md`; this checklist adds to it and does not replace it.
|
||||
2. **Check the links.** `python3 tools/refresh.py links` lists every address a record cites that
|
||||
no longer answers. Fix each one in a record with a history entry.
|
||||
3. **Validate the data.** `python3 tools/validate.py` must end `OK <n> trails`. It fails a record
|
||||
with no `places_checked`, and one whose track has changed since its places were measured.
|
||||
4. **Check the history.** `python3 tools/check_history.py --base origin/main` must end
|
||||
`OK history`. A changed fact needs a new history entry.
|
||||
5. **Run both test suites.** `python3 -m unittest discover tools/tests` and
|
||||
`python3 -m unittest discover -s web/tests` must both pass.
|
||||
6. **Check the places.** `python3 tools/place_trails.py --check` downloads the current outlines,
|
||||
measures every track again and prints each difference from the records, one per line:
|
||||
- a place gained or lost by a trail: re-run `place_trails.py propose`, read the line, and
|
||||
apply it only when the new outline is right;
|
||||
- a boundary that moved (a new source version): the owner rules whether the new outline
|
||||
replaces the old one;
|
||||
- a place that crossed the 3-trail line: its page appears or goes, so check its links and the
|
||||
counts that name it.
|
||||
The monthly workflow `.github/workflows/places.yml` runs this step by itself and fails with
|
||||
the list; this step is the one you run when it has failed, and before a release.
|
||||
7. **Review the `stated` placements by hand.** A trail with no track is placed from a page, and no
|
||||
tool can measure that again. For each record with a place whose `basis` is `stated`, open the
|
||||
cited page again and confirm that it still names the trail in that place. The date of the last
|
||||
look is the record's `places_checked`; set it again when you have looked, and add a history
|
||||
entry when a placement changes.
|
||||
8. **Build the site** with `python3 web/build.py --out _site` and read the places page, one park
|
||||
page, one range page and one wilderness page.
|
||||
@@ -26,7 +26,7 @@ HASH_RE = re.compile(r"[0-9a-f]{16}")
|
||||
|
||||
# Ship 1 validates shape only. Ship 2 turns this on once every record is placed,
|
||||
# so a new trail or a new track cannot ship unplaced.
|
||||
REQUIRE_PLACES_CHECKED = False
|
||||
REQUIRE_PLACES_CHECKED = True
|
||||
|
||||
|
||||
def track_hash(path):
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
"""The audit checklist, the monthly places workflow and the pieces that point at them."""
|
||||
import os
|
||||
import re
|
||||
import unittest
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
|
||||
def text_of(*parts):
|
||||
with open(os.path.join(ROOT, *parts), encoding="utf-8") as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
class AuditDocTest(unittest.TestCase):
|
||||
def test_every_record_must_have_places_checked_now(self):
|
||||
import sys
|
||||
sys.path.insert(0, os.path.join(ROOT, "tools"))
|
||||
import check_places
|
||||
self.assertTrue(check_places.REQUIRE_PLACES_CHECKED)
|
||||
|
||||
def test_the_audit_checklist_exists_and_names_each_step(self):
|
||||
doc = text_of("docs", "audit.md")
|
||||
for needle in ("/refresh-trails", "python3 tools/refresh.py links",
|
||||
"place_trails.py --check", "python3 tools/validate.py",
|
||||
"python3 tools/check_history.py",
|
||||
"python3 -m unittest discover tools/tests",
|
||||
"python3 -m unittest discover -s web/tests",
|
||||
"stated", "by hand"):
|
||||
self.assertIn(needle, doc)
|
||||
|
||||
def test_the_monthly_workflow_runs_the_check_and_installs_only_the_tool_requirements(self):
|
||||
wf = text_of(".github", "workflows", "places.yml")
|
||||
self.assertIn("schedule", wf)
|
||||
self.assertIn("cron", wf)
|
||||
self.assertIn("tools/place_trails.requirements.txt", wf)
|
||||
self.assertIn("place_trails.py --check", wf)
|
||||
self.assertNotIn("pip install", text_of(".github", "workflows", "validate.yml"))
|
||||
|
||||
def test_the_apply_brief_places_new_records(self):
|
||||
self.assertIn("place_trails.py", text_of(".claude", "skills", "refresh-trails", "briefs", "apply.md"))
|
||||
|
||||
def test_the_skill_and_contributing_point_at_the_places(self):
|
||||
self.assertIn("docs/audit.md", text_of(".claude", "skills", "refresh-trails", "SKILL.md"))
|
||||
self.assertIn("place_trails.py", text_of("CONTRIBUTING.md"))
|
||||
|
||||
def test_docs_audit_keeps_the_house_wording(self):
|
||||
body = re.sub(r"```.*?```", "", text_of("docs", "audit.md"), flags=re.S)
|
||||
self.assertNotIn("—", body)
|
||||
self.assertNotIn("–", body)
|
||||
self.assertIsNone(re.search(r"\S - \S", body))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user