Skip to content

Fix/kb reindex nesting#106

Merged
josealekhine merged 2 commits into
mainfrom
fix/kb-reindex-nesting
May 29, 2026
Merged

Fix/kb reindex nesting#106
josealekhine merged 2 commits into
mainfrom
fix/kb-reindex-nesting

Conversation

@josealekhine
Copy link
Copy Markdown
Member

No description provided.

ctx kb reindex enumerated topics one level deep, so a kb that groups
topics into subfolders (topics/<group>/<slug>/index.md) reindexed to
zero and BLANKED the CTX:KB:TOPICS managed block (observed in the
things-wtf-dr kb after it regrouped 49 topics).

ListTopics now recurses (topic.go + new scan.go): it records every
directory holding a topic index.md, keyed by its slash-separated path
relative to the topics root, and keeps the leaves — a directory whose
index.md sits above nested topics is a group-landing (orientation)
page and is excluded. Flat, grouped, mixed, and arbitrary-depth
layouts all enumerate; a non-existent topics dir still yields the
"no topics yet" placeholder, never an error-blank. RenderBlock is
unchanged: the topics/<slug>/ link template already targets nested
paths, and sorted slashed slugs cluster by group prefix. Per-group
headings would change the managed-block format and are deferred.

The helpers live in scan.go (all-unexported) so topic.go keeps a
single exported ListTopics, per the mixed-visibility convention.

Tests (new): topic_test.go covers flat / grouped / mixed /
group-landing-excluded / deep-nesting / bare-dir / empty /
non-existent; block_test.go covers nested-slug + empty rendering.

Bundled housekeeping (no functional code; inherits this commit's spec
per specs/meta/chores.md's bundling rule):
- Archived 61 completed tasks -> .context/archive/tasks-2026-05-28.md
  and 27 skipped tasks -> tasks-2026-05-28-skipped.md (phase-grouped),
  trimming TASKS.md by ~700 lines (236 open tasks remain).
- Reconciled the shipped-but-open Phase BT ctxctl bootstrap (marked
  done; the separate-module deviation noted), un-blocked the
  lint-style task (ctxctl now exists), and annotated the audit-channel
  Phase 2 parts the ctxctl migration already shipped.

Spec: specs/kb-reindex-nesting.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
@josealekhine josealekhine self-assigned this May 29, 2026
@josealekhine josealekhine merged commit fd934de into main May 29, 2026
16 checks passed
@josealekhine josealekhine deleted the fix/kb-reindex-nesting branch May 29, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant