Skip to content
This repository was archived by the owner on Jul 24, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 159 additions & 0 deletions data/overview-concept-link-exceptions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
"version": 1,
"exceptions": [
{
"bookSlug": "before-certainty-arrives",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"patternIds": "*"
},
{
"bookSlug": "boundary-conditions",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": "*",
"patternIds": "*"
},
{
"bookSlug": "how-trust-forms",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": ["concept-feedback", "concept-formation", "concept-provisional-commitment"],
"patternIds": "*"
},
{
"bookSlug": "learning-to-see",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": [
"concept-attention",
"concept-humility",
"concept-judgment",
"concept-uncertainty",
"concept-inheritance",
"concept-formation"
],
"patternIds": "*"
},
{
"bookSlug": "living-in-sediment",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": [
"concept-inheritance",
"concept-drift",
"concept-structure",
"concept-compression"
],
"patternIds": "*"
},
{
"bookSlug": "observer-patterns",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": "*",
"patternIds": "*"
},
{
"bookSlug": "the-discipline-of-uncertainty",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": [
"concept-uncertainty",
"concept-certainty",
"concept-revisability",
"concept-humility"
],
"patternIds": "*"
},
{
"bookSlug": "the-economy-we-dont-experience",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": ["concept-compression"],
"patternIds": "*"
},
{
"bookSlug": "the-game-we-think-we-saw",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"patternIds": "*"
},
{
"bookSlug": "the-world-we-make-together",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": "*",
"patternIds": "*"
},
{
"bookSlug": "velorum",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": "*",
"patternIds": "*"
},
{
"bookSlug": "when-accountability-no-longer-expires",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": [
"concept-accountability",
"concept-renewal",
"concept-harm",
"concept-adaptability"
],
"patternIds": "*"
},
{
"bookSlug": "when-authority-is-misread",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"patternIds": "*"
},
{
"bookSlug": "when-authority-outlives-accountability",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": ["concept-effectiveness", "concept-accountability", "concept-harm"],
"patternIds": "*"
},
{
"bookSlug": "when-incentives-become-the-moral-language",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": ["concept-incentives", "concept-judgment", "concept-residue"],
"patternIds": "*"
},
{
"bookSlug": "when-interpretation-no-longer-matters",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"patternIds": "*"
},
{
"bookSlug": "when-moral-seriousness-scales",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": [
"concept-moral-density",
"concept-scale",
"concept-asymmetry",
"concept-acceleration",
"concept-reciprocity"
]
},
{
"bookSlug": "when-others-become-leaders",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": "*",
"patternIds": "*"
},
{
"bookSlug": "when-others-look-to-you-v2",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": ["concept-renewal", "concept-circulation", "concept-formation"],
"patternIds": "*"
},
{
"bookSlug": "when-trust-stops-tracking-reality",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": ["concept-drift", "concept-momentum"],
"patternIds": "*"
},
{
"bookSlug": "why-collaboration-is-so-hard",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"patternIds": "*"
},
{
"bookSlug": "why-diversity-matters",
"reason": "Orientation overview selects graph entities not yet linked on the book row; awaiting upstream books[].concepts / books[].patterns backfill.",
"conceptIds": "*",
"patternIds": "*"
}
]
}
58 changes: 46 additions & 12 deletions docs/contributing-book-overviews.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,52 @@ Site presentation overlays that stay here:

## What belongs upstream

| Field | Notes |
| ----------------------------- | ----------------------------------------------- |
| `centralQuestion` | One sentence visitors should understand first |
| `whyItExists` | Why this book is in the project |
| `audience` | Who it is for |
| `nonGoals` | 1–6 short “this is not…” lines |
| `selectedConcepts` / ids | Prefer concepts already linked on that book |
| `selectedPatterns` / ids | Optional |
| `readBefore` / `readNext` | Optional book **slugs**; companions OK; no self |
| `revisedAt` + `changeSummary` | Pair both or neither |

**Do not** put CTA preference, badge colors, or layout limits in content YAML.
| Field | Notes |
| ----------------- | --------------------------------------------- |
| `centralQuestion` | One sentence visitors should understand first |
| `whyItExists` | Why this book is in the project |
| `audience` | Who it is for |
| `nonGoals` | 1–6 short “this is not…” lines |

## Selected concepts and patterns

Prefer concepts and patterns already linked on `books[].concepts` /
`books[].patterns` in the semantic manifest.

By default the site treats overview selections that are **not** linked on the
book row as integrity **errors**:

- `concept_not_on_book` / `concepts_selected_on_empty_book`
- `pattern_not_on_book` / `patterns_selected_on_empty_book`

Unknown concept or pattern ids remain hard errors (no exception path).

### Intentional exceptions

When an orientation overlay must temporarily surface glossary entities before
upstream backfill, add a documented exception in
[`data/overview-concept-link-exceptions.json`](../data/overview-concept-link-exceptions.json):

```json
{
"version": 1,
"exceptions": [
{
"bookSlug": "observer-patterns",
"conceptIds": "*",
"patternIds": "*",
"reason": "Orientation overview pending books[].concepts / patterns backfill upstream."
}
]
}
```

