Skip to content

Answer version, range and change-data mistakes with specific errors - #190

Closed
littlegrasscao wants to merge 2 commits into
OpenSharing-IO:mainfrom
littlegrasscao:fix/error-validation-messages
Closed

littlegrasscao wants to merge 2 commits into
OpenSharing-IO:mainfrom
littlegrasscao:fix/error-validation-messages

Conversation

@littlegrasscao

@littlegrasscao littlegrasscao commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Depends on #186.

A request with a version or timestamp the table does not have, a malformed or contradictory range, or a Change Data Feed the source table does not record got errors in this server's own wording, and some leaked the table's storage path. Each now has one specific answer.

Case Answer
Non-numeric version, startingVersion, endingVersion 400 INVALID_PARAMETER_VALUE "<name> is not a valid number."
Negative version / startingVersion / endingVersion "<name> cannot be negative." (query body: "table version cannot be negative.")
More than one of version, timestamp, startingVersion "Please only provide one of: version,timestamp[,startingVersion]"
Change feed with both a version and a timestamp for the start or the end "Multiple starting/ending arguments provided for CDF read. Please provide one of either ..."
No change feed start "No startingVersion or startingTimestamp provided for CDF read. Set one of them on the request's cdfOptions to bound the CDC range."
Reversed range "startingVersion(S) must be smaller than or equal to endingVersion(E)." (query body); "CDF range from startingVersion S to endingVersion E was invalid. End cannot be before start." (changes)
Start or end version after the latest "Provided Start/End version(N) for reading change data is invalid. ... cannot be greater than the latest version of the table(L)." The end is rejected, not capped
endingTimestamp after the latest commit "The provided timestamp(<ts>) is after the latest table version available to this table (<latest>). Please use a timestamp less than or equal to <latest>"
A table that did not record change data for a version in range 403 PERMISSION_DENIED "Unable to access change data feed for <share>.<schema>.<table>. CDF is not enabled on the original delta table for version <n>. Please contact your data provider."
A version or timestamp Kernel rejects 400 BAD_REQUEST, Kernel's message without the storage path (from #186)

A Change Data Feed range is read whole for its protocols and metaData before the response begins, so a version that stops recording change data, or needs reader features the client did not advertise, answers with its status (for example 403) instead of resetting a stream that has begun. A start timestamp before the first commit starts at version 0, as Kernel resolves it.

The checks and their messages live in TableRequestChecks and run once, in ProtocolTables, before the table is read; the snapshot and metadata readers no longer check for a version together with a timestamp.

Test plan

  • opensharing-server-core and opensharing-server test runs pass locally (Java 17, Maven). S3-backed integration classes skip without cloud credentials; their expectations were updated but not run.
  • Tests assert status, error code and message, and that no storage path appears, including for a table directory with a space in its name.

This pull request and its description were written by Isaac.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

🔍 OpenCodeReview found 3 issue(s) in this PR.

  • ✅ Successfully posted inline: 0 comment(s)
  • 📋 Routed to summary by policy: 3 comment(s)

test · low

📄 server/opensharing-server-core/src/main/java/io/opensharing/asset/table/TableRequestChecks.java (L11-L11)

⚠️ GitHub could not post this as an inline comment: Routed to summary (severity low · category test)

No tests cover this new class. Please add unit tests for the exact messages, the boundaries (negative, start == end, Long overflow and whitespace-only input in parseVersion), and the check order in ProtocolTables.requireValid. The new behavior is a client-visible change. Requests that send both version and timestamp to the metadata endpoint now fail with INVALID_PARAMETER_VALUE.


bug · low

📄 server/opensharing-server-core/src/main/java/io/opensharing/asset/table/ProtocolTables.java (L217-L218)

⚠️ GitHub could not post this as an inline comment: Routed to summary (severity low · category bug)

Validation now runs after the share grant check but before findTable and requireUrlAccess. A malformed request for a missing or inaccessible table therefore returns 400 instead of 404 or 403. The grant check still comes first, so this does not leak anything about the share. It is an ordering change, so confirm it matches the intended contract and cover it with a test.


maintainability · low

📄 server/opensharing-server-core/src/main/java/io/opensharing/asset/table/delta/DeltaSnapshots.java (L28-L29)

⚠️ GitHub could not post this as an inline comment: Routed to summary (severity low · category maintainability)

