Skip to content

Fix URI::relative_to emitting relative references that do not round-trip - #2716

Merged
jviotti merged 3 commits into
mainfrom
fix-uris-relative
Aug 9, 2026
Merged

Fix URI::relative_to emitting relative references that do not round-trip#2716
jviotti merged 3 commits into
mainfrom
fix-uris-relative

Conversation

@jviotti

@jviotti jviotti commented Aug 9, 2026

Copy link
Copy Markdown
Member

Signed-off-by: Juan Cruz Viotti jv@jviotti.com

Review in cubic

…-trip

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@cla-assistant

cla-assistant Bot commented Aug 9, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cla-assistant

cla-assistant Bot commented Aug 9, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@augmentcode

augmentcode Bot commented Aug 9, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR corrects URI::relative_to cases that produced references unable to resolve back to the original target.

Changes:

  • Moves empty-base-path handling before prefix and sibling-path shortening.
  • Distinguishes bases with an authority from rootless scheme bases when handling leading slashes.
  • Preserves root paths when relativizing against an authority-only base.
  • Emits ./ when the target is the containing directory of a file-like base.
  • Keeps query and fragment components on the generated relative references.
  • Adds round-trip tests for HTTP, file, authority-only, and rootless-scheme URIs.

Technical Notes: The behavior follows RFC 3986 merge and dot-segment resolution semantics, especially for empty base paths and directory targets.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot 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.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

