Skip to content

Pin the over-cap well-known handling offline, at the resolver - #238

Merged
aterga merged 3 commits into
mainfrom
fix/stale-oisy-discover-test
Nov 17, 2026
Merged

aterga merged 3 commits into
mainfrom
fix/stale-oisy-discover-test

Conversation

@aterga

@aterga aterga commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Right now, only the live test on multidex.ai checks how resolve_declared_origin treats an over-cap well-known body. That coverage lasts only while multidex.ai keeps serving its SPA shell at /.well-known/ii-derivation-origin. oisy.com already stopped doing that, which is what broke the test and led to #237.

This PR adds two offline tests that drive the resolver itself against a loopback server. They pin both the behavior and the overflow policy the resolver picks for each path, and no longer depend on what a live site serves.

The live test from #237 is unchanged and still checks real-world behavior. This PR originally reworked that live test. Since #237 fixed it on main, the branch now merges main and keeps only the offline coverage.

Related issues

Follow-up to #237.

Changes

All changes are in crates/imcp2-core/src/discover.rs: two tests, a test helper, and one doc comment.

  • an_over_cap_layer5_page_declares_nothing
    • Setup: a page larger than MAX_DERIVATION_ORIGIN_BYTES at the Layer 5 path, and no legacy manifest.
    • Expected: resolution falls through to the application-origin default (AppUrlDefault). It must not be read as a failed check, a mistake that once refused to resolve healthy apps.
    • Fails if the Layer 5 probe's policy becomes Overflow::Unknown.
  • an_over_cap_legacy_manifest_is_not_read_as_absent
    • Setup: an over-cap /.well-known/ic-app.json.
    • Expected: resolution refuses, rather than defaulting past a declaration the manifest may carry.
    • Fails if the legacy probe's policy becomes Overflow::NotTheDocument.
  • serve_paths: a small std::net::TcpListener server that answers by path and returns 404 for anything else.
    • The tests call resolve_declared_origin directly, because resolve_app_identity's SSRF guard refuses loopback.
    • The client uses no_proxy(), so the tests also run behind an HTTP proxy.
  • Overflow::NotTheDocument doc: no longer says OISY serves that page. It now points to the offline test.

This addresses Copilot's review point: the previous version tested fetch_well_known with the policy passed in, so it would have missed the resolver choosing the wrong policy.

Testing

  • Each new test fails exactly when its own path's policy is flipped in resolve_declared_origin, and passes otherwise.
  • cargo build --locked --all-targets
  • cargo test --locked --workspace --all-targets: all pass (imcp2 lib 90, bin 8, routers 11; imcp2-core 219; imcp2-local 21).
  • cargo fmt --all / cargo clippy --workspace --all-targets (tree is warning-free)
  • npm test --prefix monitoring/mcp-status (n/a, dashboard untouched)

Checklist

  • I have read the Contributing guidelines.
  • Docs (README / comments) updated for any user-visible change.
  • No secrets, credentials, or internal-only information are included.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VP2vTJm9ipTPD18xW9HyVG

`resolve_app_identity_skips_probe_for_known_apps` resolved oisy.com and
expected `DerivationSource::Known`. oisy.com now publishes its own
/.well-known/ii-derivation-origin (`https://oisy.com`), and the app's own
declaration deliberately wins over the registry, so it resolves as
`Declared` and the test failed on main and on every PR. The test also pinned
the over-cap Layer 5 regression on oisy.com serving its SPA shell there,
which it no longer does.

- The live test now checks three registry apps that still declare nothing
  (nns.internetcomputer.org, multidex.ai, app.icpswap.com). Each must
  resolve to its registry derivation origin, unprobed, either via the
  registry (`Known`) or via its own agreeing declaration (`Declared`), and
  at least one must still go through the registry. One app adopting the
  declaration no longer breaks the test.
- The over-cap regression gets an offline test,
  `an_over_cap_layer5_body_reads_as_no_declaration`: a loopback listener
  serves an oversized page, and `fetch_well_known` must read it as `Absent`
  under `Overflow::NotTheDocument` and `Unreachable` under
  `Overflow::Unknown`.
- `Overflow::NotTheDocument`'s doc no longer says OISY serves that page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VP2vTJm9ipTPD18xW9HyVG
aterga pushed a commit that referenced this pull request Nov 10, 2026
main now carries #237's fix for the stale oisy.com discover test, so the
copy of #238's version this branch carried is dropped in favour of main's
discover.rs, and #200's auth.rs changes merge cleanly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VP2vTJm9ipTPD18xW9HyVG
@aterga
aterga requested a max review from Copilot November 11, 2026 12:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The offline test supplies Overflow::NotTheDocument directly, so it would miss a regression in resolve_declared_origin that restores resolution failures for oversized pages.

1 open issue
What changed in this PR

Updates imcp2-core identity-discovery tests to tolerate known apps publishing derivation-origin declarations, while moving oversized-response regression coverage offline.

Changes:

  • Checks three registry apps, accepting matching Known or Declared results while requiring at least one registry fallback.
  • Adds a loopback regression test for both overflow policies.
  • Replaces the OISY-specific doc comment with a reference to the offline test.
File Description
crates/​imcp2-core/​src/​discover.rs Revises live known-app checks, adds offline overflow coverage, and updates documentation.

Review effort: Max

Comment thread crates/imcp2-core/src/discover.rs Resolved
main fixed the stale oisy.com test in #237 (pinned on multidex.ai), so this
takes main's discover.rs as-is; the offline coverage follows on top.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VP2vTJm9ipTPD18xW9HyVG
The only coverage of how `resolve_declared_origin` treats an over-cap
well-known body was the live test on multidex.ai, which holds only while
that site keeps serving its SPA shell at the Layer 5 path (oisy.com
stopped, and the test broke). Two loopback tests now drive the resolver
itself, so the overflow policy it picks for each path is pinned too:

- `an_over_cap_layer5_page_declares_nothing`: an SPA page over
  MAX_DERIVATION_ORIGIN_BYTES at /.well-known/ii-derivation-origin and no
  legacy manifest resolve to the application-origin default, not a failed
  check. Fails if the Layer 5 probe's policy becomes `Overflow::Unknown`.
- `an_over_cap_legacy_manifest_is_not_read_as_absent`: an over-cap
  /.well-known/ic-app.json makes resolution refuse, rather than default
  past a declaration it may carry. Fails if the legacy probe's policy
  becomes `Overflow::NotTheDocument`.

`serve_paths` is the small loopback server both use; the resolver is called
directly because `resolve_app_identity`'s SSRF guard refuses loopback. The
`Overflow::NotTheDocument` doc no longer says OISY serves that page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VP2vTJm9ipTPD18xW9HyVG
@aterga aterga changed the title Stop pinning the known-app discover test to oisy.com's live content Pin the over-cap well-known handling offline, at the resolver Nov 16, 2026
@aterga
aterga marked this pull request as ready for review November 16, 2026 20:56
@aterga
aterga requested review from a team and a max review from Copilot November 16, 2026 20:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the offline resolver regression-test additions.

No open issues 🎉

1 resolved since last review

Review effort: Max

@aterga
aterga merged commit e4e3532 into main Nov 17, 2026
17 checks passed
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.

4 participants