mirror of
https://github.com/morluto/rea.git
synced 2026-12-01 02:49:12 +00:00
* fix(limits)!: let inspect_sqlite_database take producer_limits.input_bytes and type SQLite, Kuna and web-bundle refusals The SQLite snapshot refused a database and WAL above a fixed 256 MiB. The copy streams to private disk, so inspect_sqlite_database now accepts producer_limits.input_bytes (default 256 MiB) and reports details.limit for it. Refusals that carried recovery only in prose are typed: SQLite's result-column limit and the 16 MiB value/statement/reply allowance as fixed ceilings, occupied SQLite slots and live Kuna and web-bundle heap headroom as measured exhaustion, and the Kuna cache capacity as the REA_KUNA_CACHE_MAX_BYTES environment control. The SQLite worker diagnostic capture is reclassified as protocol. BREAKING CHANGE: the SQLite snapshot refusal reports details.limit for producer_limits.input_bytes, and the SQLite column and reply refusals carry a fixed_ceiling refusal in place of their authored remediation. * fix(sqlite): keep producer_limits in Evidence parameters and report the effective input bound
59 lines
2.1 KiB
TypeScript
59 lines
2.1 KiB
TypeScript
import type { Logger } from "pino";
|
|
|
|
import { createSqliteDatabaseService } from "../composition/sqlite.js";
|
|
import { SQLITE_TOOL_CONTRACTS } from "../contracts/sqlite/sqliteToolContracts.js";
|
|
import { contractNamed } from "./contractCliDescription.js";
|
|
import { registerContractCommand } from "./contractCommand.js";
|
|
import { inspectWithService } from "./contractCommandRunners.js";
|
|
import { PRODUCER_LIMITS_HELP } from "./producerLimitsOption.js";
|
|
import type { CliInstance } from "./types.js";
|
|
|
|
/** Resolve an operator-selected SQLite snapshot through the shared inspection workflow. */
|
|
export const registerSqliteCommands = (
|
|
cli: CliInstance,
|
|
logger: Logger,
|
|
environment: Readonly<NodeJS.ProcessEnv>,
|
|
): void => {
|
|
const service = createSqliteDatabaseService(environment);
|
|
const contract = contractNamed(
|
|
SQLITE_TOOL_CONTRACTS,
|
|
"inspect_sqlite_database",
|
|
);
|
|
registerContractCommand(
|
|
cli,
|
|
logger,
|
|
contract,
|
|
{
|
|
description:
|
|
"Inspect SQLite schema and optional ordinary-table rows from a local snapshot",
|
|
positionals: ["path"],
|
|
callerPaths: ["path"],
|
|
crossFieldRules: "argv",
|
|
jsonText: ["producer_limits"],
|
|
fields: {
|
|
path: { description: "Local SQLite database snapshot" },
|
|
producer_limits: { description: PRODUCER_LIMITS_HELP },
|
|
table: { description: "Exact ordinary table name to read" },
|
|
columns: {
|
|
name: "column",
|
|
description:
|
|
"Repeat to select exact row columns in the requested order; requires table",
|
|
},
|
|
schema_scope: {
|
|
description:
|
|
"Compact inventory by default, or selected-table details when table is supplied; database requests full schema",
|
|
},
|
|
row_limit: {
|
|
description:
|
|
"Positive safe integer row count; default 20; requires table",
|
|
},
|
|
row_offset: {
|
|
description:
|
|
"Non-negative safe integer rows to skip before the window; default 0; requires table",
|
|
},
|
|
},
|
|
},
|
|
inspectWithService(() => service, "sqlite"),
|
|
);
|
|
};
|