Skip to content

feat(graph): limit the length of tags - #4017

Merged
pbleser-oc merged 1 commit into
opencloud-eu:mainfrom
pbleser-oc:feat/tag-length-validation
Nov 18, 2026
Merged

pbleser-oc merged 1 commit into
opencloud-eu:mainfrom
pbleser-oc:feat/tag-length-validation

Conversation

@pbleser-oc

@pbleser-oc pbleser-oc commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Tags could be of any length. Assigning tags through the graph API now rejects the request with 400 when a tag is longer than the maximum, 100 characters by default. Clients learn the limit from the new graph.tags.max_tag_length capability.

Changes

  • Limit: AssignTags checks the tags with reva's tags.MaxLengthValidator before storing them. If one tag is too long, nothing is stored, and the error lists the tags that are too long. The length is counted in characters, after trimming the whitespace around each tag. Tags that already exist are not affected.
  • Setting: OC_MAX_TAG_LENGTH (default 100, 0 turns the limit off). The graph and frontend services both read it, without a service-specific alias, so that the announced limit is always the one graph enforces.
  • Capability: the frontend service announces the limit as graph.tags.max_tag_length.

Tests

  • Unit tests for the assignment: the default of 100, tags up to the limit, a tag that is too long (400, nothing stored), characters rather than bytes, whitespace around a tag not counted, limit 0.
  • The capability in the frontend's reva config.
  • An acceptance scenario in apiSpaces/tag.feature: a tag of 101 characters is rejected, one of 100 is stored.

AI assistance: Claude Code (claude-opus-5-5) wrote the code and the tests, and the first draft of this description; I reviewed them.

@codacy-production

codacy-production Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 18 complexity

Metric Results
Complexity 18

View in Codacy

🟢 Coverage 53.85% diff coverage · +0.03% coverage variation

Metric Results
Coverage variation ✅ +0.03% coverage variation (-1.00%)
Diff coverage ✅ 53.85% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (f35dcd5) 94253 28225 29.95%
Head commit (a359ef7) 94265 (+12) 28257 (+32) 29.98% (+0.03%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4017) 13 7 53.85%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@asaah262 asaah262 left a comment

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.

Thanks, looks good and the tests are clear! Just needs a rebase. The "reva bump" and "Behaviour change" parts of the description then no longer apply, since main already trims tags.

Tags could be of any length. Assigning tags through the graph API now
rejects the whole request with 400 if one of the tags is longer than the
maximum, listing the tags that are too long. The length is counted in
characters, after the whitespace around each tag is removed. Tags that
already exist are not affected.

The maximum is 100 characters by default, and can be changed with
OC_MAX_TAG_LENGTH, or turned off with 0. The frontend service announces
it to clients as the graph.tags.max_tag_length capability, so that they
can check tags before sending them. Both services read the same
variable, without a service-specific alias, so that the announced limit
is always the one graph enforces.

Assisted-by: Claude Code:claude-opus-5-5
@pbleser-oc
pbleser-oc force-pushed the feat/tag-length-validation branch from c584c07 to a359ef7 Compare November 17, 2026 23:31
@pbleser-oc

Copy link
Copy Markdown
Member Author

Thanks, rebased onto main. The reva bump commit is gone, since v3.0.1 already has the validation and the capability, and I removed the two outdated parts of the description.

@pbleser-oc
pbleser-oc requested a review from asaah262 November 18, 2026 08:22

@asaah262 asaah262 left a comment

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.

Thanks for the changes.

@pbleser-oc
pbleser-oc merged commit 5b9e691 into opencloud-eu:main Nov 18, 2026
61 checks passed
@pbleser-oc
pbleser-oc deleted the feat/tag-length-validation branch November 18, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants