-
Notifications
You must be signed in to change notification settings - Fork 1
feat(memory): typed confidence and symmetric conflict provenance (v6.6.0) #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,7 +51,7 @@ | |
| class LintIssue: | ||
| """One problem found in the vault.""" | ||
|
|
||
| kind: str # broken-link | missing-title | isolated | near-duplicate | ||
| kind: str # broken-link | missing-title | isolated | near-duplicate | conflict-* | ||
| severity: str # error | warn | info | ||
| note: str # the offending note's filename (or "A | B" for a pair) | ||
| detail: str | ||
|
|
@@ -190,6 +190,7 @@ def _load_indexed(omi_dir: Path | str) -> tuple[list[_Note], set[str], Any] | No | |
| fields = NoteFields( | ||
| title=row.title if row.has_title else "", | ||
| disabled=row.disabled, | ||
| conflicts_with=row.conflicts_with, | ||
| ) | ||
| path = omi / row.filename | ||
| ids = _note_ids(path, fields) | ||
|
|
@@ -244,6 +245,50 @@ def lint_vault(omi_dir: Path | str) -> list[LintIssue]: | |
| LintIssue("isolated", "info", n.path.name, "no inbound or outbound links") | ||
| ) | ||
|
|
||
| # `Conflicts with:` is symmetric in meaning but written on one note at a | ||
| # time, so the two ways it goes wrong are a target that does not exist and | ||
| # a claim the other side never acknowledged. Retrieval treats a one-sided | ||
| # claim as binding on both notes; lint says so out loud. | ||
| declared: dict[str, str] = {} | ||
| ids_to_note: dict[str, str] = {} | ||
| for n in notes: | ||
| for note_id in n.ids: | ||
| ids_to_note[note_id] = n.path.name | ||
| for n in notes: | ||
| claim = n.fields.conflicts_with.strip() | ||
| if not claim: | ||
| continue | ||
| target = claim.strip("[]").split("|", 1)[0].split("#", 1)[0].strip().lower() | ||
| if target in n.ids: | ||
| issues.append( | ||
| LintIssue( | ||
| "conflict-self", "warn", n.path.name, "`Conflicts with:` points at itself" | ||
| ) | ||
| ) | ||
| continue | ||
| if target not in known: | ||
| issues.append( | ||
| LintIssue( | ||
| "conflict-broken", | ||
| "error", | ||
| n.path.name, | ||
| f"`Conflicts with: [[{claim}]]` resolves to no note", | ||
| ) | ||
| ) | ||
| continue | ||
| if resolved := ids_to_note.get(target): | ||
| declared[n.path.name] = resolved | ||
|
Comment on lines
+248
to
+280
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Validate reciprocity for every valid conflict target.
Load conflict metadata for valid non-source targets into the reciprocal lookup. Keep those notes excluded as lint sources. Add a regression test for this path. 🤖 Prompt for AI Agents |
||
| for source, target_name in sorted(declared.items()): | ||
| if declared.get(target_name) != source: | ||
| issues.append( | ||
| LintIssue( | ||
| "conflict-one-sided", | ||
| "info", | ||
| source, | ||
| f"{target_name} does not declare the conflict back", | ||
| ) | ||
| ) | ||
|
|
||
| # Semantic duplicate candidates from the index; title-Jaccard is the | ||
| # fail-open path when the optional embedding backend is absent. | ||
| semantic = index.duplicate_pairs() if index is not None else None | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Add a blank line after each heading.
markdownlint-cli2reports MD022 because### Addedand### Changedhave no blank line below them. Add one blank line after each heading.Proposed fix
Also applies to: 40-40
🧰 Tools
🪛 markdownlint-cli2 (0.23.1)
[warning] 10-10: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
🤖 Prompt for AI Agents
Source: Linters/SAST tools