Skip to content

docs(spec): reconcile interface sketches and layout with the code - #20

Merged
ekalinin merged 1 commit into
feat/rate-limitfrom
docs/spec-code-alignment
Aug 20, 2026
Merged

docs(spec): reconcile interface sketches and layout with the code#20
ekalinin merged 1 commit into
feat/rate-limitfrom
docs/spec-code-alignment

Conversation

@ekalinin

@ekalinin ekalinin commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Stacked on #19. Documentation only, no code changes.

spec.md gives interface sketches, and the implementation refined names and signatures as it went. The drift had accumulated to the point where the document contradicted itself: section 5.1 did not agree with section 7.

5.1 QueryService

Method names align with the RPC names in section 7 (GetQueryStatus, GetQueryStats, DownloadResult, WatchQuery), which is what keeps a transport a pure mapping. CanIBeStopped is added, along with the byte window on DownloadResult that backs both HTTP Range and the gRPC offset/limit. It now records that every read path resolves the record first and checks its subject, so a transport never has to know about authorization.

5.2 Drivers

Open takes a DSN string and a pool size - every supported driver parses the DSN itself anyway. RowStream reports column names rather than []ColumnMeta: none of the supported drivers offers portable type metadata before the first row.

5.3 ResultStore

Writer(ctx, queryID, format) returns the ResultRef instead of receiving one, because only the backend knows the locator it is about to write to. Register is called from main once the backend has been built from config rather than at init() time, since every backend needs configuration (a root directory, a bucket, a DSN). It records that Close on a writer is where S3 and ClickHouse wait for the upload or commit, so its error decides whether the query succeeded (I4).

12 Repository structure

Brought in line with the tree, including the two deliberate departures from the original sketch and the reasoning: idempotency has no package of its own (it is two MetaStore calls and a rollback inside SubmitQuery, and a package holding that would only move the sequencing away from the code that has to get it right), and internal/state is flat because redis and memory implement one interface and share its error values.

13 Stack

Records what the code actually depends on, including why the config layer is plain yaml.v3 with ${VAR} expansion rather than viper or koanf: a single file, an atomic snapshot swap and an explicit ReloadReport is the whole requirement, and neither library adds anything to it.

11 Telemetry

Describes the single metrics pipeline and the span link that stands in for the parent I1 makes impossible. It also notes that a series appears at its first observation rather than at startup, which is how OTel reports, so alerts must use rate() or increase() rather than absent().

Sections 9 to 14 shift to 10 to 15 to make room for the new Security section; the section references in code, in OpenAPI and in the proto are updated accordingly.

The interface sketches in sections 5.1 through 5.3 predate the
implementation and had drifted: the service methods are named after the RPCs
in section 7, a driver takes a DSN string and a pool size, a RowStream
reports column names because no supported driver offers portable type
metadata before the first row, and a ResultStore Writer mints the ResultRef
rather than receiving one, since only the backend knows the locator it is
about to write to.

Section 12 now matches the tree, including the two departures from the
original sketch and why they were made: idempotency has no package of its
own, and internal/state is flat.

Section 13 records what the code actually depends on, including why the
config layer is plain yaml.v3 rather than viper or koanf, and section 11
describes the single metrics pipeline and the span link that stands in for
the parent I1 makes impossible.
@ekalinin
ekalinin force-pushed the docs/spec-code-alignment branch from f55f04a to 64cdda2 Compare August 18, 2026 09:47
@ekalinin
ekalinin merged commit 923d5f3 into feat/rate-limit Aug 20, 2026
6 of 9 checks passed
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