You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(review): gate surface entries on live grounding and functional-surface checks (#8908, #8909) (#9255)
* feat(review): gate surface entries on live grounding and functional-surface checks (#8908, #8909)
`computeGrounding` and `probeFunctionalSurface` have been fully implemented and
unit-tested in registry-logic.ts since the metagraphed port, but neither had a
single caller outside its own test file. The live surface-entry gate
(assessSurfaceEntry -> runSurfaceReview) merged a submission having never once
looked at what its URLs actually serve: it validated that `url`/`source_url`
were well-formed public HTTPS/WSS URLs and stopped there.
Add the missing half — the fetch plumbing and the gating decision — without
touching either primitive:
- surface-verification.ts: SSRF-guarded, redirect-following, truncation-tolerant
probes of the entry's `source_url` and `url`; evidence extraction (title +
tag-stripped text, script/style dropped so bundled code cannot forge a signal);
and the close-vs-hold policy.
- orchestrator: one optional injected `verifyEntry` hook, applied per appended
entry, only to entries that already passed static validation. The orchestrator
stays pure and domain-agnostic — any registry can supply its own verifier.
- content-lane-wire: builds the verifier when the new flag is on.
Policy. A CONFIRMED functional failure (a 2xx whose body demonstrably is not the
declared surface — an `openapi` url serving HTML) CLOSES: an objective,
reproducible, trivially-fixable fact, in the same class as the shape violations
the entry validator already closes on. Unconfirmed grounding HOLDS rather than
closes — it is a heuristic over page text, and a legitimate surface can fail it,
so closing on it would one-shot-close good contributions. It no longer merges,
which is the actual #8908 gap.
Three-state, never fail-open. Each check resolves to pass / fail / inconclusive
and these stay strictly distinct: an unreachable probe, a 2xx with an unreadable
or empty body, a missing source, or a throwing verifier all HOLD with their own
reason code, never a pass. A check that silently passes when it could not run
launders "we didn't look" into "we verified".
Flag-gated and OFF by default, on its own flag rather than the content lane's:
this is the lane's first outbound request to submitter-controlled URLs and it can
hold or close submissions that merge today, so both need independent rollback.
Flag-off, no probe is made and the verdict is byte-identical.
* docs(selfhost): document the surface-verification flag in tuning and privacy-security
* test(engine): cover the surface-verification flag in the engine's own node:test suite
The host vitest test for isSurfaceVerificationEnabled/isContentLaneEnabled
(test/unit/content-lane-flag.test.ts) doesn't count toward the engine
package's own Codecov flag -- that's measured from packages/loopover-engine's
node:test suite via c8 (#9064), which had no equivalent test for this file.
0 commit comments