Skip to content

feat: add self-contained HTML analyze reports - #265

Merged
yvonnedevlinrh merged 6 commits into
unbound-force:mainfrom
yvonnedevlinrh:opsx/add-analyze-html-output
Sep 17, 2026
Merged

yvonnedevlinrh merged 6 commits into
unbound-force:mainfrom
yvonnedevlinrh:opsx/add-analyze-html-output

Conversation

@yvonnedevlinrh

@yvonnedevlinrh yvonnedevlinrh commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add self-contained HTML output to gaze analyze for portable browser-based review and CI artifacts.

  • Render every analyzed function and side effect with inline CSS and native collapsible sections
  • Escape source-derived content with Go's html/template
  • Preserve existing text and JSON behavior
  • Restrict HTML support to gaze analyze
  • Document the new format and provide a website documentation issue draft

How to Test

go build -o gaze ./cmd/gaze
./gaze analyze --format=html ./internal/report > report.html
go test -race -count=1 ./internal/report/... ./internal/cliutil/...
go test -race -count=1 -run 'TestRunAnalyze_HTMLFormat|TestRunQuality_HTMLFormat|TestRunCrap_HTMLFormat' ./cmd/gaze/...

Verify report.html opens offline, contains collapsible function sections, and loads no external resources.

How to Demo

Run:
./gaze analyze --format=html ./internal/report > report.html
Open report.html in a browser and expand the function sections to inspect detected effects.

Key Files Changed

  • internal/report/html.go: deterministic HTML formatter
  • internal/report/analyze.html.tmpl: embedded self-contained template
  • internal/report/html_test.go: formatter and security coverage
  • internal/cliutil/cliutil.go: command-specific format extension
  • cmd/gaze/main.go: analyze HTML dispatch
  • docs/reference/cli/analyze.md: CLI reference
  • README.md: usage documentation
  • openspec/changes/add-analyze-html-output/: specification and review artifacts

Known Issues

  • LOW: The embedded template is parsed once per CLI invocation rather than cached.
  • LOW: Summary text uses function(s) and side effect(s) instead of conditional pluralization.

Documentation

unbound-force/website#283 has been created to track changes

Fixes #260

This PR was generated by /uf.finale (AI-assisted).

@yvonnedevlinrh
yvonnedevlinrh requested review from a team and jflowers and removed request for jflowers September 15, 2026 16:01
@yvonnedevlinrh yvonnedevlinrh self-assigned this Sep 15, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

🤖 Review · ⚠️ Cancelled · Started 4:03 PM UTC · Ended 4:05 PM UTC

Commit: 4177b45 · View workflow run →

- Render deterministic, escaped HTML with no external resources
- Scope HTML format support to analyze while preserving text and JSON
- Add formatter and CLI tests, documentation, and review artifacts

Assisted-by: gpt-5.6-sol
Generated with AI assistance (gpt-5.6-sol)
@yvonnedevlinrh
yvonnedevlinrh force-pushed the opsx/add-analyze-html-output branch from 4177b45 to 06f88ad Compare September 15, 2026 16:03
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 4:06 PM UTC · Completed 4:27 PM UTC

Commit: 06f88ad · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $12.42

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Sep 15, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Re-review with zero code changes since prior assessment — Tier 1 signals unchanged: large raw change size (1900 additions, 22 files) and one protected path (AGENTS.md), substantially mitigated by additive-only nature (new HTML output format, no modifications to existing behavior), strong test coverage, and well-scoped issue #260; score preserved from prior review.

Previous run

Risk Assessment: moderate (2/5)

Details

Moderate risk driven primarily by large raw change size (1900 additions across 22 files) and one protected path touch (AGENTS.md). Substantially mitigated by additive-only nature (new output format, no modifications to existing behavior), dominance of new files, strong test coverage (940-line html_test.go + 203-line main_test.go), well-scoped issue #260 with clear acceptance criteria all addressed, and no CI/dependency/security-sensitive changes. Score unchanged from prior assessment.

Previous run (2)

Risk Assessment: moderate (2/5)

