ampproject / ampproject/amphtml

Validator no longer detects missing body/head tags

Open
#38,354 4 comments 0 reactions 0 assignees View on GitHub
P3: When Possible Stale Type: Bug WG: caching
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

I have a snapshot of `validator.js` from `2021/09/14` which correctly identifies a missing `head` tag, but the current `validator_wasm.js` version doesn't report the missing head tag, only the missing children of the head tag

I have also noticed a difference in the way a missing body tag is reported. In that snapshot it reported it as a `MANDATORY_TAG_MISSING` error, but `validator_wasm.js` reports it as `DISALLOWED_MANUFACTURED_BODY`

Are either of these changes intentional?

### Reproduction Steps

Snapshot of `validator.js`: [validator.js.zip](https://github.com/ampproject/amphtml/files/9131930/validator.js.zip)
Snapshot of `validator_wasm.js`: [validator_wasm.js.zip](https://github.com/ampproject/amphtml/files/9131937/validator_wasm.js.zip)

Missing head: [index.html.zip](https://github.com/ampproject/amphtml/files/9131947/index.html.zip)
Missing body: [index.html.zip](https://github.com/ampproject/amphtml/files/9131943/index.html.zip)

Missing head:
Run `amp.validator.validateString` on the provided test page
Expected:
```json
...
{
"severity": "ERROR",
"code": "MANDATORY_TAG_MISSING",
"line": 7,
"col": 6,
"specUrl": "https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml/#required-markup",
"params": [
"head"
],
"category": null,
"dataAmpReportTestValue": null
},
...
```
Actual:
No missing head is reported

Missing body:
Run `amp.validator.validateString` on the provided test page
expected:
```json
...
{
"severity": "ERROR",
"code": "MANDATORY_TAG_MISSING",
"line": 11,
"col": 6,
"specUrl": "https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml/#required-markup",
"params": [
"body"
],
"category": null,
"dataAmpReportTestValue": null
}
...
```

Actual:
```json
...
{
"severity": "ERROR",
"code": "DISALLOWED_MANUFACTURED_BODY",
"line": 10,
"col": 11,
"paramsList": [],
"params": [],
"_PB_BASE64": "MAEIQBAKGAs="
}
...
```

### Relevant Logs

_No response_

### Browser(s) Affected

_No response_

### OS(s) Affected

_No response_

### Device(s) Affected

_No response_

### AMP Version Affected

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by running amp.validator.validateString against the provided missing-head and missing-body index.html reproductions, then compare the current validator_wasm.js output with the supplied validator.js snapshots. Trace how missing head and body tags are classified, and consider the issue done when both cases report the expected MANDATORY_TAG_MISSING errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, wasm
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.