Skip to content

fix(wiki): restore rewritten image placeholders - #4301

Open
helloxjade wants to merge 1 commit into
Tencent:mainfrom
helloxjade:fix/wiki-image-placeholder-recovery-4294
Open

helloxjade wants to merge 1 commit into
Tencent:mainfrom
helloxjade:fix/wiki-image-placeholder-recovery-4294

Conversation

@helloxjade

Copy link
Copy Markdown
Contributor

Description

Wiki synthesis can rewrite wkimg:0010 as wkimg/0010, leaving an internal placeholder as a broken image URL in the stored page. Restore common separator, whitespace, case, and zero-padding variants to the original URL only when their complete numeric identifier exists in the current request's image map.

Markdown images with unresolved wkimg destinations are removed. The same resolver handles tokens outside Markdown images, while captions and placeholder-like fragments inside real URLs remain intact. Regression tests cover rewritten references, unknown/malformed identifiers, real URLs, and a mock LLM returning a slash variant.

Type of Change

  • 🐛 Bug fix

Related Issue

Fixes #4294

Testing

Passed:

  • go test ./internal/application/service -run 'Test(MaskImageURLs|UnmaskImageURLs.*|GenerateWithTemplateMasksImageURLsBeforeLLM)$' -count=1
  • golangci-lint run --new-from-rev=upstream/main ./internal/application/service (v2.14.0, 0 issues)
  • git diff --check upstream/main...HEAD
  • gofmt -l internal/application/service/wiki_ingest.go internal/application/service/wiki_ingest_test.go (empty)

The new regression tests failed before the fix and passed afterward.

Broader validation:

  • go test ./internal/application/service -count=1 reports 42 unrelated failures. All 42 were reproduced with the two changed files replaced by their unmodified upstream/main versions via Go's -overlay option (base 383d26535). Two retrieval tests expect log messages but receive the literal json formatter output; MCP and sandbox tests encounter local DNS results in the restricted 198.18.0.0/15 range for example.com and api.e2b.app.
  • golangci-lint run --new-from-rev=upstream/main ./... was blocked by local disk exhaustion during package loading (no space left on device). The scoped lint above passed after clearing this task's temporary reproduction cache.
  • Full-repository tests were not run.

Checklist

  • Diff whitespace check passes
  • Changed source files are formatted
  • Targeted tests for the change pass
  • Diff-scoped lint passes for the modified package
  • Broader check failures and environment limitations are documented above
  • Self-reviewed the code
  • Added/updated tests covering the change

This branch has not been deployed

No deployments
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.

[Bug]: Wiki synthesis keeps broken image links when the LLM rewrites a wkimg: placeholder (e.g. wkimg/0010)

1 participant