Skip to content

fix(kb): align populate-kb.ts seed entries with canonical documentation#157

Merged
Looted merged 2 commits intodevelopfrom
copilot/sub-pr-156
Apr 22, 2026
Merged

fix(kb): align populate-kb.ts seed entries with canonical documentation#157
Looted merged 2 commits intodevelopfrom
copilot/sub-pr-156

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

Three seed entries in scripts/populate-kb.ts conflicted with their canonical documentation counterparts, making KB state nondeterministic depending on whether the script or the doc-sync ran last.

Changes

  • SCEN-001: was seeding a different title/status/tags than documentation/scenarios/SCEN-001.md; aligned to the doc file ("Critical Feature Scenario", active, ["critical"])
  • ADR-002: was describing an entirely different decision ("Use Bun/Node.js as CLI wrapper around SWI-Prolog subprocess") vs the canonical doc ("Public API exports via re-export modules"); aligned title, source, and tags to documentation/adr/ADR-002.md
  • FLAG-001: seeded status: "inactive" while documentation/flags/FLAG-001.md declares status: active; corrected to "active"

All three seed entries now mirror their canonical markdown sources, so the upsert is idempotent regardless of execution order.

- SCEN-001: align title/status/source/tags with documentation/scenarios/SCEN-001.md
- ADR-002: align title/source/tags with documentation/adr/ADR-002.md
- FLAG-001: fix status inactive→active to match documentation/flags/FLAG-001.md

Ensures KB state is deterministic regardless of script vs doc sync order.

Agent-Logs-Url: https://github.com/Looted/kibi/sessions/60eb6884-c2bc-4d26-ac93-22118435c2dc

Co-authored-by: Looted <6255880+Looted@users.noreply.github.com>
Copilot AI changed the title [WIP] Enhance briefing contracts and improve logging for sync failures fix(kb): align populate-kb.ts seed entries with canonical documentation Apr 22, 2026
Copilot AI requested a review from Looted April 22, 2026 08:40
@Looted Looted marked this pull request as ready for review April 22, 2026 09:02
Copilot AI review requested due to automatic review settings April 22, 2026 09:02
@Looted Looted merged commit 392d6d0 into develop Apr 22, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns a few scripts/populate-kb.ts seed entities with their canonical markdown documentation to reduce nondeterministic KB state when seeding vs doc-sync run in different orders.

Changes:

  • Updated ADR-002 seed title/source/tags to match documentation/adr/ADR-002.md
  • Updated FLAG-001 seed status to match documentation/flags/FLAG-001.md
  • Updated SCEN-001 seed title/status/source/tags to match documentation/scenarios/SCEN-001.md

Comment thread scripts/populate-kb.ts
Comment on lines 346 to 353
type: "scenario",
id: "SCEN-001",
properties: {
title: "Agent queries requirements from KB via MCP kb_query tool",
status: "passing",
source: "scripts/populate-kb.ts",
tags: ["mcp", "query", "agent"],
title: "Critical Feature Scenario",
status: "active",
source: "documentation/scenarios/SCEN-001.md",
tags: ["critical"],
},
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation/scenarios/SCEN-001.md includes created_at/updated_at and multiple links (which become relationships). This seed upsert does not include timestamps or relationships, and entity upsert retracts all triples for the entity URI; if populate-kb.ts runs after doc-sync it can wipe SCEN-001’s outgoing relationships and replace canonical timestamps with new defaults. To make execution order truly idempotent, seed the canonical timestamps and the relationships derived from links (or change the upsert flow to preserve existing timestamps/relationships when updating).

Copilot uses AI. Check for mistakes.
Comment thread scripts/populate-kb.ts
status: "inactive",
status: "active",
source: "documentation/flags/FLAG-001.md",
tags: ["vscode", "deferred", "post-v0"],
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FLAG-001 still doesn’t mirror the canonical markdown: documentation/flags/FLAG-001.md uses tags [vscode, deferred, graph], but this seed uses [vscode, deferred, post-v0]. Since entity upsert retracts and rewrites all properties, running this script after doc-sync will overwrite the doc-derived tags and keep KB state order-dependent. Align the tags (and any other canonical fields you intend to preserve) with the markdown source.

Suggested change
tags: ["vscode", "deferred", "post-v0"],
tags: ["vscode", "deferred", "graph"],

Copilot uses AI. Check for mistakes.
Comment thread scripts/populate-kb.ts
Comment on lines 176 to 183
type: "adr",
id: "ADR-002",
properties: {
title: "Use Bun/Node.js as CLI wrapper around SWI-Prolog subprocess",
title: "Public API exports via re-export modules",
status: "accepted",
source: "scripts/populate-kb.ts",
tags: ["cli", "bun", "nodejs"],
source: "documentation/adr/ADR-002.md",
tags: ["architecture", "publishing", "exports"],
},
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with the title/source/tags aligned, this seed entry will still overwrite canonical metadata from documentation/adr/ADR-002.md (e.g., created_at/updated_at) because handleKbUpsert fills missing timestamps and the Prolog upsert retracts all existing triples for the entity before re-asserting. If the goal is execution-order idempotence vs doc-sync, include the canonical timestamps (and any other fields you want preserved) in the seeded properties, or adjust the upsert path to preserve existing created_at on updates.

Copilot uses AI. Check for mistakes.
@Looted Looted deleted the copilot/sub-pr-156 branch April 24, 2026 12:44
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.

3 participants