refactor(store): isolate semantic scan worker execution
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #1619 by @Reaan06 — closed without merging
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 45/100
Research direction
Start at internal/store/relations.go:1311 scanProject, focusing on the semantic worker block at :1562–1663, and read internal/store/scan_semantic_test.go plus scan_batch_test.go and scan_page_test.go to learn the expected dry-run/apply and accounting behavior. Extract only semantic worker execution and result accounting into a private function after candidate pairs are chosen, keeping page loading, pair selection and structural inserts in scanProject. Done means go test ./internal/store/... passes with unchanged public API, SQL semantics and response fields. Note an open linked PR (#1619) already targets this issue, so confirm with maintainers before starting.
Written by the indexing model from the issue text.
Description
🔍 Problem Description
internal/store/relations.go:1311–1664 implements scanProject as one roughly 350-line function. It combines page loading, candidate selection, relation insertion and caps, semantic-pair deduplication, and a concurrent semantic judgment pool. This puts distinct failure and accounting paths into one unit and makes semantic changes hard to review without rechecking structural scan behavior. This is a maintainability proposal, not a claim that the scan currently misbehaves.
💡 Proposed Solution
Extract only semantic worker execution and result accounting into a private, focused function after candidate pairs have been selected. Keep page/query logic, pair selection/caps and structural inserts in scanProject. Preserve dry-run/apply semantics, worker concurrency, timeouts, panic/error handling, counters and result ordering. Do not combine this with a behavioral performance fix.
Acceptance: existing scan batching/page and semantic tests still pass; focused cases in internal/store/scan_semantic_test.go cover dry-run versus apply, valid/invalid verdicts, runner errors/panics, capped pairs, and concurrent accounting. No public API, SQL semantics or response fields change; prefer net simpler code rather than shifting the same complexity to more layers.
📦 Affected Area
Store (database, queries)
🔄 Alternatives Considered
Split the entire scan pipeline at once (larger review and regression surface) or leave all paths together. A bounded semantic execution seam permits one behavior-preserving work unit with existing tests.
📎 Additional Context
Source revalidated on main at a43183c2 (the semantic worker pool still lives inside scanProject): internal/store/relations.go:1311–1664, particularly the semantic worker block :1562–1663; tests in internal/store/scan_semantic_test.go, scan_batch_test.go, and scan_page_test.go. The closed #590 and #721 tracked different behavioral bugs; this proposal does not reopen them. No implementation or tests were run for this proposal.
- Dominant language
- Go
- Stars
- 7.1k
- Forks
- 729
- Avg merge
- 10h 51m
- Merged PRs (30d)
- 277
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Gentleman-Programming/engram
-
status:needs-review
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Gentleman-Programming/engram#2065 · 1 comment ·
Maintainers usually reply within 1 day
-
feat(cli): run engram serve in the background as a daemonPossibly taken A pull request linked to this issue is open or already merged. Openstatus:needs-review type:feature
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Gentleman-Programming/engram#2228 · 1 comment ·
Maintainers usually reply within 1 day
-
status:needs-review type:feature
Difficulty 4/5 3-5 days Newbie friendliness 22/100
Gentleman-Programming/engram#2203 · 1 comment ·
Maintainers usually reply within 1 day
-
feat(store): reduce isolated test fixture startup costPossibly taken @dnlrsls claimed this 3 days ago. Openstatus:approved type:feature
Gentleman-Programming/engram#2202 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
status:needs-review type:question
Difficulty 5/5 Over a week Newbie friendliness 20/100
Gentleman-Programming/engram#2201 · 3 comments ·
Maintainers usually reply within 1 day
All issues in Gentleman-Programming/engram
Similar issues
-
date_time, url_encode, html_escape, to_unix_time, contains_all and contains_any panic when called without argumentsPossibly taken @antcybersec claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
projectdiscovery/dsl#372 ·
Maintainers usually reply within 1 day
-
blocked-needs-validation
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
projectcapsule/capsule#2265 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
JuliusBrussee/caveman#1449 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bot-found bug priority: P3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
madenvel/KalinkaPlayer#498 ·