chitralverma commented on PR #9375:
URL: https://github.com/apache/opendal/pull/9375#issuecomment-7255589394

   (AI-generated reply)
   
   Fixed in d9f4a4b05.
   
   **1. Chunked reads without a known end.** I reproduced this on a release 
build of this branch. `fs` advertises `readWithIfModifiedSince` but not 
`statWithIfModifiedSince`. On it, `read` and `readSync` with `{ chunk: 2, 
ifModifiedSince: '2019-01-01T00:00:00Z' }` fail with `Unsupported (permanent) 
at stat ... with the arguments if_modified_since`, for both an existing and a 
missing file. With `size: 4n`, the existing-file read returns the 4 bytes, and 
the missing file fails with `NotFound` at `read`. On Silo S3, which supports 
the stat conditions, the stat applies them: a future `ifModifiedSince` fails 
with `ConditionNotMatch` at `stat`, and a missing file fails with `NotFound` at 
`stat`.
   
   - The core `ReadOptions::chunk` doc now adds: "A read with a positive 
`chunk` and an open-ended or suffix range first stats the file to learn its 
length, unless `content_length_hint` is set. That stat carries the read's 
version and conditions, so each of them also needs its stat capability, such as 
[`crate::Capability::stat_with_if_modified_since`] for `if_modified_since`; 
otherwise the read returns [`crate::ErrorKind::Unsupported`]." 
([options.rs#L346-L352](https://github.com/apache/opendal/blob/d9f4a4b056c815dd875b54b3cffdddfe7d37aa91/core/core/src/types/options.rs#L346-L352))
   - The struct doc now reads: "Once the option and capability checks pass, a 
read that reaches storage fails with [`crate::ErrorKind::NotFound`] for a 
missing file, no matter which conditions are set." The empty-range sentence 
after it is unchanged. 
([options.rs#L203-L205](https://github.com/apache/opendal/blob/d9f4a4b056c815dd875b54b3cffdddfe7d37aa91/core/core/src/types/options.rs#L203-L205))
   - Running every `ci_odev.yml` generator changes Node.js, Java, and .NET. 
Java and .NET only gain a link to `statWithIfModifiedSince` on `chunk`, which 
their generators take from the capability that the new paragraph names. The 
Python, C, and C++ outputs on `main` don't render these docs.
   
   **2. Node.js wording.** The generator now holds Node.js rewrites of the 
rendered core text 
([nodejs.rs#L342](https://github.com/apache/opendal/blob/d9f4a4b056c815dd875b54b3cffdddfe7d37aa91/dev/src/generate/nodejs.rs#L342)).
 Generation fails if a rewrite no longer matches core. Core keeps "including 
for presigned read requests" for Rust.
   
   - The struct doc reads "an empty range, such as `{ size: 0n }`, validates 
the read options and capabilities, ...".
   - The three overrides end with "`presignRead(path, expires)` takes no 
options, so presigned reads cannot request one."
   - The new `chunk` paragraph reads "A read with a positive `chunk` and no 
`size` first stats the file to learn its length." It does not mention 
`content_length_hint`, which Node.js lacks.
   
   On the build, `{ size: 0n }` returns an empty buffer from both methods, also 
for a missing path. `presignRead('f', 60, { contentType, cacheControl, 
contentDisposition })` returns a URL without `response-*` parameters. The 
surface test now also freezes `presignRead(path: string, expires: number): 
Promise<PresignedRequest>`, which the new wording relies on.
   
   **Tests.** The full-paragraph doc test now applies the Node.js wording, 
written as literals in the test. A new test pins the `ReadOptions` wording, 
including the `NotFound` qualification. Each test fails under a mutation:
   
   - dropping any of the four rewrites;
   - ignoring a rewrite that no longer matches;
   - naming another capability in core's `chunk` paragraph;
   - removing the storage qualification;
   - adding an options parameter to `presignRead`.
   
   `generated.d.ts` still differs from `main` only in the `ReadOptions` JSDoc.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to