Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ former v2.1 RC line; see `docs/net11/PROMOTION_TO_MAIN.md`). The net10.0 / C# 14

## Policy

- Never push. Commit locally to a feature branch such as `perf/autonomous-YYYYMMDD`; never commit to
`master` or `release/*` (Brief §9).

- Never force-push, rewrite history, delete the worklog, change `global.json`, modify release/version
metadata or package versions, or pack/publish.
- Never disable encryption to win, and never trade durability — WAL semantics, crash-consistency and
Expand Down Expand Up @@ -101,6 +100,16 @@ former v2.1 RC line; see `docs/net11/PROMOTION_TO_MAIN.md`). The net10.0 / C# 14

<!-- /bmad:context -->

## Push and landing — amended by the owner, 2026-10-11 (deliberately outside the managed block)

- The agent may **push feature branches** (`perf/autonomous-*`), open and update pull requests, and keep a
feature branch current with `master`. The blanket "Never push / never commit to `master`" line was
removed from the managed block above (which a `bmad-project-context` refresh replaces) and from Brief
§9; this section is where that decision persists.
- **Merging into `master` or `release/*` stays an owner action.** That push runs `pack` and "Push to
NuGet.org" (`.github/workflows/ci.yml`), and `pack/publish` is still a standing rail — so the agent
prepares the branch and the pull request and stops there.

## Working rules that outrank convenience (owner directive, 2026-09-26 — deliberately outside the managed block)

