Skip to content

fix(engine) #2378: SELECT * stops filtering properties the schema marks hidden - #5939

Merged
lvca merged 1 commit into
mainfrom
fix/2378-remove-hidden-filter-from-projection
Aug 7, 2026
Merged

lvca merged 1 commit into
mainfrom
fix/2378-remove-hidden-filter-from-projection

Conversation

@lvca

@lvca lvca commented Aug 7, 2026

Copy link
Copy Markdown
Member

Finishes #2378.

What was left behind

#2378 removed database-level support for hidden properties in 2025, but left the filter in Projection: for SELECT * it skipped any alias whose schema property was marked hidden, while a bare SELECT returned the record's own names and never filtered. The two spellings of "give me everything" have disagreed ever since.

It stayed invisible because Projection also sets the element on the row, and ResultInternal.getPropertyNames() used to union the element's names over the content's - putting the filtered name straight back. #5613 stopped merging them (to keep a Cypher RETURN n from emitting every type property as a null column) and left the year-old filter exposed.

That is what has had CreatePropertyStatementExecutionTest.createHiddenProperty, and with it the whole unit-tests job, red on main.

Measured on ea4f6af30 before this change:

SELECT * FROM Plain -> [name, extra, @rid, @type]
SELECT * FROM Hid   -> [extra, @rid, @type]        <- hidden `name` dropped
SELECT   FROM Hid   -> [name, extra]               <- hidden `name` returned

The change

The filter goes. hidden stays a schema annotation exactly as #2378 intended - ALTER PROPERTY still records it, AbstractProperty still exposes it, schema introspection still reports it. Only the read path stops honouring it. Hiding a property from a projection but not from the record behind it was never a security boundary; it only made two queries that should agree return different rows.

The inner else if goes with it: once the hidden clause was removed its only other condition was an excludes check the line above already performs, leaving it dead.

Tests

Full com.arcadedb.query.** sweep: 10598 tests, one failure - Issue4305Test.pointRaisesCleanErrorOnNonNumericString, which fails identically on a clean ea4f6af30 checkout and comes from #5909 landing after this branch's base. Unrelated to this diff, but note it will keep unit-tests red after this merges.

…ks hidden

#2378 removed database-level support for hidden properties in 2025, but left the
filter in Projection: for `SELECT *` it skipped any alias whose schema property
was marked hidden, while a bare `SELECT` returned the record's own names and
never filtered anything. The two spellings of "give me everything" have
disagreed ever since.

Nobody saw it because Projection also sets the element on the row, and
ResultInternal.getPropertyNames() used to union the element's names over the
content's, putting the filtered name straight back. #5613 stopped merging them
(to keep a Cypher `RETURN n` from emitting every type property as a null
column) and left the year-old filter exposed, which is what has had
CreatePropertyStatementExecutionTest.createHiddenProperty - and with it the
whole unit-tests job - red on main ever since.

Measured on ea4f6af before this change:

  SELECT * FROM Plain -> [name, extra, @Rid, @type]
  SELECT * FROM Hid   -> [extra, @Rid, @type]        <- hidden `name` dropped
  SELECT   FROM Hid   -> [name, extra]               <- hidden `name` returned

So the filter goes, finishing what #2378 started. `hidden` stays as a schema
annotation: ALTER PROPERTY still records it, AbstractProperty still exposes it,
and schema introspection still reports it - none of that is touched. Only the
read path stops honouring it. Hiding a property from a projection but not from
the record behind it was never a security boundary; it only made two queries
that should agree return different rows.

The inner `else if` branch goes with it: its only other condition was an
excludes check the line above already performs, so removing the hidden clause
left it dead. `!prop` exclusion syntax is unaffected and now has its own test.

Tests: createHiddenProperty passes as written for the first time since #5613.
hiddenPropertyIsReturnedByEverySpellingOfSelectAll pins `SELECT *` and bare
`SELECT` to the same answer and asserts the schema flag survives;
selectStarStillHonoursExplicitExclusions guards the loop simplification.
Mutation-checked by restoring the filter: both go red, the new one reporting
`got [plain, @Rid, @type]`. Full com.arcadedb.query.** sweep: 10598 tests, the
only failure is Issue4305Test.pointRaisesCleanErrorOnNonNumericString, which
fails identically on a clean ea4f6af checkout and comes from #5909 landing
after this branch's base.
@mergify

