1
0
forked from jason/echo

ver 1.5.1 — duplicate-gate precision (common tokens, cross-kind)

Live 1.5.0 use caught the gate blocking a decision note over the single
vault-common token "echo" (min-normalized overlap gives any one-token
entity a 1.0 score). New echo_index.gate_candidates() + token_df():

- gate blocks same-kind candidates only; cross-kind name collisions
  (a decision titled after its project) warn instead of blocking
- a lone shared token blocks only when unique to that entity (df == 1);
  multi-token overlaps still block

fuzzy_candidates (advisory warnings) and exit-76/--merge-into/--force
semantics unchanged. +3 offline unit tests, gate e2e cases restructured
+2 new; verified live both directions. All suites green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jason Stedwell
2026-07-03 13:03:07 -05:00
parent be3fd36ebf
commit 3b6c3053cb
10 changed files with 155 additions and 15 deletions
+20 -5
View File
@@ -190,14 +190,29 @@ def main():
check("v1.5 update keeps EVERY body line",
" second line survives" in bob3 and " third line too" in bob3, bob3)
# 12. duplicate gate: a strong fuzzy candidate STOPS creation (exit 76)...
r = h.echo(ECHO, "capture", "Smith Consulting", "--kind", "company")
# 12. duplicate gate: same-kind + distinctive-token candidate STOPS creation...
r = h.echo(ECHO, "capture", "Robert Smith", "--kind", "person")
check("v1.5 duplicate gate stops the create (exit 76)", r.returncode == 76, str(r.returncode))
check("v1.5 gate wrote nothing", h.ground("resources/companies/smith-consulting.md") is None)
check("v1.5 gate wrote nothing", h.ground("resources/people/robert-smith.md") is None)
# ... --force overrides ...
r = h.echo(ECHO, "capture", "Smith Consulting", "--kind", "company", "--force")
r = h.echo(ECHO, "capture", "Robert Smith", "--kind", "person", "--force")
check("v1.5 --force creates past the gate",
h.ground("resources/companies/smith-consulting.md") is not None, r.stdout + r.stderr)
h.ground("resources/people/robert-smith.md") is not None, r.stdout + r.stderr)
# 12b (1.5.1). cross-kind lookalike does NOT gate — it creates with a warning.
r = h.echo(ECHO, "capture", "Smith Consulting", "--kind", "company")
check("v1.5.1 cross-kind lookalike is not gated",
r.returncode == 0 and h.ground("resources/companies/smith-consulting.md") is not None,
str(r.returncode) + r.stdout + r.stderr)
check("v1.5.1 cross-kind lookalike still warns",
"similar existing" in (r.stdout + r.stderr), r.stdout + r.stderr)
# 12c (1.5.1). a single vault-common token does NOT gate: once "acme" appears in
# two entities, "Acme Tools" creates (with a warning) instead of blocking.
h.echo(ECHO, "capture", "Acme", "--kind", "company")
h.echo(ECHO, "capture", "Acme Group", "--kind", "company", "--force")
r = h.echo(ECHO, "capture", "Acme Tools", "--kind", "company")
check("v1.5.1 single common token does not gate",
r.returncode == 0 and h.ground("resources/companies/acme-tools.md") is not None,
str(r.returncode) + r.stdout + r.stderr)
# ... and --merge-into routes the capture as an update to the canonical entity.
r = h.echo(ECHO, "capture", "Bobby The Builder", "--kind", "person", "--merge-into", "bob-smith")
idx4 = h.ground("_agent/index/entities.json") or ""