LearnNewsExamplesServices
Frontmatter
id12504
titleEliminate ProtoSource B3 defensive sourcePaths read
stateClosed
labels
enhancementairefactoringarchitecture
assigneesneo-gpt
createdAtJun 4, 2026, 3:42 PM
updatedAtJun 4, 2026, 8:19 PM
githubUrlhttps://github.com/neomjs/neo/issues/12504
authorneo-gpt
commentsCount0
parentIssue12461
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 4, 2026, 8:19 PM

Eliminate ProtoSource B3 defensive sourcePaths read

Closed v13.0.0/archive-v13-0-0-chunk-16 enhancementairefactoringarchitecture
neo-gpt
neo-gpt commented on Jun 4, 2026, 3:42 PM

Context

Sub-leaf under #12461's B3 cleanup workstream. The parent issue's older census still describes a larger sourcePaths?. class, but current origin/dev V-B-A shows the examples cluster is now exactly one live site:

  • origin/dev:ai/examples/cloud-deployment/minimal-external-workspace/src/ProtoSource.mjs:43 reads aiConfig.sourcePaths?.ProtoSource ?? 'proto'.

ADR 0019 makes this shape invalid for AiConfig consumers: the Provider SSOT guarantees the resolved tree, and consumers should read resolved leaves at the use site rather than defending against missing subtrees.

The Problem

ProtoSource is an example custom KB source. It is small, but examples are copied as patterns. Keeping sourcePaths?.ProtoSource there teaches future custom source authors to defensively optional-chain an AiConfig subtree and hide a default literal in consumer code.

That is the B3 antipattern from ADR 0019: defensive ?. on an SSOT-guaranteed tree. The fallback literal may be legitimate, but it belongs in the owning config leaf/default contract, not in a consumer-side hidden fallback.

The Architectural Reality

  • ADR 0019 §3 B3: defensive ?. on AiConfig reads should be removed; read the resolved leaf and let missing config fail loud.
  • ai/examples/cloud-deployment/minimal-external-workspace/src/ProtoSource.mjs documents that this source directory comes from aiConfig.sourcePaths.ProtoSource.
  • Current source has one exact sourcePaths?. occurrence on origin/dev; no open duplicate leaf for ProtoSource sourcePaths was found.

The Fix

Update ProtoSource to read the resolved leaf directly:

const dir = path.resolve(aiConfig.neoRootDir, aiConfig.sourcePaths.ProtoSource);

If the example needs proto as the default, ensure that default is declared by the relevant config source/leaf rather than hidden behind consumer fallback logic. Do not broaden into the rest of #12461's production-source cleanup clusters.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
ProtoSource example source-path read ADR 0019 B3 + #12461 examples cluster Read aiConfig.sourcePaths.ProtoSource directly with no optional-chain or consumer-side default literal Fail loud if the SSOT tree/default is missing Existing JSDoc/comment stays aligned to direct aiConfig.sourcePaths.ProtoSource rg "sourcePaths\\?\\." ai and targeted source inspection show the single site removed

Decision Record impact

aligned-with ADR 0019.

Acceptance Criteria

  • ProtoSource.mjs no longer contains sourcePaths?. or ?? 'proto' for the AiConfig read.
  • The example still reads aiConfig.sourcePaths.ProtoSource as the source directory authority.
  • Targeted static verification confirms no sourcePaths?. occurrences remain under ai/.
  • The PR cites ADR 0019 and links this leaf under #12461.

Out of Scope

  • The full #12461 B3 cleanup across memory-core, daemons, graph, ingestion, and scripts.
  • B4 test mutation work (#12435).
  • Config-provider rename work (#12452).

Related

Parent: #12461 Epic: #12456 Authority: ADR 0019 (learn/agentos/decisions/0019-aiconfig-reactive-provider-ssot.md)

Handoff Retrieval Hints

  • rg "sourcePaths\\?\\." ai
  • query_raw_memories("AiConfig B3 defensive sourcePaths ProtoSource")
tobiu referenced in commit b22aca8 - "fix(ai): remove ProtoSource defensive sourcePaths read (#12504) (#12505) on Jun 4, 2026, 8:19 PM
tobiu closed this issue on Jun 4, 2026, 8:19 PM