Skip to content

fix(report): harden generic diagnostics title boundary - #1000

Merged
seonghobae merged 9 commits into
fix/report-main-focus-current-review-978from
fix/report-title-callback-safety-999
Aug 20, 2026
Merged

fix(report): harden generic diagnostics title boundary#1000
seonghobae merged 9 commits into
fix/report-main-focus-current-review-978from
fix/report-title-callback-safety-999

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Closes #999.

Direct child of #1002 at exact parent 52c7401bdec44a7a1e6194f0336617bfc5fe6eed; merge order is #1002 then #1000.

TDD lineage

  • RED 18137218ad3eb825a5b792cb3dd1cf8f568b1b62: public render_diagnostics_report() must reject a caller-defined str subclass before overridden __bool__ or replace() can execute, raise package-owned ValueError("title must be a string or None"), and create no output artifact. It also preserves the empty exact built-in string → default-title contract.
  • GREEN 54b374c9ebbd8412e2f7cf51bc6cc7684b1ff8b1: admit only None or an exact built-in str before truth-value testing and HTML escaping.
  • Evidence e58df9ae468f676e332616581f26a464cddd7e05: governed changelog fragment.
  • Strengthening 4d34e34e667109598eed7cb44555a6a072690681: prove an admitted exact built-in title remains escaped in both <title> and <h1> surfaces.
  • Stack sync 528d980c1613fd6326f4c5c59effc85e80fb98b2: record current fix(report): replay main focus accessibility on current review workflow #1002 parent ancestry after both branches restored protected-main's exact .Jules/palette.md blob.

Effective diff

Exactly three files relative to #1002:

  • python/fast_mlsirm/report.py — two-line exact-type admission plus stable error;
  • tests/test_report_title_callback_safety.py — hostile callback, default-title, and HTML-escaping regressions;
  • docs/changelog.d/999-report-title-callback-safety.md — authoritative release fragment.

Unrelated report-limit formatting churn was removed. .Jules/palette.md matches protected main exactly and is absent from the effective diff.

Ownership boundary

No report metric, fit statistic, model-selection result, likelihood, optimizer, or psychometric arithmetic changes. Python only validates the public title scalar before rendering. Keep Draft until fresh exact-head CI/security/review evidence for 528d980... is terminal; predecessor evidence does not transfer.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 801dbbdd-4221-4f86-af5d-bd9f707ef3b5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor Author

@opencode-agent Implement the GREEN on the current exact head 18137218ad3eb825a5b792cb3dd1cf8f568b1b62 of this existing branch.

Required minimal delta:

  1. In python/fast_mlsirm/report.py, replace resolved_title = title or _default_title(report_type) with one package-owned title-admission helper that:
    • returns _default_title(report_type) for title is None or an empty exact built-in string;
    • returns a non-empty exact built-in string unchanged;
    • rejects every other value, including str subclasses, with ValueError("title must be a string or None") before truth-value testing, .replace(), or HTML escaping can dispatch caller callbacks.
  2. Keep the RED tests in tests/test_report_title_callback_safety.py; do not weaken them.
  3. Add one bounded authoritative fragment docs/changelog.d/999-generic-report-title-boundary.md.
  4. Do not modify 🎨 Palette: [UX improvement] Improve focus styles for main content #978's focus CSS/tests, report metrics/tables, statistical code, aggregate CHANGELOG.md, locks, workflows, or unrelated files.
  5. Run the focused title test and relevant report tests. Commit to this same branch without force-push.

If the branch head moved, refetch it, inspect the delta, and apply only if compatible.

@seonghobae
seonghobae changed the base branch from palette/improve-main-focus-styling-1487165751651455508 to fix/report-main-focus-current-review-978 August 19, 2026 01:57

Copy link
Copy Markdown
Contributor Author

@opencode-agent Clean the current exact head 8cddc840aadf4c536f0aa6edb1a58f07cccf1b55 without changing behavior.

In python/fast_mlsirm/report.py, restore protected-main's original multiline formatting for exactly these four pre-existing raise ValueError(...) statements:

  • MAX_REPORT_METRICS in _metric_section;
  • MAX_REPORT_ROWS and MAX_REPORT_CELLS in _rows_from_columnar;
  • MAX_REPORT_ROWS in _validate_report_rows.

Preserve the two intentional changes in the same file:

Do not touch tests, changelog fragments, CSS beyond that selector, locks, aggregate CHANGELOG, workflows, or other files. Commit to the same branch without force-push after refetching the exact head.

Record the current parent branch in the title-boundary child after both branches restored protected-main's exact palette blob. No product behavior changes.
@seonghobae
seonghobae marked this pull request as ready for review August 19, 2026 12:18
@seonghobae
seonghobae marked this pull request as draft August 19, 2026 14:57
@seonghobae
seonghobae marked this pull request as ready for review August 20, 2026 04:39
@seonghobae

Copy link
Copy Markdown
Contributor Author

@opencode-agent review
@cwl-noema-review review

The draft is ready after exact-head validation. Re-review head 528d980c1613fd6326f4c5c59effc85e80fb98b2 against base fix/report-main-focus-current-review-978; use current source and Checks only. Local generic diagnostics-report title validation passed 3 tests covering hostile title rejection before callbacks/artifact creation, default-title compatibility, and HTML escaping.

@seonghobae
seonghobae merged commit 776963d into fix/report-main-focus-current-review-978 Aug 20, 2026
10 checks passed
@seonghobae
seonghobae deleted the fix/report-title-callback-safety-999 branch August 20, 2026 04:39
seonghobae added a commit that referenced this pull request Aug 24, 2026
…ow (#1002)

* 🎨 Palette: [UX improvement] Improve focus styles for main content

Modifies the `:focus` rule on `<main>` to `:not(:focus-visible)` in `report.py` to ensure keyboard focus rings appear while suppressing mouse click rings.

* test(report): lock pointer and keyboard focus selectors

* docs(palette): normalize focus guidance formatting

* chore(report): remove bot-local palette artifact

* chore(report): restore protected-main palette artifact

* fix(report): harden generic diagnostics title boundary (#1000)

* test(report): reject hostile generic report titles

* fix(report): reject title subclasses before callbacks

* docs(changelog): record report title callback hardening

* test(report): preserve title HTML escaping contract

* chore(report): remove bot-local palette artifact

* chore(report): restore protected-main palette artifact

* chore(report): match protected-main palette blob exactly

* test(report): require modality-safe focus containers

* fix(report): preserve keyboard focus on scroll containers

* test(report): require modality-safe disclosure focus

* fix(report): preserve keyboard focus on disclosures

* test: align report focus contract

---------

Co-authored-by: seonghobae <8172694+seonghobae@users.noreply.github.com>
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