feat(notices): validated contract for host-supplied notices - #2666
Open
camielvs wants to merge 3 commits into
Open
feat(notices): validated contract for host-supplied notices#2666camielvs wants to merge 3 commits into
camielvs wants to merge 3 commits into
Conversation
Collaborator
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Aug 26, 2026
🎩 PreviewA preview build has been created at: |
camielvs
commented
Aug 26, 2026
camielvs
commented
Aug 26, 2026
camielvs
commented
Aug 26, 2026
camielvs
commented
Aug 26, 2026
camielvs
commented
Aug 26, 2026
camielvs
commented
Aug 26, 2026
camielvs
force-pushed
the
banners-02-primitives
branch
from
August 26, 2026 23:45
dc471e3 to
ac56d12
Compare
camielvs
force-pushed
the
banners-03-contract
branch
from
August 26, 2026 23:45
a100783 to
eb0c6de
Compare
Adds the boundary an embedding page talks to: it may install a notice source on the window, and this module reads it defensively. Every field is validated and normalised, a malformed entry is dropped rather than trusted, and a source that declares an unsupported version is ignored wholesale. Headless and unreferenced — nothing renders these yet. Reviewable on its own, with the test file as the argument for what the boundary does and does not let through.
Collapse duplicate ids to the first occurrence and cap a snapshot at 20 entries, so a malformed host cannot produce duplicate React keys or unbounded per-render validation work. Freeze each banner rather than only the array — a mutated banner used to poison the signature cache for the life of the page, since the signature is computed before a consumer can reach the object. Declare __TANGLE_BANNER_SOURCE__ as unknown, which is what it is, and the cast in the test source helper disappears. Add BANNERS.md documenting the host-facing contract, in particular that the tangle:banner-source event is required after assigning the global. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Notices are the domain concept; banners are one of the two surfaces they are shown on. Renames the config module, its global and event, and the contract doc to match, before any host depends on the old names. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
camielvs
force-pushed
the
banners-02-primitives
branch
from
August 27, 2026 01:18
ac56d12 to
3a5d8f1
Compare
camielvs
force-pushed
the
banners-03-contract
branch
from
August 27, 2026 01:18
d9ad21b to
4fb20f2
Compare
camielvs
commented
Aug 27, 2026
|
|
||
| declare global { | ||
| interface Window { | ||
| __TANGLE_NOTICE_SOURCE__?: unknown; |
Collaborator
Author
There was a problem hiding this comment.
This is typed to unknown but guarded by isNoticeSource, so only TangleNotice will work. TangleNotice is Tangle-UI's expectation of the blind contract and thus this is the shape the source will need to provide.
camielvs
marked this pull request as ready for review
August 28, 2026 00:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Why
An embedding page needs a way to put a notice in front of users — a maintenance window, a migration deadline — without waiting on one of our releases. That means reading data we don't control, so this PR is only the boundary, reviewable before anything renders it.
What
A host may install a notice source on the window. This module reads it and declines to trust it:
http(s)URLsNothing imports this yet: no UI, no runtime surface. The test file is the argument — it walks through what the boundary does and doesn't let through, including the shapes we'd rather not crash on.
Reviewer notes
Standalone behaviour is unchanged, and stays that way. With no source installed, this returns an empty list forever, so a clean checkout behaves exactly as it does today.
knip.jsongains an ignore entry, because the module has no importer until PR 4. The old announcements entry stays until the file it names is actually deleted, also in PR 4.