Details

Moderate risk driven primarily by large raw change size (1872 additions across 20 files) and one protected path touch (AGENTS.md). Substantially mitigated by additive-only nature (new output format, no modifications to existing behavior), strong test coverage (940-line html_test.go + 203-line main_test.go), well-scoped issue with clear acceptance criteria, and no CI/dependency/security-sensitive changes.

@fullsend-ai-review

fullsend-ai-review Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Review

Findings

Medium

  • [protected-path] AGENTS.md — This file is under a protected path. The change updates "HTML stub" to "HTML" in the project structure tree and the PR links to issue feat: add self-contained HTML output for gaze analyze #260. Human approval is always required for protected-path changes regardless of context.
Previous run

Review

Findings

Medium

  • [protected-path] AGENTS.md — This file is under a protected path. The change updates "HTML stub" to "HTML" in the project structure tree and the PR links to issue feat: add self-contained HTML output for gaze analyze #260. Human approval is always required for protected-path changes regardless of context.
Previous run (2)

Review

Findings

Medium

  • [protected-path] AGENTS.md — This file is under a protected path. The change updates "HTML stub" to "HTML" in the project structure tree and the PR links to issue feat: add self-contained HTML output for gaze analyze #260. Human approval is always required for protected-path changes regardless of context.

  • [error-handling-idiom] internal/report/html.go:62 — WriteHTML parses the embedded HTML template on every call via template.ParseFS. Since the template is compiled into the binary via embed.FS, parsing cannot fail after tests pass. The Go idiom for embedded templates is to parse once at package level via template.Must, eliminating an unreachable error path and avoiding repeated parsing work. The PR body acknowledges this as a known low-priority issue.
    Remediation: var analyzeTemplate = template.Must(template.ParseFS(analyzeTemplateFS, "analyze.html.tmpl")) and use the pre-parsed template in WriteHTML.

  • [stale-doc] docs/architecture/overview.md:17 — The internal/report/ package description says "JSON and styled text formatters" but this PR adds an HTML formatter, making the description incomplete.
    Remediation: Update to "JSON, styled text, and HTML formatters."

  • [stale-doc] docs/architecture/overview.md:79 — The gaze analyze data flow says "report.WriteJSON or report.WriteText renders the output" but this PR adds report.WriteHTML as a third output path.
    Remediation: Update to include report.WriteHTML.

  • [stale-doc] docs/architecture/extending.md:189 — The "Adding a New Output Format" section says "Currently supported: JSON (json.go) and styled text (text.go)" but this PR adds html.go.
    Remediation: Update to include HTML (html.go).

Low

  • [incomplete-doc] docs/architecture/extending.md:219 — The "Wire into the CLI" instructions do not mention the new ValidateFormat variadic extra parameter. New format authors following this guide would add a switch case but miss the validation opt-in step.
    Remediation: Add a step about passing the format name to ValidateFormat as an extra argument.

  • [edge-case] internal/report/html.go:119 — tierCSSClass GoDoc says unknown tiers produce "the base .tier class only" but the template renders class="tier tier-" (trailing hyphen). Functionally harmless — no CSS rule matches tier-.

  • [api-shape-consistency] internal/report/html.go:56 — WriteHTML has no options struct unlike WriteText/WriteTextOptions. Not needed for the current scope but noted for future extensibility if HTML gains options.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

Addresses PR unbound-force#265 review feedback from @fullsend-ai-review[bot].

Signed-off-by: Yvonne Devlin <[email protected]>

Assisted-by: OpenCode (openai/gpt-5.6-sol)
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:42 PM UTC · Completed 2:00 PM UTC

Commit: 7d27905 · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $8.52

@fullsend-ai-review fullsend-ai-review Bot added the requires-manual-review Review requires human judgment label Sep 16, 2026
@yvonnedevlinrh

Copy link
Copy Markdown
Contributor Author

Addressed in 7d27905:

  • Updated the architecture package map and analyze data flow.
  • Updated the output-format extension guide and documented command-specific ValidateFormat extras.
  • Corrected the tierCSSClass GoDoc.

