bug(tests): MCP truncation and HTTP review fixtures depend on ambient Git project
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 57/100
Research direction
Read internal/mcp/mcp_test.go around lines 118–140 and internal/server/server_test.go around lines 1992–2033 and 2076–2098. Run the listed focused go test command first in a Git-backed context, then with GIT_CEILING_DIRECTORIES set to the repository root. Done means the fixtures declare their required project context, check tool errors before indexing results, and pass in both contexts while preserving the existing guard and mutation checks.
Written by the indexing model from the issue text.
Description
Existing Issue Search
- I searched existing issues and will add evidence to a canonical tracker when applicable.
Searched open/closed issues for both exact failing test names, gitless fixtures and unknown_project/test. #1326 isolates temp fixtures from ancestor Git repositories; this is the opposite missing precondition: fixtures require the checkout to resolve as project engram without declaring that context. #1846 / PR #1853 retained the failures but did not fix these unrelated fixtures.
📝 Observed Consequence
MCP and Server tests pass in the repository's normal Git context but fail at identical source when discovery does not reach the checkout root. The MCP truncation fixture panics; two review fixtures get 404 instead of 200. This makes valid isolated/source-archive verification depend on an incidental checkout identity.
🔄 Steps to Reproduce
Reproduced once per context on main 5af068f93cf82b0294efc8020ebecf38bd013c7c, Windows/amd64, Go1.26.4:
- Use an unmodified checkout with private HOME/USERPROFILE, config/data/appdata and temporary directories; clear inherited ENGRAM_* and GIT_* variables. No user store/config.
- Run:
go test -json -count=1 -timeout=60s -run '^(TestMCPWriteToolsReportByteTruncation|TestHandleReviewListAndMarkReviewed|TestHandleReviewMarkReviewedAcceptsIDAlias)$' ./internal/mcp ./internal/server
- In a fresh isolated environment at the same source, set GIT_CEILING_DIRECTORIES to the checkout root so package cwd discovery cannot reach that root, then run the same command once. Do not change production resolution, assertions or source.
✅ Expected Behavior
Each test declares the project/admission context it needs and checks tool errors before indexing fixture results. Tests must preserve actual production project guards, UTF-8 truncation metadata and review mutation scoping, independently of an ambient repository named engram.
❌ Actual Behavior
Git-backed context: exit0,49.701s, no stderr.
Bounded Git discovery: exit1,20.879s, no stderr:
--- FAIL: TestMCPWriteToolsReportByteTruncation/mem_save
panic: runtime error: index out of range [0] with length 0
server_test.go:2033: expected mark reviewed 200, got 404 body={"error":"observation not found in resolved project"}
server_test.go:2098: expected mark reviewed alias 200, got 404 body={"error":"observation not found in resolved project"}
The failed run is retained, not retried until green.
Operating System
Windows/amd64. Historical same symptoms reproduced on an isolated Ubuntu/Go1.25.10 source-archive baseline during #1846.
Release Version (Report Context)
Main5af068f93cf82b0294efc8020ebecf38bd013c7c, captured before this investigation; no installed-release claim. Current checks use Go1.26.4, not hosted CI's Go1.25.10.
Agent / Client
Other — Go MCP/HTTP regression fixtures.
📋 Relevant Logs
Raw stdout JSON, stderr and receipts retained in the registered isolated worktree under .diagnostics/group1/ and .diagnostics/group1-gitless-context/. Not committed or uploaded as private machine artifacts. Historical PR1853 qualifications describe identical base failures.
💡 Additional Context
MCP fixture internal/mcp/mcp_test.go:118-140 requests explicit engram in a fresh store, ignores CallToolResult.IsError then indexes observations[0]. Server fixtures internal/server/server_test.go:1992-2033,2076-2098 seed engram but omit project/cwd on POST /review/mark_reviewed. Historical public diagnostics established unknown_project/available_projects=[mcp] and /project/current=server in that archive context. Current paired source checks reproduce the fixture dependency, not production corruption or a defect in fail-closed guards.
Regression plan: explicit fixture context/admission for save and review mutations; preserve healthy write/truncation and cross-project rejection/no-mutation checks, add no panic on a tool error. Verify under Git-backed and bounded-discovery contexts. Report only: no implementation, approval, assignee, source changes or relaxed guards.
- Dominant language
- Go
- Stars
- 7.1k
- Forks
- 729
- Avg merge
- 8h 26m
- Merged PRs (30d)
- 356
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 type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Gentleman-Programming/engram#2079 ·
Maintainers usually reply within 1 day
-
status:needs-review
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Gentleman-Programming/engram#2065 ·
Maintainers usually reply within 1 day
-
priority:medium status:needs-review type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Gentleman-Programming/engram#863 · 1 comment ·
Maintainers usually reply within 1 day
-
status:needs-review type:question
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Gentleman-Programming/engram#2080 · 1 comment ·
Maintainers usually reply within 1 day
-
status:needs-review type:bug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Gentleman-Programming/engram#2077 ·
Maintainers usually reply within 1 day
All issues in Gentleman-Programming/engram
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
JakeChampion/lang#13132 ·
Maintainers usually reply within 1 day
-
[BUG] deploy.restart_policy without condition drops the restart policyPossibly taken @akshat-lakhera claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
docker/compose#14383 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Azure/azure-storage-fuse#2429 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
AvengeMedia/dank-greeter#39 · 1 comment ·
-
bug: dataplane client ignores SERVER_BASEPATH, so create/delete topic miss the subpathPossibly taken @bhataprameya claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
redpanda-data/console#2693 ·
Maintainers usually reply within 2 days