Skip to content

Commit 0587ce8

Browse files
docs: the agents page is part of the public API, and one shared copy-page script (#63)
1 parent f849a6f commit 0587ce8

5 files changed

Lines changed: 33 additions & 9 deletions

File tree

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
- [ ] Tests added or updated
1616
- [ ] `make check` passes locally (`ruff` + `mypy`)
1717
- [ ] `CHANGELOG.md` updated under `[Unreleased]`
18-
- [ ] Documentation updated (if the public API changed)
18+
- [ ] Documentation updated (if the public API changed), `docs/agents.md` included
1919

2020
## Related issues
2121

‎CONTRIBUTING.md‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,26 @@ Breaking changes: add `!` after the type (`feat!:`) or include a `BREAKING CHANG
5454

5555
Update `CHANGELOG.md` under `[Unreleased]` for any user-visible change.
5656

57+
## The agents page
58+
59+
`docs/agents.md` is the whole library on one page, written for a coding assistant: the
60+
public API, the rules that break code when they are broken, the mistakes models make, and
61+
a map of which page to fetch for the rest. People hand it to an assistant instead of the
62+
site, which is what makes a stale one worse than none — it teaches a model an API that no
63+
longer exists.
64+
65+
It is part of the public API, so it changes in the same pull request the API does: a name
66+
added, renamed or removed, a changed default or signature, a new rule a caller has to
67+
obey. A new docs page means a new row in the documentation map. The review check is
68+
mechanical — if the diff changes the public surface and `docs/agents.md` is untouched, the
69+
pull request is not finished.
70+
71+
The page carries its own weight only if it stays fetchable as text. Every page of the site
72+
is written a second time as raw Markdown next to its HTML by `scripts/emit_markdown.py`,
73+
which the Docs workflow runs after the build; the **Copy page** control above each page
74+
reads those files. A page whose Markdown would not read as the page — the generated API
75+
reference — declines both with `copy_page: false` in its front matter.
76+
5777
## Integration tests
5878

5979
Integration tests use [testcontainers](https://testcontainers.com/) to spin up a real

‎docs/agents.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ Nesting is `child=`, up to five levels including the root.
230230

231231
| Axis | Constructor |
232232
|---|---|
233-
| Calendar over a timestamp | `TimeBoundaries(granularity=… \| calculator=…, tz="UTC", codec=None)` |
233+
| Calendar over a timestamp | `TimeBoundaries(granularity=… | calculator=…, tz="UTC", codec=None)` |
234234
| Calendar over an encoded key | the same, with `codec=UUIDv7BoundaryCodec()` or `EpochBoundaryCodec(unit)` |
235235
| Fixed-width integer windows | `NumericBoundaries(step, origin=0, name_suffix="__{start}", cursor_source=…)` |
236236
| One value per partition | `IntegerSequence(start=1, name_suffix="__{value}", cursor_source=…)` |
@@ -268,12 +268,12 @@ Every method takes the `TablePartitionConfig` as its first argument.
268268

269269
| Method | Lock | DDL | Returns |
270270
|---|---|---|---|
271-
| `inspect(config)` | no | no | `ActualTree \| None` |
271+
| `inspect(config)` | no | no | `ActualTree | None` |
272272
| `plan(config, *, mode=PlanMode.MAINTAIN, now=None, windows=None)` | no | no | `MaintenancePlan` |
273273
| `apply(config, plan, *, continue_on_error=False, allow_config_drift=False)` | **yes** | yes | `MaintenanceResult` |
274274
| `maintain(config, *, skip_create=False, skip_detach=False, skip_drop=False, continue_on_error=False)` | **yes** | yes | `MaintenanceResult` |
275275
| `reconcile(config)` | no | yes | `MaintenanceResult` |
276-
| `ensure_partition(config, period_or_window_or_position)` | no | yes | `PartitionInfo \| None` |
276+
| `ensure_partition(config, period_or_window_or_position)` | no | yes | `PartitionInfo | None` |
277277
| `ensure_partitions(config, periods)` | no | yes | `list[PartitionInfo]` |
278278
| `partition_data(config, *, batch_rows=10_000, max_batches=None)` | **yes** | yes | `MigrationResult` |
279279
| `unpartition(config, into, *, batch_rows=10_000, max_batches=None, drop_emptied=False)` | **yes** | yes | `MigrationResult` |

‎docs/assets/javascripts/copy-page.js‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99

1010
var RESET_AFTER_MS = 2000;
1111

12-
/* Where the Markdown of a page is written, as an absolute URL. The pair of
13-
data attributes says how far the site root is from here and where this
14-
page sits below it; scripts/emit_markdown.py writes the file to match. */
12+
/* Where the Markdown of a page is written, as an absolute URL. Two data
13+
attributes say how far the site root is from here and where this page sits
14+
below it; scripts/emit_markdown.py writes the file to match. The site's own
15+
name is a third, so this file is the same in every project that carries it. */
1516
function markdownUrl(widget) {
1617
var base = (widget.dataset.copyBase || ".").replace(/\/$/, "");
1718
var page = widget.dataset.copyPage || "";
@@ -21,12 +22,15 @@
2122

2223
function prompt(widget) {
2324
var title = widget.dataset.copyTitle || document.title;
25+
var site = widget.dataset.copySite || "project";
2426
return (
2527
"Read " +
2628
markdownUrl(widget) +
2729
' -- the "' +
2830
title +
29-
'" page of the pg-partsmith documentation -- so I can ask questions about it.'
31+
'" page of the ' +
32+
site +
33+
" documentation -- so I can ask questions about it."
3034
);
3135
}
3236

‎overrides/main.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
with `copy_page: false` in its front matter. -#}
1212
{% if page.meta.copy_page != false %}
1313
<div class="md-copy-page" data-copy-base="{{ base_url }}" data-copy-page="{{ page.url }}"
14-
data-copy-title="{{ page.title }}">
14+
data-copy-title="{{ page.title }}" data-copy-site="{{ config.site_name }}">
1515
<div class="md-copy-page__group">
1616
<button type="button" class="md-copy-page__button md-copy-page__button--main" data-copy-action>
1717
<span class="md-copy-page__icon md-copy-page__icon--idle">

0 commit comments

Comments
 (0)