Skip to content

feat(api): result ledgers + report fields (policy R3) - #248

Merged
Levalicious merged 1 commit into
developfrom
feature/api-ledgers
Oct 8, 2026
Merged

Levalicious merged 1 commit into
developfrom
feature/api-ledgers

Conversation

@Levalicious

Copy link
Copy Markdown
Owner

The ledger half of docs/api-error-policy.md: every mutating success now enumerates per-item outcomes — no more bare "successfully", no more ambiguous empty returns.

What changed

  • create_entities → {created, existing}; create_relations → {created, skippedDuplicates}; add_observations entries gain alreadyPresent.
  • Deletes → {deleted, notFound}: entities by name; relations with reason: entity | relation; observations with reason: entity | observation.
  • open_nodes carries missing[] for partial misses (all-missing still errors, per R1).
  • sequentialthinking returns linkedTo.
  • random_walk reports modeUsed (merw | uniform | merw+fallback) and fallbackSteps — the C walk now counts steps where merw-requested sampling fell back to uniform because ψ was unavailable, so the result never claims MERW it didn't run.
  • kb_load returns per-stage counts: entities {created, existing}, relations {created, skippedDuplicates}.

Evidence

  • New API ledgers (R3) test block (9 cases): dupe reporting, exact-duplicate existing, notFound reason discrimination, partial missing[], walk mode reporting, chain linkedTo.
  • Full suite 192/192; fuzz still clean (protoErr = 0, rejections visible).
  • KB note: this retires Heuristic_EmptyCreateRelationsReturnIsDedup at release time — an empty created list is now self-explanatory via skippedDuplicates.

Next in the policy: R5 cursor fingerprinting (CURSOR_STALE).

🤖 Generated with Claude Code

Implements the ledger half of docs/api-error-policy.md.

- create_entities -> {created, existing}; create_relations ->
  {created, skippedDuplicates}; add_observations gains alreadyPresent
- deletes return {deleted, notFound}: entities by name; relations with
  reason entity|relation; observations with reason entity|observation
- open_nodes carries missing[] for partial misses; sequentialthinking
  returns linkedTo
- random_walk reports modeUsed (merw | uniform | merw+fallback) and
  fallbackSteps — the C walk now counts merw-requested steps that fell
  back to uniform because psi weighting was unavailable (honest labeling,
  cf. D_NoUsageClaimWithoutTheRealThing)
- kb_load returns per-stage counts: entities {created, existing},
  relations {created, skippedDuplicates}
- tests: new ledger block (9 cases) + shape updates; suite 192/192

Co-Authored-By: Claude Code <noreply@anthropic.com>
@Levalicious
Levalicious merged commit 11e7a4d into develop Oct 8, 2026
12 checks passed
@Levalicious
Levalicious deleted the feature/api-ledgers branch October 8, 2026 06:34
@Levalicious Levalicious mentioned this pull request Oct 8, 2026
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