// rootless path instead. A path of just "/" names the root either way
if (base.host_.has_value() && relative_path.starts_with('/') &&
relative_path.length() > 1) {
relative_path.erase(0, 1);

@augmentcode augmentcode Bot Aug 9, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

At src/core/uri/resolution.cc:210, this also removes one slash from paths with repeated leading slashes. For example, relative-to https://example.com, target https://example.com//foo becomes /foo, which resolves to https://example.com/foo even though sequential slashes are preserved by this URI implementation.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@github-actions github-actions Bot 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.

Benchmark (macos/llvm)

Details
Benchmark suite Current: 6072166 Previous: 4f3d3f8 Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 2.26306360380312 ns/iter 1.7165295835958607 ns/iter 1.32
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 1.8703563099325753 ns/iter 1.5706007524527903 ns/iter 1.19
Regex_Period_Asterisk 2.244200946205131 ns/iter 1.6538698383228794 ns/iter 1.36
Regex_Group_Period_Asterisk_Group 1.8319059278504073 ns/iter 1.6164908350631342 ns/iter 1.13
Regex_Period_Plus 2.381173469500979 ns/iter 1.8842491506961594 ns/iter 1.26
Regex_Period 2.461573871195884 ns/iter 1.8892991706366498 ns/iter 1.30
Regex_Caret_Period_Plus_Dollar 2.55546780071412 ns/iter 2.1016533192589533 ns/iter 1.22
Regex_Caret_Group_Period_Plus_Group_Dollar 2.526635085566193 ns/iter 1.8969349903627117 ns/iter 1.33
Regex_Caret_Period_Asterisk_Dollar 1.974849200493485 ns/iter 1.5784274836091643 ns/iter 1.25
Regex_Caret_Group_Period_Asterisk_Group_Dollar 1.974922299830384 ns/iter 1.5751302445026072 ns/iter 1.25
Regex_Caret_X_Hyphen 7.862969583054606 ns/iter 5.9365259320090225 ns/iter 1.32
Regex_Period_Md_Dollar 22.266525932043592 ns/iter 16.514842227606092 ns/iter 1.35
Regex_Caret_Slash_Period_Asterisk 5.128431602510533 ns/iter 4.1995097241211266 ns/iter 1.22
Regex_Caret_Period_Range_Dollar 2.7230691295721265 ns/iter 2.0656621626709115 ns/iter 1.32
Regex_Nested_Backtrack 31.194212290259102 ns/iter 27.394928092364342 ns/iter 1.14
JSON_Array_Of_Objects_Unique 346.6289816221664 ns/iter 360.3034111449203 ns/iter 0.96
JSON_Parse_1 7069.258897166382 ns/iter 6620.676092214782 ns/iter 1.07
JSON_Parse_Real 6192.352645264674 ns/iter 6765.649388632319 ns/iter 0.92
JSON_Parse_Decimal 7353.799367526711 ns/iter 8882.805632930198 ns/iter 0.83
JSON_Parse_Schema_ISO_Language 4431083.125628084 ns/iter 4369701.388888814 ns/iter 1.01
JSON_Parse_Integer 4728.079202962224 ns/iter 5819.120947075323 ns/iter 0.81
JSON_Parse_String_NonSSO_Plain 7633.841462532783 ns/iter 8909.844006087016 ns/iter 0.86
JSON_Parse_String_SSO_Plain 2667.843043924364 ns/iter 3468.882712808859 ns/iter 0.77
JSON_Parse_String_Escape_Heavy 23576.469878835676 ns/iter 27259.03139692009 ns/iter 0.86
JSON_Parse_Object_Short_Keys 8139.457436797103 ns/iter 9583.567756779561 ns/iter 0.85
JSON_Parse_Object_Scalar_Properties 4510.526610260411 ns/iter 5257.566032712645 ns/iter 0.86
JSON_Parse_Object_Array_Properties 6598.399463908502 ns/iter 9725.621178852569 ns/iter 0.68
JSON_Parse_Object_Object_Properties 7484.5870748305 ns/iter 9231.689527163748 ns/iter 0.81
JSON_Parse_Nested_Containers 57751.37784090909 ns/iter 65015.84907527311 ns/iter 0.89
JSON_From_String_Copy 23.176330681145895 ns/iter 31.565437798167448 ns/iter 0.73
JSON_From_String_Temporary 19.206365448773727 ns/iter 24.01418338246809 ns/iter 0.80
JSON_Number_To_Double 30.806861035136947 ns/iter 34.65294725910286 ns/iter 0.89
JSON_Object_At_Last_Key/8 3.8656220513507034 ns/iter 4.132938186637804 ns/iter 0.94
JSON_Object_At_Last_Key/32 11.544324496442968 ns/iter 12.373413477421144 ns/iter 0.93
JSON_Object_At_Last_Key/128 55.60840666356956 ns/iter 55.4035056262658 ns/iter 1.00
JSON_Object_At_Last_Key/512 186.3445415092811 ns/iter 192.99439570883652 ns/iter 0.97
JSON_Fast_Hash_Helm_Chart_Lock 58.281871501417434 ns/iter 58.86259916135198 ns/iter 0.99
JSON_Equality_Helm_Chart_Lock 133.51682099689518 ns/iter 138.455012944156 ns/iter 0.96
JSON_Divisible_By_Decimal 167.7245214115434 ns/iter 183.36414268853446 ns/iter 0.91
JSON_String_Equal/10 6.732343816848241 ns/iter 7.166127167595446 ns/iter 0.94
JSON_String_Equal/100 6.28496457724924 ns/iter 6.782343572111458 ns/iter 0.93
JSON_String_Equal_Small_By_Perfect_Hash/10 0.35786010001711144 ns/iter 0.3739678603420136 ns/iter 0.96
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 3.0007710720964 ns/iter 3.465542327202613 ns/iter 0.87
JSON_String_Fast_Hash/10 2.3109420953258195 ns/iter 2.4056935446666934 ns/iter 0.96
JSON_String_Fast_Hash/100 2.144473778296513 ns/iter 2.055552674573652 ns/iter 1.04
JSON_String_Key_Hash/10 1.6439829973037552 ns/iter 1.7629743699257192 ns/iter 0.93
JSON_String_Key_Hash/100 2.226119934612795 ns/iter 2.0886864548171253 ns/iter 1.07
JSON_Object_Defines_Miss_Same_Length 2.8169548477422537 ns/iter 2.74207424489461 ns/iter 1.03
JSON_Object_Defines_Miss_Too_Small 2.843391559072537 ns/iter 2.7096589588835847 ns/iter 1.05
JSON_Object_Defines_Miss_Too_Large 2.596688072014446 ns/iter 2.754306941599492 ns/iter 0.94
Pointer_Object_Traverse 22.892334705462396 ns/iter 22.365596014846375 ns/iter 1.02
Pointer_Object_Try_Traverse 24.68278726377112 ns/iter 20.667401027837155 ns/iter 1.19
Pointer_Push_Back_Pointer_To_Weak_Pointer 171.72528877436704 ns/iter 165.76068016232634 ns/iter 1.04
Pointer_Walker_Schema_ISO_Language 2560169.625000044 ns/iter 2620467.592592825 ns/iter 0.98
Pointer_Maybe_Tracked_Deeply_Nested/0 1133832.1105352174 ns/iter 1175740.3691815073 ns/iter 0.96
Pointer_Maybe_Tracked_Deeply_Nested/1 1023455.6725544486 ns/iter 1027473.7776097993 ns/iter 1.00
Pointer_Position_Tracker_Get_Deeply_Nested 338.0450528891885 ns/iter 308.2034343647506 ns/iter 1.10
JSONPath_Descendant_Filter_Nested 1349.1898717506888 ns/iter 1223.230601982235 ns/iter 1.10
URITemplateRouter_Create 21804.449914457604 ns/iter 22359.432352371674 ns/iter 0.98
URITemplateRouter_Match 159.47751974316495 ns/iter 172.7869639409466 ns/iter 0.92
URITemplateRouter_Match_BasePath 247.37382568603132 ns/iter 222.018157570896 ns/iter 1.11
URITemplateRouterView_Restore 11440.48205397295 ns/iter 11787.924814163916 ns/iter 0.97
URITemplateRouterView_Match 167.6628213307413 ns/iter 137.80772274609077 ns/iter 1.22
URITemplateRouterView_Match_BasePath 171.1380375288105 ns/iter 167.05019182582672 ns/iter 1.02
URITemplateRouterView_Arguments 529.0331023943896 ns/iter 609.1843719852228 ns/iter 0.87
JSONL_Parse_Large 9536890.972602945 ns/iter 13772878.426229013 ns/iter 0.69
JSONL_Parse_Large_GZIP 10407297.880596187 ns/iter 13569865.021738876 ns/iter 0.77
JSONLD_Catalog_Annotation_List_Populate 936484.8586809067 ns/iter 1091411.5442280069 ns/iter 0.86
JSONLD_Catalog_Materialize 4153988.165680777 ns/iter 5489204.429687255 ns/iter 0.76
HTML_Build_Table_100000 34765377.100001164 ns/iter 39495718.74999691 ns/iter 0.88
HTML_Render_Table_100000 1441829.4145297038 ns/iter 1913704.291044934 ns/iter 0.75
GZIP_Compress_ISO_Language_Set_3_Locations 25784393.68965613 ns/iter 29231102.458335083 ns/iter 0.88
GZIP_Decompress_ISO_Language_Set_3_Locations 2997002.1152070337 ns/iter 3849447.5470589777 ns/iter 0.78
GZIP_Compress_ISO_Language_Set_3_Schema 1455774.7448977851 ns/iter 2002680.5929916312 ns/iter 0.73
GZIP_Decompress_ISO_Language_Set_3_Schema 275038.2966828326 ns/iter 348783.8304914629 ns/iter 0.79
JOSE_VerifySignature_RS256 21480.633217611743 ns/iter 29150.817279045907 ns/iter 0.74
JOSE_VerifySignature_ES512 963316.044502604 ns/iter 1481804.5977011642 ns/iter 0.65

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions github-actions Bot 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.

Benchmark (linux/gcc)

Details
Benchmark suite Current: 6072166 Previous: 4f3d3f8 Ratio
JOSE_VerifySignature_RS256 22157.646662447954 ns/iter 22387.180401244394 ns/iter 0.99
JOSE_VerifySignature_ES512 580472.7659222715 ns/iter 578170.8168316934 ns/iter 1.00
GZIP_Compress_ISO_Language_Set_3_Locations 36114995.10526827 ns/iter 37160019.05262913 ns/iter 0.97
GZIP_Decompress_ISO_Language_Set_3_Locations 4135205.404762267 ns/iter 4518255.366013191 ns/iter 0.92
GZIP_Compress_ISO_Language_Set_3_Schema 2021737.864161862 ns/iter 2035843.069767304 ns/iter 0.99
GZIP_Decompress_ISO_Language_Set_3_Schema 382221.92244669754 ns/iter 382572.52648825676 ns/iter 1.00
HTML_Build_Table_100000 61794961.63635825 ns/iter 63830904.727276236 ns/iter 0.97
HTML_Render_Table_100000 1908245.1989098575 ns/iter 2024467.0201151066 ns/iter 0.94
JSONLD_Catalog_Annotation_List_Populate 1463396.457805852 ns/iter 1514348.6638478586 ns/iter 0.97
JSONLD_Catalog_Materialize 6920872.14563079 ns/iter 7586705.472527973 ns/iter 0.91
JSONL_Parse_Large 13563350.431372425 ns/iter 14080647.4901963 ns/iter 0.96
JSONL_Parse_Large_GZIP 14873782.914893571 ns/iter 15184556.425530918 ns/iter 0.98
URITemplateRouter_Create 29788.18264529338 ns/iter 30339.81318966817 ns/iter 0.98
URITemplateRouter_Match 157.84590401075747 ns/iter 157.3378999341223 ns/iter 1.00
URITemplateRouter_Match_BasePath 184.29830508565186 ns/iter 180.19591551238355 ns/iter 1.02
URITemplateRouterView_Restore 8461.417354008297 ns/iter 8606.387370279146 ns/iter 0.98
URITemplateRouterView_Match 123.80755710329774 ns/iter 124.08809847618083 ns/iter 1.00
URITemplateRouterView_Match_BasePath 142.3605250848061 ns/iter 143.54836534081213 ns/iter 0.99
URITemplateRouterView_Arguments 473.75834719593576 ns/iter 478.65843483784863 ns/iter 0.99
JSONPath_Descendant_Filter_Nested 1686.813759129318 ns/iter 1726.8275783220045 ns/iter 0.98
Pointer_Object_Traverse 30.485120045954552 ns/iter 30.66411478470703 ns/iter 0.99
Pointer_Object_Try_Traverse 25.721062570206282 ns/iter 25.783560416575686 ns/iter 1.00
Pointer_Push_Back_Pointer_To_Weak_Pointer 149.3945728673123 ns/iter 148.5639358989194 ns/iter 1.01
Pointer_Walker_Schema_ISO_Language 2495163.4777776403 ns/iter 3151123.942477605 ns/iter 0.79
Pointer_Maybe_Tracked_Deeply_Nested/0 1805620.400000104 ns/iter 1851076.6117021784 ns/iter 0.98
Pointer_Maybe_Tracked_Deeply_Nested/1 1698211.466183735 ns/iter 1731042.9242054082 ns/iter 0.98
Pointer_Position_Tracker_Get_Deeply_Nested 516.8421451985425 ns/iter 513.7500840885405 ns/iter 1.01
JSON_Array_Of_Objects_Unique 471.67708786314915 ns/iter 481.5906972887546 ns/iter 0.98
JSON_Parse_1 9534.63677931894 ns/iter 9678.914704944336 ns/iter 0.99
JSON_Parse_Real 7843.785706302024 ns/iter 7950.516802380781 ns/iter 0.99
JSON_Parse_Decimal 13066.20283466304 ns/iter 13125.979839158585 ns/iter 1.00
JSON_Parse_Schema_ISO_Language 6579427.859813044 ns/iter 7020427.272727325 ns/iter 0.94
JSON_Parse_Integer 5835.92522646616 ns/iter 5708.011415898698 ns/iter 1.02
JSON_Parse_String_NonSSO_Plain 12009.0165292105 ns/iter 12173.658082631511 ns/iter 0.99
JSON_Parse_String_SSO_Plain 5013.46285837769 ns/iter 5118.828804863297 ns/iter 0.98
JSON_Parse_String_Escape_Heavy 26050.595967862388 ns/iter 25977.035655919328 ns/iter 1.00
JSON_Parse_Object_Short_Keys 13632.805124511278 ns/iter 13982.691792863561 ns/iter 0.97
JSON_Parse_Object_Scalar_Properties 7043.654403724437 ns/iter 6972.3617550244 ns/iter 1.01
JSON_Parse_Object_Array_Properties 12108.625188784932 ns/iter 11792.04826645134 ns/iter 1.03
JSON_Parse_Object_Object_Properties 11837.896314111795 ns/iter 11994.433012155316 ns/iter 0.99
JSON_Parse_Nested_Containers 97735.9984511451 ns/iter 99648.9490096908 ns/iter 0.98
JSON_From_String_Copy 17.62050840368071 ns/iter 18.171388029078404 ns/iter 0.97
JSON_From_String_Temporary 15.351251077375249 ns/iter 15.356735465068143 ns/iter 1.00
JSON_Number_To_Double 21.205689627910242 ns/iter 20.888863748768447 ns/iter 1.02
JSON_Object_At_Last_Key/8 5.896615912011586 ns/iter 5.616133151768572 ns/iter 1.05
JSON_Object_At_Last_Key/32 21.883414588368606 ns/iter 21.495519875656065 ns/iter 1.02
JSON_Object_At_Last_Key/128 87.86294064488418 ns/iter 88.32386058110778 ns/iter 0.99
JSON_Object_At_Last_Key/512 395.1559450314742 ns/iter 392.6744403221852 ns/iter 1.01
JSON_Fast_Hash_Helm_Chart_Lock 75.45213799519163 ns/iter 76.17742586896557 ns/iter 0.99
JSON_Equality_Helm_Chart_Lock 146.53020747774858 ns/iter 143.2325965785417 ns/iter 1.02
JSON_Divisible_By_Decimal 257.47406504361544 ns/iter 259.42789082911315 ns/iter 0.99
JSON_String_Equal/10 5.418153735393152 ns/iter 5.537444474174974 ns/iter 0.98
JSON_String_Equal/100 6.041424268157421 ns/iter 6.0535894840227416 ns/iter 1.00
JSON_String_Equal_Small_By_Perfect_Hash/10 0.740097001286883 ns/iter 0.7403414915482054 ns/iter 1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 25.19091108383572 ns/iter 25.598935966988776 ns/iter 0.98
JSON_String_Fast_Hash/10 2.6069546609335825 ns/iter 2.607574395278998 ns/iter 1.00
JSON_String_Fast_Hash/100 2.6129019386048324 ns/iter 2.6073149480028457 ns/iter 1.00
JSON_String_Key_Hash/10 1.2459513573257415 ns/iter 1.2515704696786574 ns/iter 1.00
JSON_String_Key_Hash/100 12.448737114160735 ns/iter 12.442336758778008 ns/iter 1.00
JSON_Object_Defines_Miss_Same_Length 2.807850925689589 ns/iter 2.80382251600881 ns/iter 1.00
JSON_Object_Defines_Miss_Too_Small 3.425704616937397 ns/iter 3.4388713234217994 ns/iter 1.00
JSON_Object_Defines_Miss_Too_Large 3.114733510119788 ns/iter 3.1291271008907784 ns/iter 1.00
Regex_Lower_S_Or_Upper_S_Asterisk 0.6225698672129255 ns/iter 0.623272230234 ns/iter 1.00
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 0.6228676550007314 ns/iter 0.6232681567931322 ns/iter 1.00
Regex_Period_Asterisk 0.6225870173620638 ns/iter 0.623282875602208 ns/iter 1.00
Regex_Group_Period_Asterisk_Group 0.6234168817732794 ns/iter 0.6228879478119888 ns/iter 1.00
Regex_Period_Plus 0.6230117828743252 ns/iter 0.6235515292553929 ns/iter 1.00
Regex_Period 0.6230332167327598 ns/iter 0.6230779400937542 ns/iter 1.00
Regex_Caret_Period_Plus_Dollar 0.6257518532799717 ns/iter 0.636843636712294 ns/iter 0.98
Regex_Caret_Group_Period_Plus_Group_Dollar 0.6225769942763236 ns/iter 0.6225485732732551 ns/iter 1.00
Regex_Caret_Period_Asterisk_Dollar 0.6233350546385188 ns/iter 0.6231094573654359 ns/iter 1.00
Regex_Caret_Group_Period_Asterisk_Group_Dollar 0.6233370711728484 ns/iter 0.6229242744153274 ns/iter 1.00
Regex_Caret_X_Hyphen 3.739680101996225 ns/iter 3.74035706332252 ns/iter 1.00
Regex_Period_Md_Dollar 28.382447707906525 ns/iter 30.880599335095905 ns/iter 0.92
Regex_Caret_Slash_Period_Asterisk 4.04817243707902 ns/iter 4.066944372558693 ns/iter 1.00
Regex_Caret_Period_Range_Dollar 1.245568224107955 ns/iter 1.2469185327268446 ns/iter 1.00
Regex_Nested_Backtrack 41.01285142152177 ns/iter 39.765742499665976 ns/iter 1.03

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions github-actions Bot 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.

Benchmark (linux/llvm)

Details
Benchmark suite Current: 6072166 Previous: 4f3d3f8 Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 2.5670520351723325 ns/iter 2.5042906105288143 ns/iter 1.03
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 2.8011436154178497 ns/iter 2.825703730409194 ns/iter 0.99
Regex_Period_Asterisk 2.8038477453905175 ns/iter 2.8137769331081053 ns/iter 1.00
Regex_Group_Period_Asterisk_Group 2.4902325147918574 ns/iter 2.4986023198500904 ns/iter 1.00
Regex_Period_Plus 3.1159964151936173 ns/iter 3.137678057924795 ns/iter 0.99
Regex_Period 3.4241849126213015 ns/iter 3.4412560787558686 ns/iter 1.00
Regex_Caret_Period_Plus_Dollar 3.4498532231027874 ns/iter 3.423830576451116 ns/iter 1.01
Regex_Caret_Group_Period_Plus_Group_Dollar 3.111675324859663 ns/iter 3.1162944106065287 ns/iter 1.00
Regex_Caret_Period_Asterisk_Dollar 3.7347575067615106 ns/iter 3.735112093390736 ns/iter 1.00
Regex_Caret_Group_Period_Asterisk_Group_Dollar 4.0454481858966895 ns/iter 4.045566917912534 ns/iter 1.00
Regex_Caret_X_Hyphen 7.4768542903372825 ns/iter 6.239119437601082 ns/iter 1.20
Regex_Period_Md_Dollar 27.537655019771226 ns/iter 27.57078052507923 ns/iter 1.00
Regex_Caret_Slash_Period_Asterisk 7.468825377483141 ns/iter 6.698899547222958 ns/iter 1.11
Regex_Caret_Period_Range_Dollar 4.670747820739787 ns/iter 3.471273164315521 ns/iter 1.35
Regex_Nested_Backtrack 47.11282598791376 ns/iter 47.26409421695142 ns/iter 1.00
JSON_Array_Of_Objects_Unique 423.53613243626245 ns/iter 419.63369019107586 ns/iter 1.01
JSON_Parse_1 4882.077799193149 ns/iter 4870.100464393142 ns/iter 1.00
JSON_Parse_Real 5356.357754805458 ns/iter 5469.874526489308 ns/iter 0.98
JSON_Parse_Decimal 7791.049973023971 ns/iter 8221.74124118802 ns/iter 0.95
JSON_Parse_Schema_ISO_Language 3503838.9696970773 ns/iter 3526109.020407839 ns/iter 0.99
JSON_Parse_Integer 3791.078251779618 ns/iter 3940.899972010756 ns/iter 0.96
JSON_Parse_String_NonSSO_Plain 5019.703069195109 ns/iter 5189.960934625995 ns/iter 0.97
JSON_Parse_String_SSO_Plain 2719.2867153206544 ns/iter 2828.3230258156386 ns/iter 0.96
JSON_Parse_String_Escape_Heavy 14594.964371139735 ns/iter 14609.430729284757 ns/iter 1.00
JSON_Parse_Object_Short_Keys 10324.667969038177 ns/iter 7636.682388803231 ns/iter 1.35
JSON_Parse_Object_Scalar_Properties 3962.160313647108 ns/iter 3951.0080135952985 ns/iter 1.00
JSON_Parse_Object_Array_Properties 5494.3988793937 ns/iter 5651.854510262048 ns/iter 0.97
JSON_Parse_Object_Object_Properties 5487.056426504481 ns/iter 5429.5813439472495 ns/iter 1.01
JSON_Parse_Nested_Containers 45647.38440438803 ns/iter 45655.26074778578 ns/iter 1.00
JSON_From_String_Copy 20.28833210824696 ns/iter 20.57342605350966 ns/iter 0.99
JSON_From_String_Temporary 17.440953129182432 ns/iter 17.807126761813723 ns/iter 0.98
JSON_Number_To_Double 24.0747286873633 ns/iter 23.75850352767065 ns/iter 1.01
JSON_Object_At_Last_Key/8 3.9316248187027494 ns/iter 3.83149240974011 ns/iter 1.03
JSON_Object_At_Last_Key/32 12.216307567596525 ns/iter 12.218244297188843 ns/iter 1.00
JSON_Object_At_Last_Key/128 48.66356345540709 ns/iter 48.633732946667166 ns/iter 1.00
JSON_Object_At_Last_Key/512 398.5271861638657 ns/iter 399.5037172853902 ns/iter 1.00
JSON_Fast_Hash_Helm_Chart_Lock 60.35642178047645 ns/iter 60.10969594524027 ns/iter 1.00
JSON_Equality_Helm_Chart_Lock 188.29318994353306 ns/iter 170.8454220211073 ns/iter 1.10
JSON_Divisible_By_Decimal 245.39188287709584 ns/iter 255.68021272171916 ns/iter 0.96
JSON_String_Equal/10 5.917660899202513 ns/iter 6.861926962455027 ns/iter 0.86
JSON_String_Equal/100 6.542722533016525 ns/iter 6.541824626142196 ns/iter 1.00
JSON_String_Equal_Small_By_Perfect_Hash/10 0.9379790881311346 ns/iter 0.9401144421773284 ns/iter 1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 14.926484326985534 ns/iter 14.928437111126087 ns/iter 1.00
JSON_String_Fast_Hash/10 2.801858172656058 ns/iter 2.8021466131570434 ns/iter 1.00
JSON_String_Fast_Hash/100 2.8031929609401574 ns/iter 2.8382199991205486 ns/iter 0.99
JSON_String_Key_Hash/10 2.7454754765014053 ns/iter 2.7371572441445404 ns/iter 1.00
JSON_String_Key_Hash/100 9.079641045485168 ns/iter 9.02527388833222 ns/iter 1.01
JSON_Object_Defines_Miss_Same_Length 3.1523602702134648 ns/iter 3.070388835476462 ns/iter 1.03
JSON_Object_Defines_Miss_Too_Small 3.426486041650724 ns/iter 3.4257129902160672 ns/iter 1.00
JSON_Object_Defines_Miss_Too_Large 2.6809030677967165 ns/iter 2.814477338238958 ns/iter 0.95
Pointer_Object_Traverse 28.53591129259688 ns/iter 28.677040765785584 ns/iter 1.00
Pointer_Object_Try_Traverse 31.32474541405239 ns/iter 32.03420644740097 ns/iter 0.98
Pointer_Push_Back_Pointer_To_Weak_Pointer 219.38398749234588 ns/iter 222.8484549082733 ns/iter 0.98
Pointer_Walker_Schema_ISO_Language 2551571.2883212264 ns/iter 2618719.5318354242 ns/iter 0.97
Pointer_Maybe_Tracked_Deeply_Nested/0 1204208.4652777638 ns/iter 1203698.80789017 ns/iter 1.00
Pointer_Maybe_Tracked_Deeply_Nested/1 1564656.333333308 ns/iter 1546876.2350332236 ns/iter 1.01
Pointer_Position_Tracker_Get_Deeply_Nested 678.3373881453203 ns/iter 644.3051450271878 ns/iter 1.05
JSONPath_Descendant_Filter_Nested 1567.0189695965394 ns/iter 1585.2720353448885 ns/iter 0.99
URITemplateRouter_Create 31300.155170847684 ns/iter 31180.079597520766 ns/iter 1.00
URITemplateRouter_Match 183.40438765394353 ns/iter 176.10415458333728 ns/iter 1.04
URITemplateRouter_Match_BasePath 204.26049188438253 ns/iter 205.61345336930455 ns/iter 0.99
URITemplateRouterView_Restore 8450.44207501697 ns/iter 8472.85653660385 ns/iter 1.00
URITemplateRouterView_Match 158.7199844934455 ns/iter 162.0075766561952 ns/iter 0.98
URITemplateRouterView_Match_BasePath 193.8596609381643 ns/iter 192.04907815275718 ns/iter 1.01
URITemplateRouterView_Arguments 444.5920070223286 ns/iter 441.84456746510705 ns/iter 1.01
JSONL_Parse_Large 9624003.890411437 ns/iter 9639893.821919056 ns/iter 1.00
JSONL_Parse_Large_GZIP 11237401.306452226 ns/iter 11309415.935483553 ns/iter 0.99
JSONLD_Catalog_Annotation_List_Populate 1320482.2457466677 ns/iter 1329924.4810605678 ns/iter 0.99
JSONLD_Catalog_Materialize 4293774.178344172 ns/iter 4318883.549382306 ns/iter 0.99
HTML_Build_Table_100000 63322799.27273083 ns/iter 64215733.545448855 ns/iter 0.99
HTML_Render_Table_100000 5178967.91791033 ns/iter 5520428.533333188 ns/iter 0.94
GZIP_Compress_ISO_Language_Set_3_Locations 32525139.428571492 ns/iter 32556210.619044837 ns/iter 1.00
GZIP_Decompress_ISO_Language_Set_3_Locations 4052078.075581443 ns/iter 4057587.2774567185 ns/iter 1.00
GZIP_Compress_ISO_Language_Set_3_Schema 1862648.5186170512 ns/iter 1870139.2925529394 ns/iter 1.00
GZIP_Decompress_ISO_Language_Set_3_Schema 355763.08555328834 ns/iter 355776.1517948585 ns/iter 1.00
JOSE_VerifySignature_RS256 58402.56439109111 ns/iter 58601.053320002866 ns/iter 1.00
JOSE_VerifySignature_ES512 2425306.311418835 ns/iter 2411991.038327486 ns/iter 1.01

This comment was automatically generated by workflow using github-action-benchmark.

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/core/uri/resolution.cc Outdated

@github-actions github-actions Bot 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.

Benchmark (windows/msvc)

Details
Benchmark suite Current: 6072166 Previous: 4f3d3f8 Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 5.3934294642853535 ns/iter 2.397766738395014 ns/iter 2.25
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 5.109959999999774 ns/iter 2.3423152875637774 ns/iter 2.18
Regex_Period_Asterisk 5.213692000002084 ns/iter 2.3642484348612682 ns/iter 2.21
Regex_Group_Period_Asterisk_Group 5.114637000001494 ns/iter 2.3498042384487436 ns/iter 2.18
Regex_Period_Plus 4.932413392858897 ns/iter 2.331763725076386 ns/iter 2.12
Regex_Period 5.094994642856169 ns/iter 2.401957363390872 ns/iter 2.12
Regex_Caret_Period_Plus_Dollar 4.855184821431229 ns/iter 2.377511716096895 ns/iter 2.04
Regex_Caret_Group_Period_Plus_Group_Dollar 5.017549999997755 ns/iter 2.4119136133794408 ns/iter 2.08
Regex_Caret_Period_Asterisk_Dollar 5.362587499998231 ns/iter 2.411838124999832 ns/iter 2.22
Regex_Caret_Group_Period_Asterisk_Group_Dollar 5.121073999998771 ns/iter 2.369031071428448 ns/iter 2.16
Regex_Caret_X_Hyphen 8.873508928571384 ns/iter 6.018124107143308 ns/iter 1.47
Regex_Period_Md_Dollar 44.71651076144404 ns/iter 26.066399951332496 ns/iter 1.72
Regex_Caret_Slash_Period_Asterisk 8.284728980871721 ns/iter 5.678556249999848 ns/iter 1.46
Regex_Caret_Period_Range_Dollar 5.996086999998624 ns/iter 3.1758215674622687 ns/iter 1.89
Regex_Nested_Backtrack 55.25266071426164 ns/iter 35.170875880543534 ns/iter 1.57
JSON_Array_Of_Objects_Unique 591.2002678570616 ns/iter 461.2610181385339 ns/iter 1.28
JSON_Parse_1 8926.433035715118 ns/iter 6569.213392856861 ns/iter 1.36
JSON_Parse_Real 16121.219338520172 ns/iter 10848.367187499265 ns/iter 1.49
JSON_Parse_Decimal 11841.699999998971 ns/iter 8414.275382699654 ns/iter 1.41
JSON_Parse_Schema_ISO_Language 7200502.222222996 ns/iter 7603744.444443489 ns/iter 0.95
JSON_Parse_Integer 6196.258999998463 ns/iter 4167.7449683113955 ns/iter 1.49
JSON_Parse_String_NonSSO_Plain 7831.560714285908 ns/iter 5891.276785715961 ns/iter 1.33
JSON_Parse_String_SSO_Plain 3597.144514666138 ns/iter 2644.293796888103 ns/iter 1.36
JSON_Parse_String_Escape_Heavy 21541.875000011147 ns/iter 20456.03563345015 ns/iter 1.05
JSON_Parse_Object_Short_Keys 13394.485714286475 ns/iter 9239.53955562676 ns/iter 1.45
JSON_Parse_Object_Scalar_Properties 6882.5723214282725 ns/iter 4746.680907769021 ns/iter 1.45
JSON_Parse_Object_Array_Properties 11293.626562498104 ns/iter 8243.633928571066 ns/iter 1.37
JSON_Parse_Object_Object_Properties 11596.2015624973 ns/iter 8431.864143464016 ns/iter 1.38
JSON_Parse_Nested_Containers 79332.90178568443 ns/iter 58453.14000000599 ns/iter 1.36
JSON_From_String_Copy 66.73445535714758 ns/iter 45.27197727435957 ns/iter 1.47
JSON_From_String_Temporary 59.05601785713088 ns/iter 52.82343999999739 ns/iter 1.12
JSON_Number_To_Double 120.13566071427054 ns/iter 81.80047991070336 ns/iter 1.47
JSON_Object_At_Last_Key/8 7.385421875001035 ns/iter 6.868769000000156 ns/iter 1.08
JSON_Object_At_Last_Key/32 23.61150308469033 ns/iter 19.143968559966844 ns/iter 1.23
JSON_Object_At_Last_Key/128 90.83236201640024 ns/iter 79.88195312498598 ns/iter 1.14
JSON_Object_At_Last_Key/512 425.0318124999808 ns/iter 257.12770567531817 ns/iter 1.65
JSON_Fast_Hash_Helm_Chart_Lock 103.74325000000795 ns/iter 68.54498883929035 ns/iter 1.51
JSON_Equality_Helm_Chart_Lock 208.8260420166611 ns/iter 212.82934375001616 ns/iter 0.98
JSON_Divisible_By_Decimal 300.07103793845397 ns/iter 236.47952717862455 ns/iter 1.27
JSON_String_Equal/10 10.875357812501818 ns/iter 9.043300223213281 ns/iter 1.20
JSON_String_Equal/100 11.808412500004449 ns/iter 12.15796249999812 ns/iter 0.97
JSON_String_Equal_Small_By_Perfect_Hash/10 2.5393725000006793 ns/iter 1.3069462500003022 ns/iter 1.94
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 14.204250000001853 ns/iter 9.112366030748213 ns/iter 1.56
JSON_String_Fast_Hash/10 6.681066071426552 ns/iter 2.996027232142191 ns/iter 2.23
JSON_String_Fast_Hash/100 6.6567491071428515 ns/iter 3.050672652164721 ns/iter 2.18
JSON_String_Key_Hash/10 5.371645000000171 ns/iter 3.1913765674860963 ns/iter 1.68
JSON_String_Key_Hash/100 11.919318749995966 ns/iter 7.841862723214632 ns/iter 1.52
JSON_Object_Defines_Miss_Same_Length 3.7925255289411943 ns/iter 3.9875973731914276 ns/iter 0.95
JSON_Object_Defines_Miss_Too_Small 4.136200141314695 ns/iter 3.481870396345853 ns/iter 1.19
JSON_Object_Defines_Miss_Too_Large 3.812580357142841 ns/iter 3.432868861607779 ns/iter 1.11
Pointer_Object_Traverse 68.11669642858526 ns/iter 36.47226515755865 ns/iter 1.87
Pointer_Object_Try_Traverse 71.50421874995467 ns/iter 40.58463169643391 ns/iter 1.76
Pointer_Push_Back_Pointer_To_Weak_Pointer 182.20762157637938 ns/iter 156.52178571429994 ns/iter 1.16
Pointer_Walker_Schema_ISO_Language 10105787.50000235 ns/iter 10029416.000000613 ns/iter 1.01
Pointer_Maybe_Tracked_Deeply_Nested/0 2329035.1170580955 ns/iter 2003530.434783131 ns/iter 1.16
Pointer_Maybe_Tracked_Deeply_Nested/1 3630735.89743437 ns/iter 3635075.384615378 ns/iter 1.00
Pointer_Position_Tracker_Get_Deeply_Nested 513.81280048907 ns/iter 540.4129363608934 ns/iter 0.95
JSONPath_Descendant_Filter_Nested 2371.1488045221668 ns/iter 1571.0803571431193 ns/iter 1.51
URITemplateRouter_Create 41158.44698507486 ns/iter 35674.41729130598 ns/iter 1.15
URITemplateRouter_Match 235.24678571415538 ns/iter 230.46315625002478 ns/iter 1.02
URITemplateRouter_Match_BasePath 264.0993376829841 ns/iter 262.61737779543677 ns/iter 1.01
URITemplateRouterView_Restore 32983.04035998563 ns/iter 16981.129464284095 ns/iter 1.94
URITemplateRouterView_Match 181.55591799600697 ns/iter 161.521071428591 ns/iter 1.12
URITemplateRouterView_Match_BasePath 206.68069389827482 ns/iter 185.6265165738245 ns/iter 1.11
URITemplateRouterView_Arguments 546.9699000000219 ns/iter 417.94400366326795 ns/iter 1.31
JSONL_Parse_Large 32360885.71427553 ns/iter 23933063.33333385 ns/iter 1.35
JSONL_Parse_Large_GZIP 33210409.523798306 ns/iter 23501080.00000546 ns/iter 1.41
JSONLD_Catalog_Annotation_List_Populate 3026648.214285745 ns/iter 2846525.7028110647 ns/iter 1.06
JSONLD_Catalog_Materialize 7871869.333333355 ns/iter 6333419.999999831 ns/iter 1.24
HTML_Build_Table_100000 88996142.85714312 ns/iter 96263266.66665995 ns/iter 0.92
HTML_Render_Table_100000 7042646.428569047 ns/iter 12111098.214282785 ns/iter 0.58
GZIP_Compress_ISO_Language_Set_3_Locations 35639575.000004694 ns/iter 29395058.333335552 ns/iter 1.21
GZIP_Decompress_ISO_Language_Set_3_Locations 9170406.66666556 ns/iter 11613895.31249668 ns/iter 0.79
GZIP_Compress_ISO_Language_Set_3_Schema 2063344.3478260047 ns/iter 1863729.7587131483 ns/iter 1.11
GZIP_Decompress_ISO_Language_Set_3_Schema 595559.9107141194 ns/iter 672166.7857141662 ns/iter 0.89
JOSE_VerifySignature_RS256 21254.16562499538 ns/iter 18049.773658694874 ns/iter 1.18
JOSE_VerifySignature_ES512 1372616.6666664681 ns/iter 968578.0455154702 ns/iter 1.42

This comment was automatically generated by workflow using github-action-benchmark.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>

@cubic-dev-ai cubic-dev-ai Bot 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.

1 issue found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="test/uri/uri_relative_to_test.cc">

<violation number="1" location="test/uri/uri_relative_to_test.cc:486">
P2: This round-trip assertion does not hold for the nested-base case: relative_to(base '/a/b', target '//bar') emits '../bar' (Case 4 steps up one '../'), and resolving '../bar' against 'https://example.com/a/b' merges to '/a/../bar' which dot-segment collapses to '/bar', not '//bar'. The empty first segment is lost, so the test fails and the PR's fix is incomplete for a base with a nested path.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

uri.relative_to(base);
sourcemeta::core::URI resolved{uri.recompose()};
resolved.resolve_from(base);
EXPECT_EQ(resolved.recompose(), "https://example.com//bar");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This round-trip assertion does not hold for the nested-base case: relative_to(base '/a/b', target '//bar') emits '../bar' (Case 4 steps up one '../'), and resolving '../bar' against 'https://example.com/a/b' merges to '/a/../bar' which dot-segment collapses to '/bar', not '//bar'. The empty first segment is lost, so the test fails and the PR's fix is incomplete for a base with a nested path.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At test/uri/uri_relative_to_test.cc, line 486:

<comment>This round-trip assertion does not hold for the nested-base case: relative_to(base '/a/b', target '//bar') emits '../bar' (Case 4 steps up one '../'), and resolving '../bar' against 'https://example.com/a/b' merges to '/a/../bar' which dot-segment collapses to '/bar', not '//bar'. The empty first segment is lost, so the test fails and the PR's fix is incomplete for a base with a nested path.</comment>

<file context>
@@ -461,6 +461,49 @@ TEST(target_is_root_of_base_without_path_resolves_back) {
+  uri.relative_to(base);
+  sourcemeta::core::URI resolved{uri.recompose()};
+  resolved.resolve_from(base);
+  EXPECT_EQ(resolved.recompose(), "https://example.com//bar");
+}
+
</file context>

Comment thread src/core/uri/resolution.cc
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti
jviotti merged commit 38f833c into main Aug 9, 2026
13 checks passed
@jviotti
jviotti deleted the fix-uris-relative branch August 9, 2026 17:16
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.

1 participant