We are not adding HTMLOptions yet because HTML has no optional behaviour. OpenSpec D1 explicitly selected the current signature; an options type can be introduced when a concrete setting requires it.

@fullsend-ai-review

fullsend-ai-review Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 7:33 PM UTC · Completed 7:46 PM UTC

Commit: 06f88ad · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.25

@gxmiranda gxmiranda left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well-executed feature PR. The HTML formatter uses html/template for contextual escaping with no trusted type casts, the view model layer cleanly separates domain types from presentation, and ValidateFormat's variadic extension elegantly scopes HTML to analyze-only. Test coverage is thorough — 30+ cases covering rendering, adversarial escaping, determinism, error propagation, and CLI integration. All 7 acceptance criteria from #260 are met, all CI checks pass, and the implementation stays within declared scope.

This review was generated by /review-pr (AI-assisted).

@yvonnedevlinrh
yvonnedevlinrh merged commit db3655c into unbound-force:main Sep 17, 2026
45 checks passed
@yvonnedevlinrh
yvonnedevlinrh deleted the opsx/add-analyze-html-output branch September 17, 2026 09:05
@fullsend-ai-retro

fullsend-ai-retro Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 9:06 AM UTC · Completed 9:21 AM UTC

Commit: 7d27905 · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $6.49

@fullsend-ai-retro

Copy link
Copy Markdown

Retro: PR #265 — feat: add self-contained HTML analyze reports

Workflow quality: Good. This human-authored PR went through a clean triage → review → fix → re-review → approve → merge cycle in ~48 hours. The review agent caught 3 real stale-doc references that the author fixed, correctly flagged a protected-path change requiring human approval, and cleanly dropped resolved findings on re-review. Total agent cost was $27.22 (triage $1.03, three review runs $26.19).

Timeline

  1. Sep 15 08:35 — Issue feat: add self-contained HTML output for gaze analyze #260 created by yvonnedevlinrh
  2. Sep 15 08:36 — Triage agent runs ($1.03), labels as enhancement/feature
  3. Sep 15 16:01 — PR feat: add self-contained HTML analyze reports #265 opened (22 files, +1882/-18)
  4. Sep 15 16:06–16:27 — Review agent (commit 06f88ad, $12.42) finds 7 issues: 1 protected-path MEDIUM, 1 template.Must idiom MEDIUM, 3 stale-doc MEDIUMs, 3 LOWs. Requests changes.
  5. Sep 16 13:42–14:00 — Re-review (commit 7d27905, $8.52) after author fixes. Challenger removes template.Must and options-struct findings. Only protected-path remains.
  6. Sep 16 19:33–19:46 — Manual re-run on stale commit 06f88ad ($5.25). Produces identical findings to step 4 — zero new information.
  7. Sep 17 08:49 — Human reviewer (gxmiranda) approves via /review-pr.
  8. Sep 17 09:05 — Merged.

What went well

  • Doc staleness detection: Agent caught 3 real documentation gaps in docs/architecture/ that the human reviewer did not flag. All were fixed.
  • Clean re-review: On the fix commit, the agent correctly resolved 5 of 6 prior findings and the challenger appropriately removed the template.Must idiom finding as internally consistent.
  • Protected-path governance: Correctly persisted across all reviews, ensuring human sign-off on AGENTS.md changes.

Filtered proposals (already tracked)

One novel proposal filed

The review agent's correctness sub-agent applied a generic Go idiom rule (template.Must at package level) without reading the OpenSpec design document (D1) present in the same diff, which explicitly chose per-call parsing to return wrapped errors instead of panicking. The challenger caught this inconsistency on the second review pass but not the first, meaning the author had to respond to a finding that contradicted their own documented design decision. See proposal below.

Proposals skipped (target repo not allowed)

File manually or update create_issues.allow_targets in config.yaml:

  • Review sub-agents should read design documents in the PR diff before applying idiom rules (fullsend-ai/agents)

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

Labels

requires-manual-review Review requires human judgment risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add self-contained HTML output for gaze analyze

2 participants