mergify Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@codacy-production

codacy-production Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics -6 complexity

Metric Results
Complexity -6

View in Codacy

🟢 Coverage ∅ diff coverage · -6.40% coverage variation

Metric Results
Coverage variation ✅ -6.40% coverage variation
Diff coverage ✅ ∅ diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (ea4f6af) 152855 117429 76.82%
Head commit (45662e9) 185198 (+32343) 130415 (+12986) 70.42% (-6.40%)

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 (#5939) 0 0 ∅ (not applicable)

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.

@lvca
lvca merged commit dfa3a90 into main Aug 7, 2026
14 checks passed
@lvca lvca added this to the 26.9.1 milestone Aug 7, 2026
@lvca lvca self-assigned this Aug 7, 2026
@claude

claude Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review

Verified by reading Projection.java, ResultInternal.java (getPropertyNames/getProperty), AbstractProperty.isHidden, and grepping the rest of the codebase (Cypher, GraphQL, Mongo wire protocols, MCP/server settings redaction) for any other read path that honours schema-level hidden. There isn't one - GlobalConfiguration.isHidden() hits in the grep are the unrelated server-settings-redaction concept. That confirms the PR's core claim: this was the last read path enforcing a flag that #2378 already stopped enforcing everywhere else, and removing it makes SELECT * and bare SELECT agree again, matching Document.getPropertyNames(), which never filtered on hidden in the first place.

Correctness

  • The fix itself is minimal and correct: deleting the else if branch and its now-redundant excludes.contains(alias) re-check (the if above already handles it) is the right simplification, not just a formatting change.
  • The unused com.arcadedb.database.Document import removal is verified clean (no other reference to Document remains in the file).
  • Nothing else in Projection.calculateSingle depended on the removed branch (RID/@type injection and the exclude-set logic below are untouched and still correct).

Test coverage - good, and appropriately targeted:

  • createHiddenProperty restored to its original intent (now actually exercises both SELECT * and bare SELECT).
  • hiddenPropertyIsReturnedByEverySpellingOfSelectAll is a solid regression pin for the exact bug, and also double-checks the schema still records isHidden() afterward (i.e., confirms this is scoped to the read path, not the schema annotation).
  • selectStarStillHonoursExplicitExclusions correctly guards the adjacent excludes logic that shares the same loop and could easily have been broken by an over-eager simplification.
  • PR description notes a manual mutation check (reinstating the filter turns both new tests red) - good rigor, though I can't independently confirm that from the diff alone.

Minor nit (non-blocking): the inline comment block in Projection.java (lines 119-125) and the Javadoc on the new test method are fairly long for this repo's usual comment density. The content is justified under CLAUDE.md's "non-obvious WHY" bar - this is genuinely a subtle, previously-invisible-for-a-year regression, so a pointer to the history is worth it - but it could be trimmed to 2-3 lines without losing the essential warning ("do not reinstate; hidden was never a security boundary here"). Purely a style call, not a correctness issue.

Security: No concern. Hiding a schema property was never enforced anywhere else in the read path (bare SELECT, Document access, other query engines), so this was never an actual access-control boundary, just an inconsistent cosmetic filter on one of two ways to select all columns. Removing it closes an inconsistency rather than opening a new exposure.

Performance: Net positive - one fewer type/property lookup (doc.getType().existsProperty(alias) + getProperty(alias).isHidden()) per aliased column in the common SELECT * path.

Scope: Tight - one production file, one test file, no unrelated changes. The PR description is thorough and the noted pre-existing unrelated failure (Issue4305Test) is called out rather than papered over.

Overall: a well-reasoned, well-tested fix for a real regression that's been red on main. I'd merge this as-is; the comment-length nit is optional polish.

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.06%. Comparing base (ea4f6af) to head (45662e9).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5939      +/-   ##
==========================================
+ Coverage   68.03%   68.06%   +0.02%     
==========================================
  Files        1797     1797              
  Lines      152855   152855              
  Branches    32397    32397              
==========================================
+ Hits       103999   104036      +37     
+ Misses      35466    35437      -29     
+ Partials    13390    13382       -8     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lvca
lvca deleted the fix/2378-remove-hidden-filter-from-projection branch August 11, 2026 04:03
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