Skip to content

probe: recognise an empty SPA shell, send a SPA to its API before its sitemap - #4

Merged
lfoletti merged 2 commits into
mainfrom
sonde-spa-coquille
Nov 4, 2026
Merged

lfoletti merged 2 commits into
mainfrom
sonde-spa-coquille

Conversation

@lfoletti

@lfoletti lfoletti commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Why

A real audit of a court database built with Angular CLI showed two faults in sap probe:

  • The served HTML is an empty shell: <app-root></app-root>, module scripts, 1 visible word. Modern Angular builds do not write ng-version in the served HTML, and the inlined CSS made the shell 130 KB (other shells pass 200 KB). The probe reported SPA probable : False.
  • The site has a small sitemap, so the probe chose tier 1 « Sitemap ». Every address in that sitemap serves the same empty shell. The usable path was the data API that the application calls (found by reading main-*.js and the chunks as text, as the skill says).

What

  • visible_words(html): the words outside scripts, styles, noscript and template.
  • Angular is also recognised by <app-root.
  • SPA: (a known framework, or an empty mount element with module scripts) and fewer than 50 visible words. The old rule stays, with a bound on visible words.
  • _decide_tier_doors: a SPA goes to tier 4 before the sitemap, with the hint « chercher l'API de données dans le code de l'application (scripts lus comme texte, jamais exécutés), sinon Chrome » and a note that the sitemap only lists addresses.

Failing first

Without the change in accesspath/probe.py, 3 of the 4 tests of tests/test_spa_coquille.py fail (the fourth checks that a page with text is not a SPA):

git stash push -- accesspath/probe.py && python -m pytest -q tests/test_spa_coquille.py; git stash pop

Full suite: 781 passed. Live probe on the audited site: tier 4, frameworks: ['angular'], SPA probable : True.

… its sitemap

Angular CLI builds serve <app-root></app-root> without ng-version, and inlined CSS can make the shell larger than 200 KB. The probe saw no SPA and chose the sitemap (tier 1), whose addresses all serve the same empty shell. visible_words() counts the text outside scripts and styles; an empty mount element with module scripts, or a known framework, with fewer than 50 visible words is a SPA. A SPA now goes to tier 4 with the hint to read the application code for its data API, before the sitemap.
@lfoletti
lfoletti marked this pull request as ready for review November 4, 2026 19:07
@lfoletti
lfoletti merged commit 2a72de2 into main Nov 4, 2026
5 checks passed
@lfoletti
lfoletti deleted the sonde-spa-coquille branch November 4, 2026 19:27
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.

1 participant