fix: comparison and source pages accept the sources: cite add writes; sources may cite sources (#173)
CI / verify (push) Successful in 5m20s
CI / pwsh (push) Successful in 2m2s
Release / release (push) Successful in 36s

Files changed:
- CHANGES.md
- VERSION
- instructions/wiki-ingest/SKILL.md
- kb/CONTRACT.md
- tools/CONTRACT.md
- tools/chemenu/commands/cite_cmd.py
- tools/chemenu/commands/xref.py
- tools/chemenu/tests/test_cite_cmd.py
- tools/chemenu/tests/test_page_ops.py
- tools/chemenu/tests/test_type_resolver.py
- tools/chemenu/tests/test_xref.py
- types/comparison.md
- types/comparison.schema.yaml
- types/source.md
- types/source.schema.yaml

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SnAJ7Z3CpVD3PRbN73QtU2
This commit is contained in:
torbenandClaude Opus 5.5 committed 2026-10-04 21:35:24 +02:00
1 parent 662a844cf1
commit 862bc04d9c
15 files changed
+310 -19

No files matched your search

+42 -1
View File
@@ -59,7 +59,7 @@ concern - readable here, never shipped as something to parse.
---
## 8.0.0-beta.39 - 2026-10-04 - wiki-ingest and wiki-manage call xref add with --rel, not the --rel-a/--rel-b removed in 4.0.0
## 8.0.0-beta.40 - 2026-10-04 - Comparison and source pages accept the sources: that cite add writes; sources may cite sources
**Author:** Torben Nehmer
@@ -107,6 +107,7 @@ concern - readable here, never shipped as something to parse.
- Link-Katalog: Beteiligungs- und RACI-Label von der Projektseite aus
- Organisationsseiten: Personen als Abschnitt mit Aufstieg, entity_type organization, member-of, Lint-Befund broken_anchors
- lint: Unfilled Template Sections - a section still holding only its template's TODO placeholders (advisory)
- Comparison and source pages accept the sources: that cite add writes; sources may cite sources
**Low impact**
- version bump no longer points at version release in its output
@@ -152,6 +153,46 @@ concern - readable here, never shipped as something to parse.
- wiki-ingest and wiki-manage call xref add with --rel, not the --rel-a/--rel-b removed in 4.0.0
<!-- /wikitool:bumps -->
### Comparison and source pages accept the sources: that cite add writes; sources may cite sources
`cite add` writes the cited source into the page's `sources:`, but neither the `comparison` nor
the `source` type declared that field, and both schemas set `additionalProperties: false`. So a
comparison page cited the way `kb/comparisons/COLLECTION.md` asks for, or a source page citing one
of its own raw files with `--file`, failed `lint` with `'sources' was unexpected`. Both types now
declare `sources` as an optional array, in the schema and in `page_ref_fields:`. The second part
matters: `rename`/`rm` carry only declared reference fields, and `lint` resolves only declared
fields. A fix to the schema alone would leave dead `sources:` entries behind after a source is
renamed, and nothing would report them.
That also makes a citation between two sources legal: `cite add --page "Source - A" --source
"Source - B"` records `Source - B` on A and leaves B alone. Two changes keep that edge directed:
- `cite add` no longer writes a page's own title into its `sources:`. A source page citing its own
raw file gets the footnote definition and leaves `sources:` untouched, not even as an empty
list. `lint` and `citing_pages()` already ignored the self-edge.
- `xref link-source` refuses a target that is itself a source page. It writes nothing for that
target, names it with the `cite add` command to use instead, links the others and exits 1. It
used to write `B.sources += A`, claiming the citation in the wrong direction, onto a page whose
schema then rejected it.
`kb/CONTRACT.md` § Provenance and citation and `wiki-ingest` step 9 describe both.
**What an existing instance has to do by hand.** The schema and type-spec of `comparison` and
`source` belong to the instance once adopted. `dist upgrade` only renews the `.template` beside
them, so the type half of this change does not arrive on its own. For each of the two types:
1. Copy the `sources` property from `types/<type>.schema.yaml.template` into
`types/<type>.schema.yaml`.
2. Add `sources` to `page_ref_fields:` in `types/<type>.md`. Without it a rename leaves the
entries pointing at the old title.
3. Copy the `sources` row of the frontmatter table into the same file.
An instance that has already loosened only the schema still needs step 2. The `cite add` and
`link-source` changes are under `tools/` and arrive with the normal upgrade. Until the steps
are done, `lint` keeps reporting a cited comparison or source page as a schema error, exactly as
before. Nothing that worked before breaks. Found while writing the first comparison page of an
instance on 7.0.0 (Gitea #173).
### wiki-ingest and wiki-manage call xref add with --rel, not the --rel-a/--rel-b removed in 4.0.0
Since 4.0.0 `xref add` declares one directed edge and takes a single `--rel`, but the