Fourth review round (ADR-023): encode_payload typed (Codec), numeric-argument domains pinned by kind, plain-path SQLite open (URI flag dropped, D-29), watcher cadence posture — waves-1-2 general-review findings
This commit is contained in:
1 parent
ee7871d25d
commit
44637eea5b
11 files changed
+502
-22
No files matched your search
@@ -309,11 +309,13 @@ pub(crate) fn bootstrap_schema(conn: &Connection) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
pub(crate) fn open_conn(path: &str, install_notify: bool) -> Result<Connection, Error> {
|
||||
// No SQLITE_OPEN_URI (ADR-023 §3 delta): the path argument is a
|
||||
// plain filesystem path — URI-interpreted `?name=value` suffixes
|
||||
// would mutate connection semantics outside the engine
|
||||
// constructor's opts.
|
||||
let conn = Connection::open_with_flags(
|
||||
path,
|
||||
OpenFlags::SQLITE_OPEN_READ_WRITE
|
||||
| OpenFlags::SQLITE_OPEN_CREATE
|
||||
| OpenFlags::SQLITE_OPEN_URI,
|
||||
OpenFlags::SQLITE_OPEN_READ_WRITE | OpenFlags::SQLITE_OPEN_CREATE,
|
||||
)?;
|
||||
apply_default_pragmas(&conn)?;
|
||||
if install_notify {
|
||||
@@ -554,6 +556,27 @@ mod writer_reader_tests {
|
||||
let _ = std::fs::remove_file(format!("{}-shm", tmp.display()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn open_conn_treats_uri_shaped_path_as_plain_filename() {
|
||||
// ADR-023 §3: no SQLITE_OPEN_URI — a `?name=value` suffix must
|
||||
// be a literal filename (the file exists with that name), not
|
||||
// URI interpretation (which for a bare-relative "file"-less
|
||||
// string with query params would error or mutate semantics).
|
||||
let dir = std::env::temp_dir().join(format!(
|
||||
"alkstore-uri-literal-{}-{:?}",
|
||||
std::process::id(),
|
||||
std::thread::current().id()
|
||||
));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
let path = dir.join("plain.db?mode=memory");
|
||||
let conn = open_conn(path.to_str().unwrap(), false).unwrap();
|
||||
conn.execute("CREATE TABLE t (x)", []).unwrap();
|
||||
drop(conn);
|
||||
let plain = dir.join("plain.db?mode=memory");
|
||||
assert!(plain.exists(), "literal-named file must exist on disk");
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn concurrent_opens_never_return_database_is_locked() {
|
||||
const ROUNDS: usize = 8;
|
||||
|
||||
Reference in new issue
Block a user