Skip to content

report: fold canonical query-string variants in the cloud builder, smart-audit union and entity map (follow-up to #858) #1350

Description

@nc9

Follow-up to #858 (PR #1348 folds query-string variants into their canonical page in the CLI report, squirrel audit and squirrel report, fresh crawls only).

Problem

The same fold is not applied everywhere a page is counted:

  • the hosted container's report builder (buildV1Report / cloud publish) still lists a variant as a page and counts it in affected pages;
  • a smart audit's union (carried pages) is not folded, so coverage.knownPages and carried findings still count variants;
  • the entity map lists every crawled URL, so entities.summary.pagesTotal can exceed meta.totalPages by the number of folded variants.

Expected

The helpers canonicalVariantMap and foldChecksToCanonical (packages/audit-engine/src/canonical-groups.ts) are applied in the cloud report builder and the smart-audit union, and the entity map either excludes variants or states how many it lists, so every page count in a report agrees.

Acceptance Criteria

  • A hosted audit of a site with a query-string variant that declares another crawled page as its canonical reports one affected page and a page total without the variant, with meta.canonicalVariants set.
  • A smart audit that carries pages folds carried variants the same way, and coverage.knownPages agrees with meta.totalPages.
  • entities.summary.pagesTotal equals meta.totalPages or the report states the number of variants the entity map still lists.
  • A site with no variants reports byte-identically to before in all three paths.
  • Tests cover the cloud builder and the smart-audit union with a variant and a paginated page that has its own canonical.

nik

Activity

  1. added
    size: M
    rules
    on Oct 30, 2026
  2. added theissue type on Oct 30, 2026
  3. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Part of this shipped in v0.0.145: the entity map fold and the shared report builder fold (with a byte-identical check when there is nothing to fold). Met: criterion 3. Open: criterion 2 and 5 (a smart audit's union of carried pages is not folded yet), criterion 4 for the union path and criterion 1 (the hosted builder option is not turned on by anything in this repo). Leaving this open.

    nik

  4. nc9 commented on Oct 31, 2026

    @nc9
    ContributorAuthor

    Looked at what is left (criteria 1, 2, 4 for the union, 5): it is not buildable from this repo alone. A smart audit's carried pages live in the site_pages and findings rows the hosted store keeps, and SitePageRecord (packages/core-contracts/src/storage.ts) carries no canonical URL, so mergeSmartAudits cannot tell a carried query-string variant from a page of its own, and coverage.knownPages comes from the store's active page count. Folding them needs the canonical (or its fold target) recorded per site page at publish time, a hosted schema change, plus the hosted builder turning on the shared fold option (nothing in this repo does). Until that is decided there, a public PR would only pin today's counts. Leaving the issue open for the hosted side.

    nik

  5. nc9 commented on Nov 2, 2026

    @nc9
    ContributorAuthor

    Status as of v0.0.159: this stays open. The remaining criteria (1, 2, 4 for the smart-audit union, and 5) need the canonical page recorded per site page in the hosted store and the hosted report builder to turn on the shared fold option, which is a change outside this repository; it is tracked privately. Criterion 3 is already ticked.

    nik

  6. nc9 commented on Nov 11, 2026

    @nc9
    ContributorAuthor

    The remaining criteria need the hosted side first: the site page record has to carry the canonical URL, and the hosted report builder has to enable the fold. Tracked privately; this issue closes when that ships.

    nik

  7. added
    enhancement
    on Nov 12, 2026
  8. nc9 commented on Nov 13, 2026

    @nc9
    ContributorAuthor

    The CLI and engine side shipped in squirrel v0.0.180 (see the v0.0.180 section of CHANGELOG.md). Kept open until the hosted (cloud) side meets the remaining acceptance criteria.

  9. nc9 commented on Nov 16, 2026

    @nc9
    ContributorAuthor

    The public side is done in v0.0.180. The remaining criteria (1, 2, 4 and the hosted-builder part of 5) need the hosted report builder to use the fold. That work is in the private cloud code and is tracked there. This issue stays open until it ships.

  10. nc9 commented on Nov 16, 2026

    @nc9
    ContributorAuthor

    Correction to my earlier comment: the hosted side has shipped. The cloud runtime exports query-string variants, and the API folds them after scoring and sets canonicalVariants on the report. Tests cover a variant, carried pages and a site with no variants. The one remaining piece is folding the published entity map, which is tracked privately. This should be ready to accept once that lands.

  11. added
    blocked
    on Nov 20, 2026
  12. nc9 commented on Nov 20, 2026

    @nc9
    ContributorAuthor

    The public side is complete on main at 9994763. bun test packages/audit-engine/tests/canonical-variants-report-1350.test.ts packages/audit-engine/tests/canonical-variants-merge-1350.test.ts gives 26 pass, 0 fail, covering the report and merge paths, a site with no variants staying byte-identical, the entity-map fold helpers, and the paginated-canonical case.

    One piece is left: folding the published entity map in the hosted build, which is tracked privately. Blocked on that. This gets accepted once it lands.

    nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedenhancementrulessize: M

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions