Skip to content

fix(scenarios): FORBIDDEN_PUBLIC_LANGUAGE sanitizer regex diverged between two parallel public-safety guards #8885

Description

@JSONbored

⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.

Context

Commit 84fcb0960 (#913, "fix: sanitize reward ranking scenario snapshots") added estimated[-\s]?rewards?|rewards?|...|rankings? to src/scenarios/input-model.ts:32-33's regex but touched only that file and its test -- src/scenarios/scenario-summary.ts:95-96's own copy of the same-purpose guard (assertPublicSummaryClean, used by renderPublicScenarioSummary) still reads /wallet|hotkey|coldkey|mnemonic|seed phrase|payout|reward[-\s]?estimate|farming|raw trust|trust[-\s]?score|scoreability|private[-\s]?reviewability|public[-\s]?score[-\s]?(?:estimate|prediction)/i -- missing rewards?/estimated rewards/rankings? entirely.

Requirements

Sync the two regexes -- ideally extract one shared constant both files import -- so scenario-summary.ts's guard catches the same terms input-model.ts's does, and add a test to scenario-summary.test.ts asserting a headline/note containing bare "rewards" or "rankings" is caught, mirroring the #913 test added to scenario-input-model.test.ts.

Deliverables

  • The two forbidden-language regexes are synced (ideally via one shared exported constant) so both guards catch the identical term set
  • A test in scenario-summary.test.ts asserting a headline/note containing bare "rewards" or "rankings" is caught by assertPublicSummaryClean, mirroring Fix public scenario reward/ranking sanitization #913's test in scenario-input-model.test.ts

All of the above Deliverables are required in the same PR unless the deliverable text itself states otherwise.

Test Coverage Requirements

src/** -- 99%+ patch coverage, branch-counted, on the synced regex and its new test.

Expected Outcome

A public scenario summary containing bare 'rewards' or 'rankings' language is caught by assertPublicSummaryClean, closing a public-safety leak that the sibling guard already fixed.

Links & Resources

  • src/scenarios/input-model.ts:32-33
  • src/scenarios/scenario-summary.ts:95-96
  • test/unit/scenario-input-model.test.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions