Skip to content

Announce and keep display escapes through merges - #647

Merged
bact merged 10 commits into
mainfrom
ccr-5d41e097-sud42y-display-escape-gaps
Dec 3, 2026
Merged

bact merged 10 commits into
mainfrom
ccr-5d41e097-sud42y-display-escape-gaps

Conversation

@bact

@bact bact commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #609/#630 (round-2 review, 0.25.2).

  • One escape for every build and every merged fragment: the build's own agents, tools, licences, relationships and creation comments, and each fragment as it is loaded, write invisible and bidi controls as \uXXXX. Each element is named once (WARNING: ELEMENT=<id>: ... [text-unsafe]; a merge says Merge: ELEMENT=<id> FILE=<file>).
  • A raw and an escaped spelling become one value, so a fragment restating a base element agrees with it.
  • An escaped control in a model's file name is announced (statement/comment).
  • The credential check also reads each value with its escapes written back, so an escape hides no credential.

Output without control characters is byte-identical to main.


Generated by Claude Code

bact added 4 commits December 3, 2026 03:59
- A control escaped where a provenance string is built (a model's file
  or key name) is now named by text-unsafe: the fields encoder and
  emit_provenance report it to the model's collector as `statement`
  and `comment`.
- A licence whose text the display escape changed is indexed under
  what it now holds too, so a fragment's copy unifies with it and no
  second SimpleLicensingText is left.
- A fragment merge compares text as shown (an escaped control equals
  the raw one): a fragment naming a model with the control raw is no
  rename and no conflict. Text only a fragment holds in a model or
  dataset package is escaped after the last fragment, with one
  `Merge: ELEMENT=...` text-unsafe line per package.

Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
The merge now escapes a fragment's display text before the SBOM is
written, so a URL field holds a format character as its percent-encoded
bytes by the time the credential check reads it. The check reads each
value as written and with those bytes written back, so a zero-width
space in front of a PURL or inside a parameter name still hides no
credential.

Also write the test controls as escapes and fold two equal branches of
_normalize_value.

Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
@bact bact added the test-all-os Use this to trigger full tests on all platforms label Dec 3, 2026 — with Claude
@codecov-commenter

codecov-commenter commented Dec 3, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.98%. Comparing base (830b2e5) to head (851c8b3).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #647    +/-   ##
========================================
  Coverage   99.98%   99.98%            
========================================
  Files         543      544     +1     
  Lines       35472    35575   +103     
  Branches     4997     5012    +15     
========================================
+ Hits        35465    35568   +103     
  Misses          4        4            
  Partials        3        3            

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

bact added 5 commits December 3, 2026 05:37
Review of #647.

- The credential check reads every value with each display escape
  written back (text, percent-encoded, JSON), whatever field holds it:
  an identifier, DOI or page URL hiding a token behind a control is
  refused on the merge and the build routes.
- A merge escapes each fragment's model-kind elements (model and dataset
  packages, agents, tools, relationships, licences) before it compares
  or folds anything, in place of comparing text "as shown": signatures
  and values are compared exactly, so an agent or a licence text stated
  raw and escaped is one, escaped, in either order, and a
  software_Package name is compared as it stands. The text-unsafe line
  names the fragment file and the id it gives the element.
- The display escape covers every string and URI property of those
  elements; a drift test holds the tables against the bindings.
- emit_provenance writes its comment through write_provenance_comment.
- Known limits recorded: a software_File name and the element types a
  merge leaves raw.

Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
A fragment restating a base element raw no longer disagreed with a base
that kept its own text raw: one rule now escapes both sides.

- The build escapes every Agent, Tool, Relationship and simpleLicensing
  licence element it creates, and the comment of every element's
  creation information, at the end of each builder, with one
  `text-unsafe` line per element (`ELEMENT=<spdx-id>: ...`). A fragment
  goes through the same pass as it is taken for a merge.
- A licence is keyed by its text as read (display escapes written back),
  in the merge and in the exporter's index: a text ending in a form feed
  is the same licence raw or escaped, with or without it.
- The merge line puts the file last and spells it as `fragment-invalid`
  does: `Merge: ELEMENT=<spdx-id> FILE=<file>: ...`.
- The credential check reads every field as written, then with display
  escapes written back; `Reading.escaped` is gone.
- Known bugs: the entry on unescaped element types is narrowed to
  `software_Package`, `software_File`, `Annotation` and expandedLicensing
  licences.

Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
- A licence text (`simplelicensing_licenseText`, and the `name` taken
  from its first line) keeps U+000C: it is written as JSON `\f`, as
  before, with no `text-unsafe` line. Every other invisible or bidi
  control in it is still escaped and said. One escape table serves a
  project's, a model's and a fragment's licence text, so all three
  follow the rule; the licence key stays "as read".
- A `--describe-relationship` description is escaped where it is built,
  so one quoting a file name left raw holds no control; said once per
  relationship. A quoted licence name keeps its form feed.
- The `text-unsafe` advice and docs/metadata-reading-back.md say so.
- CHANGELOG: one bullet for the PR.

Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
@bact bact added the enhancement New feature or request label Dec 3, 2026
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>

# Conflicts:
#	CHANGELOG.md
#	working-docs/design/known-bugs.md
#	working-docs/design/known-bugs/extraction-and-fragments.md
@bact
bact merged commit 9bdca54 into main Dec 3, 2026
27 checks passed
@bact
bact deleted the ccr-5d41e097-sud42y-display-escape-gaps branch December 3, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request test-all-os Use this to trigger full tests on all platforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants