w3c / w3c/json-ld-api

context overflow definition seems like it is off by 1

Open
#576 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ErratumRaised spec:bug substantive:class 3
Dominant language
HTML
Stars
106
Forks
40
PR merge metrics
No merged PRs in 30d

Description

The Context Overflow definition from the Context Processing Algorithm, 5.2.3 reads as follows:

If the number of entries in the remote contexts array exceeds a processor defined limit, a context overflow error has been detected and processing is aborted; otherwise, add context to remote contexts.

Technically what this would seem to mean is that if your processor defined limit is 3 then:

  • [a; b; c] -> no error because the number of entries is equal to the limit. Then after this step it will be [a; b; c; d] and will not fail until it reaches this code the next time (presumably while processing e).
  • [a; b; c; d] -> throws an error but only when the first part of this statement is encountered.

In this edge case this could produce a valid resulting context that has a remote contexts array one larger than the processor defined limit.

It would seem that one of three things should happen here:

  1. Switch the order of the statements. Add context to remote contexts and then make the statement that "if the number of entries in the remote contexts array exceeds…"
  2. Change the language to be "equal to" instead of "exceeds." So it would now read "if the number of entries in the remote contexts array is equal to a processor defined limit…" This does not allow for duplicate entries in the array to be merged together if read strictly (and there is no indication of deduplication anywhere I can see in the description of remote contexts at this time)
  3. Define the size of the remote context array as having an event (possibly expressed somewhere else) that reads "if the size of the remote contexts array is ever made to be greater than a processor defined limit, then generate a context overflow error…"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Context Processing Algorithm section 5.2.3 and the linked context-overflow definition. Trace the limit check against the [a; b; c; d] example and compare the three proposed interpretations; this is done when the specification clearly defines whether adding an entry beyond the limit must raise an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.