Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

bug(tests): MCP truncation and HTTP review fixtures depend on ambient Git project

Open
#2,078 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
57/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
testing

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

status:needs-review type:bug
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:

  1. Use an unmodified checkout with private HOME/USERPROFILE, config/data/appdata and temporary directories; clear inherited ENGRAM_* and GIT_* variables. No user store/config.
  2. Run:
go test -json -count=1 -timeout=60s -run '^(TestMCPWriteToolsReportByteTruncation|TestHandleReviewListAndMarkReviewed|TestHandleReviewMarkReviewedAcceptsIDAlias)$' ./internal/mcp ./internal/server
  1. 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

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Gentleman-Programming/engram

All issues in Gentleman-Programming/engram

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.