Repository navigation
Mark a usage sharing value with invalid characters as escaped, as the specification says - #71
Draft
jwrosewell wants to merge 6 commits into
Draft
jwrosewell wants to merge 6 commits into
jwrosewell wants to merge 6 commits into
Conversation
…values at 10,000 characters A character XML 1.0 does not allow is written as its code in four lower-case hexadecimal digits after a backslash and x, and the element is marked escaped. A value is cut to 10,000 characters (code points) before the markup characters are written, and the element is marked truncated.
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.
Problem
For the list of gaps between the pipeline libraries and the specification (the Java list
pipeline/Gaps-vs-spec.mdand the .NET issues #23 to #29).The usage sharing record differs from the usage sharing element specification, Processing section in three ways.
replaced="true". The specification defines the attribute asescaped: "escaped - Indicates that the original evidence value included invalid characters, which have been replaced with escaped ones."\xfollowed by the code of the character as four lower-case hexadecimal digits, for example\x001f, and the element for that Evidence entry is markedescaped="true"."truncated="true"." The limit counts code points and never splits a character.Python writes no CDATA and no
BadSchemaelement, which matches the specification, and a test asserts both stay absent. This does not follow specifications#65 or python#8.What changed
All changes are in
pipeline/fiftyone_pipeline_engines_fiftyone/src/fiftyone_pipeline_engines_fiftyone/share_usage.py.escaped="true".ReplacedStringchecks each character against the XML 1.0 Char production (tab, line feed, carriage return, U+0020 to U+D7FF, U+E000 to U+FFFD and U+10000 to U+10FFFF). A character outside it is written as a backslash,xand four lower-case hexadecimal digits, for example\x001f,\xd800or\xfffe. Tab, line feed, carriage return and characters such as U+018C are now kept as they are.SHARE_USAGE_MAX_EVIDENCE_LENGTHis 10,000. The value is cut before the markup characters are written, so&counts as one character. The code works onstr, so the cut is on code points and a character outside the Basic Multilingual Plane is never split. A value that is not astris converted withstr()first. A test puts an emoji at the boundary.Not changed, for a decision
I read the whole Processing section against the code and found differences that were not part of this request. I left them alone.
DateSentis written as local time with fractions of a second (datetime.now().isoformat()). The specification says "in UTC and formatted as: yyyy-mm-ddThh:nn:ss".FlowElementholds the class name only (for exampleSequenceElement). The specification says "the fully qualified class name".ServerIPis not written.SessionId,Sequence,ClientIP,DateSent).warnwhen it is registered to too many or no pipelines, andLogger.logaccepts onlydebug,info,warning,errorandcritical, so that call raisesValueError.Overlap with other drafts
#53 changes
share_usage.pynear the top of the file and inadd_to_share_usage, and #61 changes it at other lines. My edits are the length constant, one attribute line inadd_to_share_usageand theReplacedStringblock at the end of the file. The constant may need a small merge with #53's imports and constants hunks. The release draft #67 was left alone.How it was verified
New tests are in
pipeline/fiftyone_pipeline_engines_fiftyone/tests/test_share_usage_record.py. Two existing tests intest_usage.py(test_invalid_charandtest_truncated_value) now expect the new form and limit.b6ebdd60: run 42695689144, usage sharing 47 passed, engines 9 passed, core 354 passed.b6ebdd603c04f66c5c823504ef30197103e62d51: run 42695707525. All 11 non-macOS jobs passed, and everySetting 'PullRequestSha'line read (Configure, Ubuntu_Python_3.12 and Windows_Python_3.14) equals the head. The run was cancelled while its 5 macOS jobs were queued.macOS was left out of this draft's full build under the 9 November decision. The rc head is built with macOS before it merges into main.
The last release into
mainmerged on 2026-11-04.