- `conceptIds` / `patternIds`: explicit ids, or `"*"` for any selection on that book
- Excepted mismatches become **warnings** (`*_excepted`) with the reason attached
- Unused exceptions (no longer needed after backfill) emit `unused_link_exception` warnings — remove them
- Exception book/concept/pattern references that do not exist are **errors**

Do not use exceptions to hide broken public routes or unknown ids.

Upstream authoring: [after-certainty `docs/authoring-discovery-metadata.md`](https://github.com/ksteffe/after-certainty/blob/main/docs/authoring-discovery-metadata.md).

Expand Down
5 changes: 5 additions & 0 deletions docs/semantic-manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ questions, and front-shelf doorways for cross-feature consistency.
Document deliberate exclusions as **warnings** in domain validators (search /
sitemap SEO choices, upcoming items). Do not silence broken public routes.

Overview↔book concept/pattern link mismatches are **errors** by default. Temporary
orientation exceptions live in
[`data/overview-concept-link-exceptions.json`](../data/overview-concept-link-exceptions.json)
— see [`docs/contributing-book-overviews.md`](contributing-book-overviews.md).

## Legacy manifest consumers

| Item | Status |
Expand Down
35 changes: 35 additions & 0 deletions lib/books/overview-link-exceptions.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { describe, expect, it } from "vitest";

import {
exceptionAllowsConcept,
exceptionAllowsPattern,
indexOverviewLinkExceptions,
parseOverviewLinkExceptions,
} from "@/lib/books/overview-link-exceptions";

describe("overview-link-exceptions", () => {
it("rejects invalid exception files", () => {
expect(() => parseOverviewLinkExceptions({ version: 2, exceptions: [] })).toThrow();
expect(() =>
parseOverviewLinkExceptions({
version: 1,
exceptions: [{ bookSlug: "Bad_Slug", reason: "x" }],
}),
).toThrow();
});

it("matches wildcard and explicit concept/pattern allowances", () => {
const bySlug = indexOverviewLinkExceptions([
{
bookSlug: "observer-patterns",
conceptIds: "*",
patternIds: ["pattern-attention-finds-a-focus"],
reason: "test",
},
]);
const ex = bySlug.get("observer-patterns");
expect(exceptionAllowsConcept(ex, "concept-anything")).toBe(true);
expect(exceptionAllowsPattern(ex, "pattern-attention-finds-a-focus")).toBe(true);
expect(exceptionAllowsPattern(ex, "pattern-other")).toBe(false);
});
});
72 changes: 72 additions & 0 deletions lib/books/overview-link-exceptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { z } from "zod";

import exceptionsFile from "@/data/overview-concept-link-exceptions.json";

const allowAllOrIds = z.union([z.literal("*"), z.array(z.string().min(1)).min(1)]);

export const overviewLinkExceptionSchema = z.object({
bookSlug: z
.string()
.min(1)
.regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
/** Concept ids allowed off-book, or `*` for any selected concepts on this book. */
conceptIds: allowAllOrIds.optional(),
/** Pattern ids allowed off-book, or `*` for any selected patterns on this book. */
patternIds: allowAllOrIds.optional(),
/** Human-readable justification shown in integrity warnings. */
reason: z.string().min(1),
});

export const overviewLinkExceptionsFileSchema = z.object({
version: z.literal(1),
exceptions: z.array(overviewLinkExceptionSchema),
});

export type OverviewLinkException = z.infer<typeof overviewLinkExceptionSchema>;

export type OverviewLinkExceptionsConfig = z.infer<typeof overviewLinkExceptionsFileSchema>;

export function parseOverviewLinkExceptions(data: unknown): OverviewLinkExceptionsConfig {
return overviewLinkExceptionsFileSchema.parse(data);
}

/** Bundled intentional exceptions for overview↔book concept/pattern link mismatches. */
export function getOverviewLinkExceptions(): readonly OverviewLinkException[] {
return parseOverviewLinkExceptions(exceptionsFile).exceptions;
}

export function exceptionAllowsConcept(
exception: OverviewLinkException | undefined,
conceptId: string,
): boolean {
if (!exception?.conceptIds) return false;
if (exception.conceptIds === "*") return true;
return exception.conceptIds.includes(conceptId);
}

export function exceptionAllowsAnyConcepts(exception: OverviewLinkException | undefined): boolean {
return exception?.conceptIds === "*" || (exception?.conceptIds?.length ?? 0) > 0;
}

export function exceptionAllowsPattern(
exception: OverviewLinkException | undefined,
patternId: string,
): boolean {
if (!exception?.patternIds) return false;
if (exception.patternIds === "*") return true;
return exception.patternIds.includes(patternId);
}

export function exceptionAllowsAnyPatterns(exception: OverviewLinkException | undefined): boolean {
return exception?.patternIds === "*" || (exception?.patternIds?.length ?? 0) > 0;
}

export function indexOverviewLinkExceptions(
exceptions: readonly OverviewLinkException[],
): Map<string, OverviewLinkException> {
const bySlug = new Map<string, OverviewLinkException>();
for (const entry of exceptions) {
bySlug.set(entry.bookSlug, entry);
}
return bySlug;
}
Loading
Loading