AVI-530: shortest-path reachability + SCC decomposition (AVI-518 Haskell) - #30
Merged
Merged
Conversation
…doc for Graphos context graph - Formal definitions: reachability (reflexive-transitive closure of E), hop-minimal shortest path, SCC partition + condensation (DAG) - Theorems 2.1-2.4 with proof sketches; invariants INV-7/8/9/10 (QuickCheck-ready) - Termination: strictly-decreasing measure (unvisited-node count) for Tarjan/Kosarajan/BFS - Complexity: O(N+E) SCC/reachability; all-pairs guarded at repo scale - Feasibility answers + arbitration flags (unweighted shortestPath, undirected traversal directedness, SCC vs biconnected distinction); worked golden-file example - Mapped to 05-path, fgl-adapter, neighbor-expansion, query-scoping, query-relevance-scoring,iden-scalability, bounded-edge-inference, domain-types Co-Authored-By: Paperclip <noreply@paperclip.ing>
…urn (AVI-519) Co-Authored-By: Paperclip <noreply@paperclip.ing>
…e) requirements Formal definitions, invariants (INV-A..H), seven theorems with proof sketches, complexity bound O(N_d*N_c*(d+log N_c)), and acceptance criteria mapped to semantic-edge-inference scenarios. Grounded in inferSemanticCodeDocEdges. Co-Authored-By: Paperclip <noreply@paperclip.ing>
…quirements Co-Authored-By: Paperclip <noreply@paperclip.ing> Co-Authored-By: Paperclip <noreply@paperclip.ing>
Preserve uncommitted work left dangling when devhaskell run ec2fa684 went silent (process terminated ~9.5h after last output). Implemented per AVI-530 requirements: - shortestPathReachable / shortestPathReachableWithCached (Thm 2.4) - stronglyConnectedComponents / SCCWithCached (iterative Tarjan, O(N+E)) Provenance: code authored by devhaskell in dead run ec2fa684; committed by head-of-dev during AVI-541 silent-run review so the work is not lost on workspace cleanup. Co-Authored-By: Paperclip <noreply@paperclip.ing>
…y interface requirements Joint requirements doc (head-rnd synthesis) defining the unified query interface over both representations: single-object determinacy, projection independence, combinatorial grounding of G_s on the colimit, community-query freshness (operational non-naturality), monotonicity boundary, cohesion cross-reading consistency, cost model, and order-independence/dependence. Co-Authored-By: Paperclip <noreply@paperclip.ing>
…requirements Graph theory edge cases for Graphos context graph: undirected cycle detection, directed acyclicity, connected/weakly-connected components, isolated nodes, self-loops. 8 theorems w/ proof sketches, 8 invariants (QuickCheck-ready), O(N+E) bounds against the 75k/80k budget, and 7 golden-file fixtures (F1-F7) as the concrete deliverable. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Repairs the dangling SCC work preserved in d0785ef: - Tarjan tree-edge lowlink propagation used idx[u] instead of low[u] (relow), which split cycles like a->b->c->a into wrong components; back/cross edges keep index-based relowIdx per spec 3.1. - Component flattening zipped ids over nodes instead of components; SCC result now maps component id -> sorted member NodeIds, ids assigned by ascending minimum NodeId (deterministic, INV-9). - sccIndices now returns [[Int]] directly (no runST at call site); restored subgraph type signature lost in the interrupted edit. Adds tests/Graphos/Domain/Graph/SCCSpec.hs per AVI-530 acceptance: - 8 golden test on the worked example (SCCs, condensation chain, shortestPath answers, reachability) - INV-7 partition property over random graphs - INV-8 E-walk + hop-minimality + arc/self-loop properties - INV-9 determinism (repeat-call equality; key order independence) - INV-10 coarsening under addEdges (golden + property) Verified: cabal build lib + test suite compile; full cabal test 781 examples, 0 failures, 3 pending. Refs: AVI-518 (math spec), AVI-530 (implementation follow-up) Co-Authored-By: Paperclip <noreply@paperclip.ing>
Owner
Author
|
Implementation complete and tests added for AVI-518 (shortest-path reachability + SCC).
Requesting review per PDCA handoff (head-of-dev dispatches haskell-reviewer → pr-validator → openspec-verifier). |
… guards requirements Co-Authored-By: Paperclip <noreply@paperclip.ing>
Owner
Author
Haskell Code Review — AVI-530 shortest-path reachability + SCCVerdict: LGTM — code review passed (no blockers / majors) Reviewed Correctness
Tests
Findings (non-blocking)Minor
Nits
Suggested for devhaskell in remediation (non-blocking): strengthen the INV-9 property as above and tidy the |
jeremiepas
added a commit
that referenced
this pull request
Sep 8, 2026
* wip: detect generated/vendored/minified code (partial) Domain types + pure classifier complete and tested (727 examples, 0 failures): - FileClass/DetectionMode/DetectionConfig in Pipeline.hs; thread detectionClassification - classifyFile (Vendored>Generated>Minified>Source) + FileMeta leading-content reader - categorizeFilesWithConfig drops non-source before Extract - DetectClassificationSpec + Detect/Export spec adaptations Remaining per openspec/changes/detect-generated-vendored-code/tasks.md: - Task 2 config loader block + CLI flags - Task 3.3 INFO detection summary after Detect - Task 4.2 collapse mode (one node w/ childCount) - architecture-sensitive * AVI-444: finalize generated-code detection (config wiring, summary log) - Move DetectionMode/DetectionConfig into a new leaf module Graphos.Domain.Config.Detection to break the Domain.Config <-> Pipeline module cycle (Pipeline imported GraphosConfig from Config, which imported Core, which imported DetectionConfig back from Pipeline). - Thread DetectionConfig through detectFiles* as an explicit parameter instead of hardcoding defaultDetectionConfig. - Wire gcDetection into GraphosConfig (default + project-overrides-global merge) and expose the YAML "detection" key via cfDetection. - Log the classification breakdown in the pipeline summary. - Update DetectClassificationSpec import for the relocated types. * AVI-72: add detect-mode CLI flags and Collapse behavior Implement --detect-mode (exclude|collapse|off), --no-detect, and --minified-threshold CLI flags folded over the on-disk detection config via applyDetectionOverrides (validating smart constructor guards the threshold). Add Collapse mode: collapseDetectedFiles produces one representative node per detected non-Source file with childCount = the node count from an isolated extraction (countExtractedNodes), so a large generated/vendored/ minified file occupies a single node instead of bloating the graph. Off mode routes all files to extraction; Exclude/Collapse drop non-source from the main graph. * AVI-72: drop dead Data.ByteString.Lazy import in Pipeline/Core.hs (keep develop green under --flag dev) * AVI-484: centralize detection-config resolution in Domain/Config.Detection Move applyDetectionOverrides from Graphos.UseCase.Pipeline.Core into the leaf Domain/Config.Detection module so detection config lives in one place and both the detect and collapse passes consume a single validated config. The domain function takes primitive args (base config, effective mode, optional minified-line-threshold) to preserve leaf status; the CLI-field interpretation stays in Core.hs. Behavior is identical: same --no-detect precedence, same threshold override, same fail-fast on an invalid threshold. Verified: cabal build --flag dev clean; cabal test 783 examples, 0 failures. * AVI-509: clean develop checkout — commit openspec skill updates, checkpoint-controls spec/archive, agent def; ignore .paperclip/worktrees - Commit updated openspec-* skill definitions (generatedBy 1.7.0, store-selection logic) - Commit archived change + checkpoint-controls spec from checkpoint-and-cluster-only-controls - Commit .opencode/agent/core/goal-orch.md (agent definition, tracked per .gitignore intent) - Ignore .paperclip/worktrees/ (local-only Paperclip worktree copies) Co-Authored-By: Paperclip <noreply@paperclip.ing> * AVI-510: community detection & modularity requirements doc for Graphos context graph Math-requirements doc grounded in Domain.Community/Graph/Query types and openspec specs (community-detection, leiden-scalability, 09-merge, bounded-edge-inference). - Formal definitions (weighted multigraph + unweighted support graph G_s) - Modularity theorem: local moving never decreases Q within a phase (deltaQ == 2*DeltaQ) - Termination argument: capped by maxIter + stability predicate SP-1/SP-2 - Complexity bounds per phase + O(N+C+E) scale guard with NFData thunk discipline - Partition invariants INV-1..INV-6 with property/invariant tests - Arbitration flag: cohesion spec (avg internal-neighbor ratio) vs code (cluster density); settle on spec definition with pinning property tests; escalated w/ CT Expert - Determinism lens: tie-break in maximumBySnd, order-independent cohesion Co-Authored-By: Paperclip <noreply@paperclip.ing> * docs(math): add AVI-511 colimit merge requirements doc Co-Authored-By: Paperclip <noreply@paperclip.ing> * docs(math): consolidate AVI-510 + AVI-511 into unified requirements layer for Graphos context graph Head-of-R&D consolidation for AVI-508: one notation/glossary, unified REQ-ID register (GT-/CT-/JOINT-), proven/assumed/open classification, arbitration log (cohesion_spec settled; new-wins policy; non-natural detection mandate), cross-domain consistency matrix, open-items table with owners/actions, and a full surface map. No Haskell written; all behavior rows carry a Graphos Dev loop. Co-Authored-By: Paperclip <noreply@paperclip.ing> * AVI-512: add CI check for openspec change finished & archived * AVI-512: move stray change dir fix-pipeline-e2e into openspec/changes/ * AVI-512: archive gate warning-only until openspec-verifier clears backlog * AVI-512: archived-tasks gate warning-only pending verifier backlog cleanup * AVI-569: add develop triggers to Graphos CI workflows - haskell.yml: trigger push/pull_request on main and develop - graphos-analyze.yml: add push/pull_request triggers and a lightweight ci job so pull_request/push events report a check-run; heavy analyze job remains workflow_dispatch-only Co-Authored-By: Paperclip <noreply@paperclip.ing> * AVI-530: shortest-path reachability + SCC decomposition (AVI-518 Haskell) (#30) * AVI-518: shortest-path reachability & SCC decomposition requirements doc for Graphos context graph - Formal definitions: reachability (reflexive-transitive closure of E), hop-minimal shortest path, SCC partition + condensation (DAG) - Theorems 2.1-2.4 with proof sketches; invariants INV-7/8/9/10 (QuickCheck-ready) - Termination: strictly-decreasing measure (unvisited-node count) for Tarjan/Kosarajan/BFS - Complexity: O(N+E) SCC/reachability; all-pairs guarded at repo scale - Feasibility answers + arbitration flags (unweighted shortestPath, undirected traversal directedness, SCC vs biconnected distinction); worked golden-file example - Mapped to 05-path, fgl-adapter, neighbor-expansion, query-scoping, query-relevance-scoring,iden-scalability, bounded-edge-inference, domain-types Co-Authored-By: Paperclip <noreply@paperclip.ing> * Add graph theory requirements: incremental edge updates under node churn (AVI-519) Co-Authored-By: Paperclip <noreply@paperclip.ing> * docs(math): add AVI-520 context similarity scoring (embedding + cosine) requirements Formal definitions, invariants (INV-A..H), seven theorems with proof sketches, complexity bound O(N_d*N_c*(d+log N_c)), and acceptance criteria mapped to semantic-edge-inference scenarios. Grounded in inferSemanticCodeDocEdges. Co-Authored-By: Paperclip <noreply@paperclip.ing> * docs(math): add AVI-521 hot-reload cost model & cache invalidation requirements Co-Authored-By: Paperclip <noreply@paperclip.ing> Co-Authored-By: Paperclip <noreply@paperclip.ing> * AVI-530: preserve shortest-path reachability + SCC implementation Preserve uncommitted work left dangling when devhaskell run ec2fa684 went silent (process terminated ~9.5h after last output). Implemented per AVI-530 requirements: - shortestPathReachable / shortestPathReachableWithCached (Thm 2.4) - stronglyConnectedComponents / SCCWithCached (iterative Tarjan, O(N+E)) Provenance: code authored by devhaskell in dead run ec2fa684; committed by head-of-dev during AVI-541 silent-run review so the work is not lost on workspace cleanup. Co-Authored-By: Paperclip <noreply@paperclip.ing> * docs(math): add AVI-529 colimit-modularity consistency / unified query interface requirements Joint requirements doc (head-rnd synthesis) defining the unified query interface over both representations: single-object determinacy, projection independence, combinatorial grounding of G_s on the colimit, community-query freshness (operational non-naturality), monotonicity boundary, cohesion cross-reading consistency, cost model, and order-independence/dependence. Co-Authored-By: Paperclip <noreply@paperclip.ing> * docs(math): add AVI-523 cycle detection & connectivity decomposition requirements Graph theory edge cases for Graphos context graph: undirected cycle detection, directed acyclicity, connected/weakly-connected components, isolated nodes, self-loops. 8 theorems w/ proof sketches, 8 invariants (QuickCheck-ready), O(N+E) bounds against the 75k/80k budget, and 7 golden-file fixtures (F1-F7) as the concrete deliverable. Co-Authored-By: Paperclip <noreply@paperclip.ing> * AVI-530: fix SCC implementation and add AVI-518 acceptance tests Repairs the dangling SCC work preserved in d0785ef: - Tarjan tree-edge lowlink propagation used idx[u] instead of low[u] (relow), which split cycles like a->b->c->a into wrong components; back/cross edges keep index-based relowIdx per spec 3.1. - Component flattening zipped ids over nodes instead of components; SCC result now maps component id -> sorted member NodeIds, ids assigned by ascending minimum NodeId (deterministic, INV-9). - sccIndices now returns [[Int]] directly (no runST at call site); restored subgraph type signature lost in the interrupted edit. Adds tests/Graphos/Domain/Graph/SCCSpec.hs per AVI-530 acceptance: - 8 golden test on the worked example (SCCs, condensation chain, shortestPath answers, reachability) - INV-7 partition property over random graphs - INV-8 E-walk + hop-minimality + arc/self-loop properties - INV-9 determinism (repeat-call equality; key order independence) - INV-10 coarsening under addEdges (golden + property) Verified: cabal build lib + test suite compile; full cabal test 781 examples, 0 failures, 3 pending. Refs: AVI-518 (math spec), AVI-530 (implementation follow-up) Co-Authored-By: Paperclip <noreply@paperclip.ing> * docs(math): add AVI-534 structural-analysis complexity bounds & scale guards requirements Co-Authored-By: Paperclip <noreply@paperclip.ing> --------- Co-authored-by: local <local> Co-authored-by: Paperclip <noreply@paperclip.ing> Co-authored-by: local <local@local> --------- Co-authored-by: homelab-dev <agent@paperclip.ing> Co-authored-by: local <local> Co-authored-by: Paperclip <noreply@paperclip.ing> Co-authored-by: board <board@avionix.local> Co-authored-by: local <local@local>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the AVI-518 math requirements (
docs/math-requirements/AVI-518-shortest-path-scc.md) inGraphos.Domain.Graph.Query, repairing and completing the preserved work from d0785ef:shortestPathReachable/shortestPathReachableWithCached— forward reachability decisionu :-> v(Thm 2.4), consistent withshortestPath /= Nothing.stronglyConnectedComponents/stronglyConnectedComponentsWithCached— iterative Tarjan SCC (§3.1), O(N+E), iterative frame stack (no per-node recursion), component ids by ascending minimumNodeId(deterministic under key permutation, INV-9).idx[u]instead oflow[u](split cycles like a→b→c→a incorrectly); component flattening zipped ids over nodes instead of components (destroyed the partition);subgraphhad lost its type signature.tests/Graphos/Domain/Graph/SCCSpec.hs(19 tests).Acceptance criteria → how met
shortestPath a f == Just [a,b,c,d,f],shortestPath a a == Just [a],shortestPath f a == NothingstronglyConnectedComponents (§8 golden example)+shortestPathReachable (§8 golden example)describe blocks (11 tests)INV-7 (property)—(M . concatMap snd) == M (Map.keys gNodes), pairwise disjoint, non-emptyshortestPathresult is a valid hop-minimal E-walk; arcs ⇒Just [u,v]u /= v(self-loops correctly yieldJust [u], covered by an explicit test)f->amerge test + coarsening property over random graphs viaaddEdgesVerification
cabal build lib:graphos— cleancabal test graphos-test --enable-tests— 781 examples, 0 failures, 3 pending (includes new SCC suite)Notes / open items (from doc §6/§10, unchanged)
shortestPathkept hop-minimal (per issue instruction).Refs: AVI-518, AVI-530