- **A bug you find is yours to fix, in the same session.** A finding never leaves a session as a bare
Expand Down
3 changes: 3 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- **The ubuntu leg of `CI/CD Pipeline` was red on `master`, and the `Coverage (net11.0)` job withheld its verdict with it, because two documentation links carried the wrong case.** `docs/Vectors/VECTOR_MIGRATION_GUIDE.md` pointed its *Documentation* and *API Reference* links at `../vectors/README.md` while the directory is `docs/Vectors`: a path that resolves on Windows and macOS — the windows and macos legs were green — and 404s on a case-sensitive host, where the link guard `DocumentationMarkdownLinks_ShouldResolveToExistingFiles` (added in this line's own documentation audit, commit `bdb4e094`, which ran on Windows and macOS) failed with `Collection: ["Vectors/VECTOR_MIGRATION_GUIDE.md:793 -> ../vector…", ":794 -> ../vector…"]`, so `tools/measure-coverage.ps1` exited 2 (`FAILED SUITES: SharpCoreDB.Tests - coverage verdict withheld`) instead of evaluating the 18 % floor. Both links now read `../Vectors/README.md` — the form every other vector link in `docs/` already used — and the guard no longer depends on the host filesystem's case sensitivity: both copies of that resolution (the link sweep and `DocumentationIndex_ShouldOnlyReferenceExistingDocumentationFiles`) go through one `PathExistsWithExactCase` helper that matches every path segment ordinally, so a wrong-case link fails on Windows too instead of only in CI. Verified red→green: with only the helper in place the test failed locally with exactly the two entries above, and passes after the link fix (documentation tests 9/0; core suite **2032 / 0 failed**, VectorSearch 248/0, EF Core 116/0, linq2DB 24/0).
- **A `VECTOR(N)` column stored nothing that could be read back: the vector case was missing from eight copies of the per-type row codec, five value tokenizers, the single-file JSON reader and both parameter binders, so a `float[]` was persisted as the literal text `"System.Single[]"`.** The breakage had three independent layers, each confirmed against the source before it was touched. (1) **Row codecs:** `DataType.Vector` was absent from every per-type switch — `Table.Serialization`'s fixed-size map, `WriteTypedValueToSpan`/`ReadTypedValueFromSpan`, `GetEncodedSize`, `EncodeVariablePayload`/`DecodeVariablePayload`, and the same switch again in `FixedWidthRecordLayout`, `InsertBatchOptimized` (writer *and* size estimate), `StreamingRowEncoder`, `BulkInsertValuePipeline`, `BinaryRowDecoder`, `PageBasedDataWriter`, `ColumnarDataReader`, `StructRow` (write, `DeserializeValue<T>` and `DeserializeValueBoxed`), `Table.ParallelScan` and `Table.GetColumnSize` — so a vector fell through to `default`, where the writers store `value.ToString()`. (2) **Tokenizers:** the VALUES literal splitter (`SqlParser.DML.ParseInsertValues`), the UPDATE `SET` splitter, `Database.Batch.ParseValues`, `SingleFileDatabase.Batch.ParseValueList` and `SqlParserExtensions.ExtractValues` all split on every comma outside quotes, so the bracketed literal `[0.5, 0.25, 0.125, 0.0625]` arrived at the value parser as `[0.5` and raised `Invalid value '[0.5' for data type Vector: The input is not a valid Base-64 string`. `ParseInsertValues`' fast path and its documented reference loop now both honour a bracketed literal, and the string-based splitters share one `SqlInPredicate.SplitTopLevelComma`. (3) **Binding:** `ParameterBinder.FormatParameter` (and `CompiledQueryExecutor`) rendered a `float[]` parameter as `'System.Single[]'`, and the single-file store — which writes rows as JSON — read a vector back as a `JsonElement` (`"[0.5,0.25]"`) because `SingleFileTable.FromSerializableRow` converted by JSON kind only. Fixing the cause rather than nine symptoms, the format and the coercion now have one definition: `SharpCoreDB.DataStructures.VectorBinaryCodec` owns the `VEC\0` blob (`docs/Vectors/TECHNICAL_SPEC.md` §7 — magic, version 1, flags, 2 reserved bytes, LE dimension count, float32 payload), the length-prefixed framing the row codecs store, and the accepted representations (`float[]`, `Memory<float>`/`ReadOnlyMemory<float>`, `IEnumerable<float>`, `double[]`, `byte[]` blob or raw float32, JSON array, base64, `0x` hex); `SharpCoreDB.VectorSearch.VectorSerializer` now delegates to it, so the engine and the HNSW/FLAT index cannot disagree about the layout. A value that is not a vector is now a type error naming the accepted forms instead of being stored as text. Two further copies were fixed on the way: the fixed-width codec's string fast path wrote raw UTF-8 into a VECTOR slot where the reader expects the blob (`types[i] is not (DataType.Blob or DataType.Vector)` now, mirroring the Blob exclusion), and `SharpCoreDB.Client`'s `GetFieldType` advertised `double[]` for a VECTOR column while every other surface produces `float[]`. Round trips are pinned by `VectorColumnStorageTests` (9), `VectorColumnRegressionTests` (11 — literal insert, binary `VEC\0` bytes present in the file, JSON-string/`float[]`/`ReadOnlyMemory<float>`/`double[]` parameters, base64, quoted JSON, multi-row VALUES, UPDATE with two assignments, `InsertBatch`, the `StreamingRowEncoder`→`BinaryRowDecoder` pair, NULL, the single-file reopen matrix, and the two loud-failure cases) and `VectorBinaryCodecTests` (8); the storage round trips were red before the fix (8 of the 9 cases failed, first failure `Invalid value '[0.5' for data type Vector`), the 28 are green after it, and the 248-test VectorSearch suite is unchanged by the delegation.

- **The documentation set was audited against the shipped 2.1 engine, and every page that described an API, file or format the engine does not have was corrected.** The sweep diffed each backticked identifier, file path and package id in `docs/**` against the source (symbol sets, the project list, `Test-Path`) and then read every suspect site rather than inferring. What was wrong: `docs/server/CONFIGURATION_SCHEMA.md` advertised *"Supported Formats: TOML, JSON, YAML"* and built ~400 lines of underscore-keyed TOML (`server_name`, `tls_enabled`) for a server that registers **JSON configuration sources only** — no TOML or YAML parser exists anywhere in the repository — listed `sharpcoredb.toml`/`sharpcoredb.yaml` in the load order, documented `Logging`/`Performance`/`Security` property sets that do not exist, invented `[server.replication]`/`[server.monitoring]` sections no type binds (and a `SHARPCOREDB_*` environment prefix where the server uses `Server__…`), and named `sharpcoredb/server:1.7.0` against the real `ghcr.io/mpcoredeveloper/sharpcoredb-server`; it is **rewritten** from `ServerConfiguration`, `Program.cs` and the shipped `appsettings.json`, including the real startup validation (TLS cannot be disabled, 32-character JWT secret, private key required unless the certificate is a `.pfx`). `docs/internals/OPTIMIZER_GUIDE.md` documented components that do not exist — `SubqueryOptimizer` (EXISTS→semi/anti-join rewriting; `SemiJoin`/`AntiJoin` appear nowhere in the source), `JoinReorderer`, `OptimizerCache`, `QueryOptimizerExtensions`, `OptimizerIntegration.GetOrOptimize(...)`, `InvalidateOptimizationCache()`, `FilterExecutor`, `PredicateAnalyzer` — and a 2-5×/5-20×/50-1000× "Execution Impact" table; it now describes the real path (`Optimization.QueryOptimizer` + `CostEstimator`, wired from `Services/QueryCompiler.cs`), the real plan cache (`Database/Caching/Database.PlanCaching.cs` + `Services/QueryPlanCache.cs`), the real subquery subsystem (`SubqueryClassifier`/`Planner`/`Executor`/`Cache`) and the honest placeholders (`JoinsReordered = hasJoins`, `SubqueriesEliminated = !hasSubquery`, `HashJoinThreshold = int.MaxValue`, so joins are nested-loop). `docs/QUERY_PLAN_CACHE.md` presented `db.GetPlanCacheStats()` and `db.ClearPlanCache()` as consumer code; both are `internal` (`InternalsVisibleTo` reaches tests and benchmarks only), and the page now says so. `docs/manual/migration.md`/`providers.md` named a **`SharpCoreDB.FluentMigrator`** package that does not exist — the integration ships inside `SharpCoreDB.Extensions` as `AddSharpCoreDBFluentMigrator()` — and `docs/Vectors/TECHNICAL_SPEC.md` claimed `SharpCoreDB.EntityFrameworkCore` exposes `HasVectorProperty()` + `VectorDistance()` LINQ support and `Microsoft.Extensions.AI` compatibility, where the EF provider contains no vector support at all and no project references `Extensions.AI`. `docs/benchmarks/ISSUE_56_ACCEPTANCE_CRITERIA.md` carried "✅" marks for `REPORT_V1.md`, `REPORT_V2.md`, `REPRODUCING.md`, `INTERPRETING_RESULTS.md` and a committed `tests/benchmarks/results/` directory, none of which exist; it now states per-artefact status. `docs/sharpcoredb-known-issues.md` — a 1.9.3-era external report — was verified item by item against 2.1: items 2-5 are fixed (`Load()` pads all seven per-column lists, `SingleFileTable` keeps a PK hash index, `ExecuteQuery` flushes pending batch writes, `SqlQueryValidator.NormalizeKey` strips `@`/`:`), item 6 (`INTEGER` → Int32) remains the default with the documented `UseSqliteIntegerAffinity` opt-in, and the non-existent `DurabilityMode.FlushToDisk` is corrected. Dead references were also repaired in `docs/INDEX.md` (two `storage/*_v1.7.0.md`, two `migration/FLUENTMIGRATOR_*_v1.7.0.md`), `docs/serialization/README.md` (two `SERIALIZATION_DOCUMENTATION_*.md`), `docs/graphrag/EF_CORE_DOCUMENTATION_INDEX.md` (three never-written files), `docs/analytics/README.md` (a `docs/compatibility/…` page), and the `Option.FromNullOrEmpty` fiction in `docs/FUNCTIONAL_NULL_SAFETY.md` was replaced with the real `Prelude.Optional` (null-only — semantic nulls are handled by the functional read path), alongside stale `v1.7.0` titles and a pointer to a `PERFORMANCE_VALIDATION_AND_ADVICE_CSHARP15_NET11.md` that was never created. Five new `DocumentationConsistencyTests` guards pin each class of defect (INDEX paths resolve; no TOML samples or "Supported Formats: TOML" in the server guide; no internal plan-cache API shown as public; every known-issue item annotated; every install-snippet package id real), each demonstrated red by planting the defect and green after removing it.


Expand Down
6 changes: 6 additions & 0 deletions docs/Vectors/TECHNICAL_SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,12 @@ Header flags (future-proof):
4. **Magic bytes** prevent accidental interpretation of regular BLOBs as vectors
5. **Overhead:** 12 bytes per vector (< 0.2% for 1536-dim) — negligible

### Where the format is implemented

One type owns it: `SharpCoreDB.DataStructures.VectorBinaryCodec` (`src/SharpCoreDB/DataStructures/VectorBinaryCodec.cs`) — `Serialize` / `WriteTo` / `Deserialize`, the `[int32 length][VEC\0 blob]` framing every row codec stores in a variable-length column, and the coercion rules (`float[]`, `Memory<float>` / `ReadOnlyMemory<float>`, `IEnumerable<float>`, `double[]`, `byte[]` blob or raw float32, JSON array text, base64, `0x` hex). `SharpCoreDB.VectorSearch.VectorSerializer` delegates to it, so the engine, the similarity index and the parameter binder cannot disagree about the layout.

A vector value reaches a column as a bracketed SQL literal (`INSERT INTO docs (id, embedding) VALUES (1, [0.5, 0.25])` — the VALUES tokenizer treats the commas inside the bracket as part of one literal), as a bound parameter (`float[]`, `ReadOnlyMemory<float>`, a JSON array string, …), or through the object API. A value that is not one of the accepted representations is rejected with a type error naming them, rather than being stored as its `ToString()` text.

### HNSW Index Persistence

```
Expand Down
4 changes: 2 additions & 2 deletions docs/Vectors/VECTOR_MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,8 @@ File.Delete("old.db");

## Support & Resources

- **Documentation:** [Vector Search Guide](../vectors/README.md)
- **API Reference:** [Vector API Docs](../vectors/README.md#api-reference)
- **Documentation:** [Vector Search Guide](../Vectors/README.md)
- **API Reference:** [Vector API Docs](../Vectors/README.md#api-reference)
- **Performance:** [Performance Benchmarks](../BENCHMARK_RESULTS.md)
- **Issues:** [GitHub Issues](https://github.com/MPCoreDeveloper/SharpCoreDB/issues)

Expand Down
3 changes: 1 addition & 2 deletions docs/performance/AUTONOMOUS_AGENT_BRIEF.md
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,7 @@ Add stamps only where needed to answer 5.1/5.3.

- **Before every commit:** build clean + core suite green + `--gate` pass (or a documented, quiet
re-run showing the verdict).
- Commit **locally** to a feature branch (e.g. `perf/autonomous-YYYYMMDD`). **Do not push.** **Do not
commit to `release/*` or `master`.**
- Commit **locally** to a feature branch (e.g. `perf/autonomous-YYYYMMDD`).
- **`git` works on this box — commit every session.** Sessions 77 and 78 recorded "`git` invocations hang on
this repository" and left their work (and session 79's, before it was re-measured) uncommitted on that
basis. **The claim is false**: re-measured 2026-10-10 (session 79) through this harness' own shell, inline
Expand Down
Loading
Loading