LearnNewsExamplesServices
Frontmatter
id15117
titleAdd unit coverage for Neo.util.Json.extract
stateClosed
labels
enhancementhelp wantedgood first issuecontributor-experienceaitesting
assigneesBortlesboat
createdAt2:10 AM
updatedAt3:25 AM
githubUrlhttps://github.com/neomjs/neo/issues/15117
authorneo-gpt-emmy
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAt3:25 AM

Add unit coverage for Neo.util.Json.extract

Closed Backlog/active-chunk-5 enhancementhelp wantedgood first issuecontributor-experienceaitesting
neo-gpt-emmy
neo-gpt-emmy commented on 2:10 AM

Context

GitHub surfaces approachable repository work through the good first issue label. Neo currently has no open issue carrying that label, so this ticket creates a deliberately small, self-contained entry point outside the v13.2 release work.

[!IMPORTANT] Reserved for first-time Neo.mjs contributors. The Neo maintainer team will not claim, edit, or implement this ticket through 2026-07-20. A first-time contributor may claim it immediately; contributor questions and PR reviews remain welcome during the reservation window.

Problem

Neo.util.Json.extract() is a compact, pure utility with documented behavior, but it has no focused unit spec. Its Markdown-fence parsing and fail-closed null behavior are useful contracts that should be pinned independently.

Architectural reality

  • Runtime source: src/util/Json.mjs
  • Canonical test destination: test/playwright/unit/util/Json.spec.mjs
  • Established sibling pattern: test/playwright/unit/util/Env.spec.mjs and Rectangle.spec.mjs
  • This is test-only work; no new runtime abstraction or directory is needed.

Contract ledger

Surface Current contract to cover
Plain JSON Parses valid JSON objects and arrays
Fenced JSON Extracts content from json`, javascript, ```js, and untagged fences
Surrounding text Finds a supported fenced block inside otherwise noisy text
Invalid input Returns null for empty, whitespace-only, or malformed input without throwing
Parsed values Preserves nested objects, arrays, booleans, numbers, strings, and null

Acceptance criteria

  • Add test/playwright/unit/util/Json.spec.mjs using the existing util-spec setup/import pattern.
  • Cover valid plain object and array JSON.
  • Cover all four supported Markdown fence forms.
  • Cover a fenced block surrounded by unrelated text.
  • Cover empty, whitespace-only, and malformed input returning null without throwing.
  • Cover representative nested values so the parsed result is asserted structurally.
  • Keep the change test-only. If a documented contract and runtime behavior disagree, stop and ask on this ticket before changing src/util/Json.mjs.
  • Run the focused spec: npm run test-unit -- test/playwright/unit/util/Json.spec.mjs
  • Run the complete unit suite: npm run test-unit

Out of scope

  • Refactoring Neo.util.Json
  • Adding new parsing formats or recovery heuristics
  • Any v13.2 release, Agent OS, Fleet Manager, docking, or Golden Path work
  • Broad utility-suite cleanup

Avoided traps

  • Do not run default npx playwright test; Neo requires its custom unit configuration.
  • Import src/Neo.mjs and src/core/_export.mjs as the sibling specs do.
  • Do not change runtime behavior merely to make a test easier.

Prior art and duplicate sweep

  • Neo.util.Json was extracted in #7826.
  • Final live sweep on 2026-07-13 checked the latest 20 open issues, exact repository issue history, Knowledge Base results, local repository references, and the recent A2A ledger; no equivalent open ticket or active lane was found.
  • Memory Core semantic mining was degraded by an embedding-canary timeout, so the live GitHub, Knowledge Base, source, and A2A evidence above is the controlling duplicate check.

Decision-record impact

None. This ticket pins an existing public utility contract and introduces no architectural decision.

Origin Session ID: f95e01ff-ba36-409a-98af-573263fab247

Bortlesboat
Bortlesboat 3:06 AM

I'd like to take this as my second and final Neo.mjs contribution in this campaign. I'll keep it test-only and cover the full contract ledger with the repository's custom unit configuration.

Bortlesboat cross-referenced by PR #15120 on 3:11 AM
tobiu referenced in commit e124036 - "test(util): cover Json extraction (#15117) (#15120)" on 3:25 AM
tobiu closed this issue on 3:25 AM