classify returns a non-storage KernelEngineException unchanged. The caller's outer catch (KernelException | KernelEngineException) then passes it to classifyRead again. The result is a duplicate error log and a second classification. Rethrow it unclassified, or have the callers skip exceptions that have already been classified.

@littlegrasscao
littlegrasscao force-pushed the fix/error-validation-messages branch from 7614b50 to 07cdf3a Compare November 13, 2026 01:47
@littlegrasscao
littlegrasscao force-pushed the fix/error-validation-messages branch from 07cdf3a to 4c24439 Compare November 13, 2026 01:57
@littlegrasscao littlegrasscao changed the title Answer version and timestamp mistakes in the reference server's words Answer version, range and change-data mistakes with specific errors Nov 13, 2026
…ame the data provider

A shared table whose Delta log is missing, starts after version 0, has a
gap, or is otherwise invalid, or whose version Kernel cannot read,
returned 500 INTERNAL_ERROR or an error code and message of this
server's own. The recipient cannot fix any of these, so the answer now
says what is wrong and, when the shared table itself is at fault, whom
to contact.

DeltaKernel classifies every Kernel failure once, by Kernel's exception
type rather than its message text:

- A missing log (TableNotFoundException), or a file that is missing or
  denied (FileNotFoundException, AccessDeniedException), is the shared
  table's own state: 400 BAD_REQUEST "Unable to access table
  <share>.<schema>.<table>: something is wrong with the table. Please
  contact your data provider." The table is named as the share names
  it, and its storage path stays in the log.
- An InvalidTableException, such as a gap in the log, is reported in
  Kernel's own words, with every spelling of the table's path and any
  other location removed, and the recipient is asked to contact the
  data provider: 400 BAD_REQUEST.
- Any other Kernel report, such as a version or timestamp the table does
  not have, is the request's mistake in Kernel's words, without the
  path: 400 BAD_REQUEST.
- A failure of the storage layer for a reason of its own stays a server
  error.
- A reader feature or version Kernel cannot read is named in a fixed
  order: 400 INVALID_PARAMETER_VALUE "Table features <features> are
  found in table[ version: <n>]. This server cannot read them. Please
  contact your data provider."

The version endpoint no longer pre-checks a timestamp against the
latest commit and leaves that to Kernel, and a snapshot is opened
straight at the version or timestamp asked for.

Adds ErrorCodes.BAD_REQUEST, ApiException.badRequest and
ApiException.unsupportedFeatures, and fixtures for a log with in-commit
timestamps but no CommitInfo (in a directory with a space in its name)
and a table that is readable at its latest version but not at version 0.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Sun Cao <sun.cao+data@databricks.com>
@littlegrasscao
littlegrasscao force-pushed the fix/error-validation-messages branch from 4c24439 to 72bd79c Compare November 13, 2026 02:02
A request with a version or timestamp the table does not have, a
malformed or contradictory range, or a Change Data Feed the source table
does not record got errors of this server's own wording, and some
leaked the table's storage path. Each now has one specific answer:

- A non-numeric version, startingVersion or endingVersion is 400
  INVALID_PARAMETER_VALUE "<name> is not a valid number.", and a
  negative one "<name> cannot be negative."
- More than one of version, timestamp and startingVersion, or more than
  one starting or ending bound of a Change Data Feed, names the
  parameters to choose from. A reversed range names both versions.
- A Change Data Feed start or end after the table's latest version, or
  an end timestamp after its latest commit, is rejected with the latest
  version or commit time to use, rather than capped.
- A table that did not record change data for a version in the range is
  the source table's own state: 403 PERMISSION_DENIED "Unable to access
  change data feed for <share>.<schema>.<table>. CDF is not enabled on
  the original delta table for version <n>. Please contact your data
  provider."
- A version or timestamp Kernel rejects keeps Kernel's own message, in
  400 BAD_REQUEST, without the table's storage path.

A Change Data Feed range is read whole for its protocols and metaData
before the response begins, so a version that stops recording change
data, or needs reader features the client did not advertise, answers
with its status instead of resetting a stream that has begun.

The checks and their messages live in TableRequestChecks, and run once,
in ProtocolTables, before the table is read. The snapshot and metadata
readers no longer check for a version together with a timestamp.

Stacked on the change that classifies Kernel's failures.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Sun Cao <sun.cao+data@databricks.com>
@littlegrasscao

Copy link
Copy Markdown
Collaborator Author

Superseded by #196, stacked on #195 from an OpenSharing-IO branch. Review threads here were answered before the move.

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