Skip to content

Add cache-header audit design spec for ts dev audit headers - #930

Open
vasujain00 wants to merge 3 commits into
IABTechLab:mainfrom
vasujain00:spec/834-audit-headers
Open

Add cache-header audit design spec for ts dev audit headers#930
vasujain00 wants to merge 3 commits into
IABTechLab:mainfrom
vasujain00:spec/834-audit-headers

Conversation

@vasujain00

Copy link
Copy Markdown
Collaborator

Technical spec for epic #834: origin cache-header audit with per-content-type cacheability diagnostics. Covers content-type taxonomy, cacheability rules for all five directives (Cache-Control, Surrogate-Control, Surrogate-Key, Vary, ETag), per-type verdict rollup, CLI integration into the ts dev group, and a 7-task implementation breakdown.

Closes #835

Summary

Changes

File Change

Closes

Closes #

Test plan

  • cargo test-fastly && cargo test-axum
  • cargo clippy-fastly && cargo clippy-axum
  • cargo fmt --all -- --check
  • JS tests: cd crates/trusted-server-js/lib && npx vitest run
  • JS format: cd crates/trusted-server-js/lib && npm run format
  • Docs format: cd docs && npm run format
  • WASM build: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve
  • Other:

Checklist

  • Changes follow CLAUDE.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses tracing macros (not println!)
  • New code has tests
  • No secrets or credentials committed

@aram356 aram356 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

The spec is a solid starting shape for ts dev audit headers (clear taxonomy, verdict rollup, task breakdown), but several load-bearing claims about the codebase are stale or incorrect — ts dev is already a subcommand tree, there is no CliError enum, reqwest is not a CLI dependency, and the discovery section probes edge-only /_ts/ routes against the publisher origin. Two cacheability rules also fail the strictest correct configuration, and the doc itself is what's breaking the format-docs CI check.

Details are in the inline comments (8 blocking 🔧, 5 🤔, 1 ♻️, 2 🌱, 2 ⛏). Cross-cutting items below.

Blocking

🔧 wrench

  • format-docs CI failure: prettier rejects this file's tables — cd docs && npm run format:write (line 30)
  • Dependency graph must be mermaid: docs use vitepress-plugin-mermaid; ASCII art won't render (line 391)
  • Stale ts dev premise: DevCommand subcommand tree already exists on main; no Serve to default to (lines 254, 289)
  • CliError doesn't exist: CLI errors are CliResult<T> = Result<T, String> (line 271)
  • reqwest is not a CLI dep + target scoping unaddressed: workspace default target is wasm32-wasip1; spec must say where deps are scoped and that audit is cross-platform, unlike the macOS-only proxy (line 323)
  • Discovery probes edge routes against origin: /_ts/* paths 404 on publisher.origin_url (line 131)
  • Wrong issue link: #293 text links to /issues/834 (line 7)
  • HTML/RTB rules fail no-store alone: RFC 9111's strongest posture would FAIL the audit (lines 75, 106)

Non-blocking

📌 out of scope

  • Plan document and epic breakdown still pending: issue #835 asks for a spec and a plan under docs/superpowers/plans/ plus a task breakdown in epic #834; this PR delivers the spec only (Section 10 is a partial plan). Also, the PR body retains the unfilled template (empty Summary/Changes tables, dangling Closes #).

CI Status

  • format-docs: FAIL (caused by this file)
  • All other checks (fmt, clippy targets, Rust/JS tests, integration, parity, CodeQL): PASS

Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
ChristianPavilonis

This comment was marked as low quality.

@ChristianPavilonis
ChristianPavilonis requested review from ChristianPavilonis and removed request for ChristianPavilonis August 14, 2026 18:52
Vasu Jain added 2 commits August 21, 2026 11:38
Technical spec for epic IABTechLab#834: origin cache-header audit with
per-content-type cacheability diagnostics. Covers content-type
taxonomy, cacheability rules for all five directives (Cache-Control,
Surrogate-Control, Surrogate-Key, Vary, ETag), per-type verdict
rollup, CLI integration into the ts dev group, and a 7-task
implementation breakdown.

Closes IABTechLab#835
Resolves all 8 blocking 🔧 items from @aram356's review:

1. format-docs CI: ran prettier (tables now padded correctly)
2. Dependency graph: replaced ASCII art with mermaid flowchart
3. Stale ts dev premise: rewrote §8.1 to add Audit variant to existing
   DevCommand enum (no Serve default, no DevArgs invention)
4. CliError: corrected §8.2 to use existing CliResult<T>/cli_error() pattern
5. reqwest scoping: added §8.3 explaining cfg(not(wasm32)) dep scoping
   and cross-platform requirement for audit (unlike macOS-only proxy)
6. Discovery probes: rewrote §5 to HTML-parse origin root page instead
   of probing edge-only /_ts/ routes against origin
7. Issue link: fixed [IABTechLab#293] to link to IABTechLab/issues/293 (was linking IABTechLab/issues/834)
8. HTML/RTB no-store rules: no-store alone now passes per RFC 9111 §5.2.2.5

Non-blocking items also addressed:
- Verdict: changed to unit enum (messages on HeaderVerdict)
- Author: corrected @Vasujai to @vasujain00
- s-maxage: added to audited headers with explanation
- Vary: now evaluated on all cacheable groups (not just HTML)
- application/woff*: removed (redundant with font/*)
- Content-Type param stripping: documented in §3
- Module path: corrected to commands/dev/audit/headers/
@vasujain00
vasujain00 force-pushed the spec/834-audit-headers branch from cf69725 to e268913 Compare August 21, 2026 18:53
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
Comment thread docs/superpowers/specs/2026-07-14-cache-header-audit-design.md Outdated
@aram356

aram356 commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

@vasujain00 Thank you for addressing Please implement it per spec. You can use this pr for the implementation as well.

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.

Create spec and plan to audit publsher origin headers

3 participants