Repository navigation
Fix strict-result defects and harden CLI output and the CLI broker - #144
Merged
Merged
Conversation
Bumps the minor-and-patch group with 1 update: [actions/dependency-review-action](https://github.com/actions/dependency-review-action). Updates `actions/dependency-review-action` from 5.0.0 to 5.0.1 - [Release notes](https://github.com/actions/dependency-review-action/releases) - [Commits](actions/dependency-review-action@a1d282b...bbc44d1) --- updated-dependencies: - dependency-name: actions/dependency-review-action dependency-version: 5.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: minor-and-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps coverlet.collector from 10.1.0 to 10.1.1 Bumps WireMock.Net from 2.31.0 to 2.32.0 --- updated-dependencies: - dependency-name: coverlet.collector dependency-version: 10.1.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: test - dependency-name: WireMock.Net dependency-version: 2.32.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: test ... Signed-off-by: dependabot[bot] <support@github.com>
… and 'dependabot/nuget/test-251ed8d7e8' of https://github.com/ivanvyd/LakeSpeak.NET into fix/review-batch-20261128
Strict results: - Validate only the identity fields strict mode checks; numeric user_id and other non-identity *_id fields no longer fail real responses. - Classify strict HTTP failures by status without reading the body. - Require consecutive chunk indices, fetch an advertised trailing chunk when the row budget is exactly used, accept explicit zero-row results, and report a query attachment without an id as incomplete. - Share one next-chunk link resolver between the legacy and strict walkers; legacy now also refuses user-info links and dedupes on the resolved URL. - Publish GenieErrorCodes for the strict error codes. Hardening: - Resolve the databricks executable from absolute PATH entries only; on Linux and macOS .NET otherwise checks the current directory first. - Sanitize raw stdout (CSV and similar) when it is a terminal. - Escape &, < and | in Markdown cells and fence SQL past its backticks. Docs: correct the signed-tag claim, SECURITY.md wording, the Dockerfile restore comment, and pin the CLI in the scheduled-report example. Includes the Dependabot updates from #141 and #142.
GenieClient checked whether strict results were enabled in about 17 places, including the shared HTTP send, body reading, failure mapping and normalization. It now picks a LegacyGenieTransport or a StrictGenieTransport in its constructor and only orchestrates. - GenieTransport owns the shared send, the status-to-failure mapping, the workspace-bound next-chunk resolver with a typed refusal, and the re-execute polling loop. Each result operation gets a fetch delegate, so the strict aggregate budget is never nullable. - Each transport owns its body reading, identity checks, reported message error and chunk walker; log event ids are unchanged. - GenieResponse.WithQueryAttachments derives Query, Result and the metadata attachment id from the first query attachment, replacing three hand-synced copies. - Strict body reads take a byte cap; only aggregate result reads draw down the shared budget. GenieClient.cs drops from 811 to 448 lines. No public API change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Strict results (
GenieClientOptions.StrictResults, added in 0.5.0)space_id,conversation_id,message_id,id,attachment_id,statement_id) must be non-empty strings. Other*_idfields, such as Genie's numericuser_id, are accepted. Duplicate property names are still rejected everywhere.data_arrayare accepted. A query attachment without an id is reported as incomplete, as ADR 0010 already said.GenieErrorCodesconstants forSTRICT_RESULT_LIMITandSTRICT_RESULT_INCOMPLETE.Hardening
databricksin absolutePATHdirectories only, and skips matches without an execute bit on Unix.agents list -f csv,export last) has control characters replaced when stdout is a terminal. Redirected output is unchanged.&,<and|in table cells and the Agent line. Generated SQL is fenced with a backtick run longer than any it contains.Docs and supply chain
release.ymlcomment no longer claim that a signed tag makes a stolen maintainer account insufficient.LakeSpeak.Cli0.5.0.Structure (second commit, no behaviour change)
GenieClientchooses aLegacyGenieTransportorStrictGenieTransportin its constructor. It no longer checks strict mode in about 17 places across send, read, failure mapping, normalization and results.GenieTransportowns the shared HTTP send and failure mapping, the next-chunk resolver and the re-execute polling loop. Each result operation gets its own fetch delegate, so the strict budget is never nullable.GenieResponse.WithQueryAttachmentsderivesQuery,Resultand the metadata attachment id from the first query attachment. Before, three places kept those copies in step by hand.GenieClient.csdrops from 811 to 448 lines. There is no public API change, and log event ids and messages are unchanged.Dependencies: this PR includes the Dependabot updates from #141 (
dependency-review-action5.0.1) and #142 (test-onlycoverlet.collector10.1.1,WireMock.Net2.32.0). Both PRs close when this merges.Why
The problems came from a review of the 0.5.0 changes: maintainability, correctness, deslop and a source-level security audit.
user_id. Strict mode threwMalformedResponseon any numeric*_id. The Databricks SDK typesGenieConversation.user_idas an integer, so a strict Ask could submit and bill a question and then fail to return its conversation id.MaxBytes, or a body that could not be read, came back asSTRICT_RESULT_LIMITorNetwork.Process.Startlooks in the current directory beforePATH. SeeResolvePathinProcess.Unix.csonrelease/8.0andrelease/10.0. Running a pack from an untrusted checkout could therefore start adatabricksfile planted in it, and that process would receive the user's OAuth session. On Windows a local probe did not reproduce this: the real CLI ran.<details>wrapper.nugetenvironment. The signed tag guards against mistakes and lesser access, not against a compromised owner account.Evidence
dotnet build LakeSpeak.slnx -c Release: 0 warnings, 0 errors.dotnet format LakeSpeak.slnx --verify-no-changes: exit 0.dotnet test -c Release --filter-not-trait 'Category=Live': 1186 total, 1184 passed, 0 failed, 2 skipped. The skipped case is the Unix-only execute-bit test on net8 and net10; Linux CI runs it.*_idrule and removed the absolute-path check in the resolver. Three new tests failed:Strict_ask_accepts_numeric_non_identity_ids,Strict_followup_accepts_numeric_non_identity_idsandRelative_and_empty_path_entries_are_never_searched. After restoring both fixes, all 77 targeted tests passed, with 1 skipped as Unix-only.bash .github/scripts/test-release-workflow-policy.sh: passed.user_idtype comes from the Databricks SDK, not from a live response.Checklist
dotnet build -c Releaseis clean — warnings are errorsdotnet format --verify-no-changesis cleandotnet test -c Release --filter "Category!=Live"passesdotnet restore --force-evaluateif dependencies changed (only Dependabot's test-group lock updates; locked restore passes)LakeSpeak.Genie(ADR 0010 updated forGenieErrorCodesand the strict rules)What a reviewer should be sceptical of
PATHlookup. It appends.exeonly, asCreateProcessdid, and no longer searches System32 or the Windows directory. Adatabricks.cmdshim must be named explicitly.Metadataand the legacy first-result list are now new objects with equal values.