Skip to content

fix: SPEC audit P0–P2 correctness, hardening, and walk-quality fixes#50

Merged
douglasjordan2 merged 1 commit into
mainfrom
fix/spec-audit-wave1-3
Jul 3, 2026
Merged

fix: SPEC audit P0–P2 correctness, hardening, and walk-quality fixes#50
douglasjordan2 merged 1 commit into
mainfrom
fix/spec-audit-wave1-3

Conversation

@douglasjordan2

Copy link
Copy Markdown
Owner

Implements the actionable findings from the code audit (SPEC waves 1–3 plus selected polish). All changes are behavior-compatible except #3's exit-code change (called out below for anyone whose hooks/scripts check $? on add concept).

Verified locally: cargo fmt, cargo build (default + sessions), cargo clippy --all-targets (now denies unwrap_used/expect_used with zero violations), cargo test (26 pass). MERGE idempotency and the exit-2 path were also confirmed live against Neo4j.

Correctness & security (P0)

  • build(deps): bump actions/checkout from 5 to 6 #1 invalidate --by — unresolved freetext attribution is now stored as a property on the invalidated node instead of minting an Event that leaked into walk output; ensure_event removed.
  • build(deps): bump dirs from 5.0.1 to 6.0.0 #2 relate()CREATEMERGE, so repeated hook/script runs no longer accrete duplicate edges.
  • build(deps): bump chrono from 0.4.43 to 0.4.45 #3 blocked-as-duplicateadd concept now exits 2 (was 0) when the fuzzy-duplicate guard blocks a create, so callers can branch on $?; adds --quiet/-q for hook use. ⚠️ Behavior change — scripts checking $? will now see 2 instead of 0.
  • build(deps): bump regex from 1.12.2 to 1.12.4 #4 walk traversal — constrained to Concept/KnowledgePatch labels, a deny-list for bookkeeping/session relationship types, and a LIMIT with a --limit escape hatch (default 200). Previously any label over any rel type with no cap.
  • build(deps): bump anyhow from 1.0.100 to 1.0.102 #5 clippy gateunwrap_used/expect_used escalated to deny so the stated policy fails the build; the real sites are fixed, provably-infallible statics and test modules carry narrow #[allow]s. (Full -D warnings not yet enabled — 200+ style warnings remain, tracked separately.)

Robustness (P1)

Architecture / polish (P2/P3)

Deferred (not in this PR)

The larger structural/credibility items from the audit are intentionally left for follow-up: integration tests (#10), the main.rs/graph.rs refactors (#11/#12), find JSON output (#13), audit duplicates (#16), benchmark growth (#17), release hygiene (#18), and the relationship-type vocabulary (#21).

🤖 Generated with Claude Code

Implements the actionable items from the code audit (SPEC waves 1–3 plus
selected polish). Behavior-compatible except #3's exit-code change.

Correctness & security (P0):
- invalidate --by: record unresolved freetext attribution as a node property
  instead of minting an Event that leaks into walk output; drop ensure_event
- relate(): MERGE instead of CREATE so re-runs don't accrete duplicate edges
- add concept: exit 2 (not 0) when blocked as a fuzzy duplicate, so scripts
  checking $? can branch; add --quiet for hook/script use
- walk traversal: constrain to Concept/KnowledgePatch, deny bookkeeping/session
  relationship types, and cap results with LIMIT (--limit escape hatch)
- clippy: escalate unwrap_used/expect_used to deny so the stated policy fails
  the build; fix the real sites, narrow-allow provably-infallible statics + tests

Robustness (P1):
- OllamaClient: build the reqwest::Client once and reuse it (connection pooling)
- describe: write the description even when Ollama is down; backfill fills the
  embedding later, rather than blocking knowledge capture on the sidecar
- reflector: invoke the binary via current_exe() instead of `c0` on $PATH, and
  stamp provenance with --source reflector so its commits are auditable
- find: stop logging zero-row Cypher results as knowledge dead-ends

Architecture/polish (P2/P3):
- add `c0 move patch <name> --to <ns>` mirroring move concept
- docker-compose: allow NEO4J_AUTH override; document the single-user threat model
- ship systemd timer units for discrete reflector runs (retire daemon framing)
- Cargo.toml: declare rust-version = "1.85" (edition 2024 MSRV)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@douglasjordan2 douglasjordan2 merged commit 1a783fd into main Jul 3, 2026
3 checks passed
@douglasjordan2 douglasjordan2 deleted the fix/spec-audit-wave1-3 branch July 3, 2026 01:28
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