Page MenuHomePhabricator

Make the "Is this JSON?" DocumentEngine heuristic a little tighter
ClosedPublic

Authored by epriestley on Jul 27 2018, 6:29 PM.
Tags
None
Referenced Files
F19029373: D19544.id.diff
Mon, Nov 24, 5:45 PM
F19014661: D19544.id.diff
Sat, Nov 22, 8:47 PM
F19011145: D19544.diff
Nov 22 2025, 7:56 AM
F18998221: D19544.id.diff
Nov 20 2025, 6:16 PM
F18993104: D19544.id.diff
Nov 19 2025, 5:56 AM
F18855476: D19544.id.diff
Nov 1 2025, 5:22 AM
F18855305: D19544.id.diff
Nov 1 2025, 4:49 AM
F18852374: D19544.diff
Oct 31 2025, 8:15 AM
Subscribers
None

Details

Summary

See PHI749. Ref T13164. We currently misdetect files starting with [submodule ... as JSON.

Make this a bit stricter:

  • If the file is short, just see if it's actually literally real JSON.
  • If the file is long, give up.

This should get the right result in pretty much all the cases people care about, I think. We could make the long-file guesser better some day.

Test Plan

Detected a [submodule ... file (no longer JSON) and a {"duck": "quack"} file (still JSON).

Diff Detail

Repository
rP Phabricator
Branch
json1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 20522
Build 27871: Run Core Tests
Build 27870: arc lint + arc unit