Repository navigation
Commit f16c01e
fix(console): the docs portal's book sidebar keeps a doc placed by its own
Fixes #11245
Clause-②: no
## What
`scopeDocsToBook` in `apps/console/src/pages/book-nav.ts` now keeps a
doc whose own `group` names one of the book's group keys, whatever
package the doc lives in. Everything else about the scoping step is
unchanged. When the book declares a package, docs from other packages
are still dropped before resolving, so they never reach the synthetic
Uncategorized group or an `include` rule. `include` is still scoped by
the local `resolveBookTree` port itself, to `group.package` or else the
book's package. `resolveBookTree`, `homeBook` and the direct-route
refusal are not touched. There is no new helper. `DocPage.tsx`,
`BookPage.tsx` and `countBookDocs` pick up the fix through the helper
they already call.
## Why
The spec's `resolveBookTree` (`packages/spec/src/system/book.zod.ts` in
objectstack, byte-identical at the `@objectstack/spec@17.5.0` tag this
repo installs and on objectstack `main`) places a doc in a group by
`d.group === group.key` with no package scope. `GET
/meta/book/:name/tree` answers that resolver over every doc
(`createMetaBookTreeAnswer` → `readableTree`, with `bookPackage =
book._packageId`). The portal dropped the doc before resolving, so a doc
an admin placed from the doc editor was listed by the endpoint and
missing from the sidebar.
## Measured (the order's Zone 2)
These readings come from a scratch suite that ran the port and the spec
resolver on the same fixtures. The suite was not committed.
1. **Red first.** Before the fix, through `scopeDocsToBook` → port, the
book gave `start=[docprobe_gs_welcome] reference=[]`. The spec resolver
on the endpoint's inputs gave `reference=[live_guide,probe_curl]`. After
the fix the two agree.
2. **The port's own scope. The PM's assumption is partly falsified.**
With the scope passed and no pre-filter, the port matches the spec on
the explicit-`group` leg. But neither the port nor the spec scopes the
orphan catch-all. Both put another package's ungrouped doc into
Uncategorized: `uncategorized=[other_note]` from each. So "stop
pre-filtering and pass the scope" would break the ruled control. The fix
therefore keeps the pre-filter and lets explicit members through it, as
the ruling words it: "`scopeDocsToBook` keeps any doc whose `group`
names one of the book's group keys". The portal's scoped Uncategorized
is a deliberate, ruled narrowing of the endpoint's. The pins compare the
**authored** groups with the spec's answer.
3. **Group-level `package` override.** In both resolvers the override
**replaces** the book's scope for that group's `include`; it does not
add to it. Fixture: `own` gets only package a, `ext` gets package b
through `include` plus c_1 through its own `group`. The portal's answer
equals the spec's, and one pin holds it.
4. **`homeBook` / `findBookContainingDoc`.** Nothing changes for a book
that carries a stamped `packageId`. `homeBook` keeps only books of the
doc's own package, and that package is already in scope for them. One
edge case moves. The book must carry no stamped `packageId`, its name
prefix must equal the doc's package, and its only package must be a
group `package` override. If such a doc names one of that book's groups,
it is now claimed by that book. `homeBook` then answers that book
instead of the package's first book (the measured fixture moved from
`q_other` to `q_manual`). That follows `homeBook`'s documented rule (the
home is the book that claims the doc), and `homeBook` was not changed.
Divergences beyond the explicit-`group` leg, reported and not widened:
- **An unstamped doc under a scoped `include`.** The spec admits a doc
with no `packageId` into any scoped `include`. The port falls back to
the name prefix (`pkgOf`) and refuses it. Measured: port `all=[x_a]`,
spec `all=[x_a,y_unstamped]`.
- **A `pages` pin naming a doc from another package.** The pre-filter
drops that doc's header, so the entry keeps its place but loses its
label and description. Measured: port `{"doc":"c_9"}`, spec
`{"doc":"c_9","label":"C9 Label"}`.
## Tests
- `book-nav.explicitGroup-11245.test.ts`: the explicit member is listed
in the group it names; the authored groups equal the spec resolver's
answer (`@objectstack/spec/system`) for the same docs; `countBookDocs`
counts it; the group-override case; control: another package's ungrouped
doc, and one naming a key the book lacks, stay out, with no
Uncategorized.
- `docs-portal.explicitGroup-11245.test.tsx` renders through the real
route table. The Reference group of the rendered sidebar links the
placed doc, and marks it current when reading it. A book whose only
member is placed that way opens to it instead of "This book has no
documents yet". Control: another package's ungrouped doc is absent from
the sidebar.
- **Reverse verification**, run from the committed fix through
`ablation-replace.mjs` with a disk-verified mutation and restore:
- Drop the explicit-member leg: 7 of the 9 new tests go red and both
controls stay green.
- Drop the package filter entirely: both new controls go red, plus three
existing `docs-portal.test.tsx` cases (that is the existing pin the
triage names).
- Each restore was proven by blob equal to HEAD and an empty `git diff
HEAD`.
Gate verdicts and the head they ran on are in the `os-dev-report`
comment on the card.
## Acceptance notes
- `homeBook` edge case (reading 4 above): the canonical URL moves for a
doc placed into an own-package book that has no stamped `packageId` and
a group-level `package` override.
- The two port divergences above: `pkgOf` falls back to the name prefix
on an unstamped doc, and a `pages` pin from another package loses its
label. Carrier: none.
- A common group key such as `reference` places a doc in every book that
has a group with that key. The spec resolver and the tree endpoint do
the same; the pins do not cover it.
---
_Generated by [Claude
Code](https://claude.ai/code/session_0122Knsowci76D2rBWReCzzZ)_
Co-authored-by: Claude <noreply@anthropic.com>group key from outside the book's package (objectui#11245) (#11274)1 parent f3135a4 commit f16c01e
4 files changed
Lines changed: 291 additions & 1 deletion
File tree
- .changeset
- apps/console/src/pages
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
Lines changed: 121 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
316 | 324 | | |
317 | 325 | | |
318 | 326 | | |
319 | 327 | | |
320 | | - | |
| 328 | + | |
| 329 | + | |
321 | 330 | | |
322 | 331 | | |
323 | 332 | | |
| |||
Lines changed: 142 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
0 commit comments