Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions crates/tiles/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ impl Origin {
Ok(self)
}

/// Retains this trusted origin's address while narrowing its observed reach.
/// This constructor is for in-process transport/UI code, never document deserialization.
/// Records the address and reach observed by trusted in-process transport/UI code. The
/// observed peer can be local even when the address's spelling looks public; this does not
/// narrow a previous origin. Never use document data as the observed reach.
Comment on lines +63 to +65

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.

Nit (Quality, confidence: high). This is a constructor, so "this does not narrow a previous origin" has no previous origin to refer to. The PR's point is that it is not a narrowing operation, so saying so with the right method is clearer:

Suggested change
/// Records the address and reach observed by trusted in-process transport/UI code. The
/// observed peer can be local even when the address's spelling looks public; this does not
/// narrow a previous origin. Never use document data as the observed reach.
/// Records the address and reach observed by trusted in-process transport/UI code. The
/// observed peer can be local even when the address's spelling looks public. This is not a
/// narrowing operation: use `narrow_reach` to lower an existing origin's reach. Never use
/// document data as the observed reach.

Optional, and it can wait for the release quality pass.

pub fn with_observed_reach(url: &str, reach: Reach) -> Result<Self, String> {
check_reach(url, Reach::Local)?;
if reach == Reach::Forbidden {
Expand Down
2 changes: 2 additions & 0 deletions crates/tiles/src/geocode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ impl Geocoder {
found.limited = entries.len().saturating_sub(i);
break;
}
// An overlong label is a malformed Census response, not a candidate with no usable
// position: refuse it whole rather than shorten or substitute its matched address.
Comment on lines +258 to +259

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.

Comment overstates the behaviour (Quality, confidence: high). The check sits after the MAX_RESULTS cap in the loop above. An overlong label among the entries past the cap is never inspected: it is counted in found.limited and the answer is accepted. "Refuse it whole" is only true for labels read before the cap.

Suggested wording that matches the code:

Suggested change
// An overlong label is a malformed Census response, not a candidate with no usable
// position: refuse it whole rather than shorten or substitute its matched address.
// An overlong label is a malformed Census response, not a candidate with no usable
// position: refuse the whole answer rather than shorten or substitute its matched address.
// Only the entries read before the cap are checked; withheld ones are counted, not inspected.

The cap-ordering case is also untested: the test near line 480 only puts the overlong label at position 1. Per AGENTS.md this is a wording point, so it can wait for the release quality pass if the author prefers; the current text is still inaccurate.

if self.kind == Kind::Census
&& e.get("matchedAddress").and_then(Value::as_str).is_some_and(|name| name.chars().nth(500).is_some())
{
Expand Down
Loading