[K2A] Durable SQLite history and projections #5
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Creatidy/creatidy-kernel#5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Persist and recover K1 Program truth in a single-controller, dedicated-writer SQLite store using explicit versioned durable records and rebuildable current projections.
Why
K1 defines deterministic in-memory facts and legal commands. Restart-safe persistence must preserve every durable K1 fact and its ordering without moving storage concerns into the pure domain or replaying old commands as current commands.
Scope
In scope
Out of scope
External Operation identity or request journaling; logical-effect and inbound-observation deduplication; outbox, delivery attempts, leases/fences, reconciliation, and external-effect uncertainty; artifact byte storage/finalization and immutable artifact references; K3 Runtime/Workspace or workers; K4 verification or AcceptedResult; live providers or network I/O; and usage/outcome accounting.
Acceptance Criteria
Program.apply().set_state,force_status, or arbitrary restore API is exposed.Constraints
adapters -> ports -> core; use one writer and preserve the conditional SQLite-version rule.AuthorityGrantmerely because older planning text mentioned grants.Links
docs/adr/0003-durability-and-effects.md,docs/architecture/contracts.md,docs/architecture/target.mdkilo referenced this issue2026-09-22 16:53:17 +00:00
[K2] Durable SQLite history and external operationsto [K2A] Durable SQLite history and projectionsImplemented on
issue-5-k2a-sqlite; PR #14 targetsdevelop: #14. The issue remains open; no merge was performed.Evidence: versioned codecs round-trip the final K1 ProgramSpec history, approved/effective input provenance, Attempts, TrustedSatisfaction, WorkUnit/Attempt cancellations, conclusions, actors/authority, and ordering. History, command-result dedupe, and current projections commit atomically; matching command key/input returns the saved result without another
Program.apply(), while changed input is rejected. Projection rebuild decodes validated fact snapshots, not historical commands. Schema 0-to-1 migration, online backup bundle/manifest, history export, append-only guards, and restart recovery are covered.SQLite startup evidence was exercised on runtime 3.43.1 with a verified local ext4 mount, WAL,
synchronous=FULL, foreign keys, bounded busy timeout, and exclusive single-controller/creator-thread writer topology. No unconditional SQLite version floor is imposed. The adapter currently supports verified local Linux mounts only.Validation passed:
make check(113 tests, lint, basedpyright, import contract, secret scan, diff check) andmake package-check(sdist/wheel rebuild and isolated install). K2B/#13 and all external effects remain out of scope. Independent review is pending.Independent review ledger; no completed review cycle yet.
INVALID_DISPATCH_CONFIGURATION; they produced no valid independent review and did not consume remediation budget.GPT-6 Astra (openai)and returnedOK.DISPATCH_VERIFIED: Agent Manager returnedResolved models: PR14 Astra Review: GPT-6 Astra (openai). It is a Local sessionses_f2a9bbbfeffeGrQmkz475roYK2; no worktree was created. Initial message:/review-pr https://forgejo.creatidy.com/Creatidy/creatidy-kernel/pulls/14.590bf5d7a30e066a65ddc2eae4d6dd199df1e969, basedevelop. No review verdict has been received or posted. CI run #1922 is green.Independent Review Cycle 1 — Closed by Remediation
590bf5d7a30e066a65ddc2eae4d6dd199df1e969GPT-6 Astra (openai), resolved by Agent ManagerREQUEST_CHANGESK2A-PR14-C1-F1forked writer-lock ownership;K2A-PR14-C1-F2crash-durable backup publication;K2A-PR14-C1-F3volatile filesystem acceptance;K2A-PR14-C1-F4amendment canonical-input normalization5b72c439d8a6ee28c940cc953e062f186c087b89remediation_used:1/10Validation passed on the resulting source:
make check(119 tests, lint, basedpyright, import contract, secret scan, diff check) andmake package-check(sdist/wheel rebuild and isolated install). Forgejo CI run #1926 for the resulting HEAD is green. The PR remains open and unmerged; a fresh independent Astra review of the new HEAD is required.Independent Review Cycle 2 — In Progress
5b72c439d8a6ee28c940cc953e062f186c087b89GPT-6 Astra (openai)(Resolved modelsevidence returned)ses_f2a8704edffe4nRIogiXBMdc6I/review-pr https://forgejo.creatidy.com/Creatidy/creatidy-kernel/pulls/14remediation_used:1/10(unchanged; review itself consumes no remediation cycle).Cycle 2 Launch Attempt — INVALID_DISPATCH_CONFIGURATION
5b72c439d8a6ee28c940cc953e062f186c087b89GPT-6 Astra (openai)but omitted the now-requiredvariant: max.GPT-6 Astra (openai) · maxdispatch evidence, and no independent verdict was received or posted.valid_review_cycles=1;remediation_used=1/10; cycle 2 remains unreviewed.A fresh Local dispatch will include
model,provider, andvariantinside the sametasks[0]entry and will only be treated as valid if Agent Manager confirms themaxvariant.Cycle 2 Review — DISPATCH_VERIFIED
5b72c439d8a6ee28c940cc953e062f186c087b89Resolved models: PR14 Astra Max Review C2: GPT-6 Astra (openai) · maxses_f2a7e4787ffeHqfrXAlnF8HIkZlocal; no worktree used/review-pr https://forgejo.creatidy.com/Creatidy/creatidy-kernel/pulls/14valid_review_cycles=1;remediation_used=1/10Independent Review Cycle 2 — Convergence Escalation
5b72c439d8a6ee28c940cc953e062f186c087b89GPT-6 Astra (openai) · max, resolved by Agent ManagerREQUEST_CHANGES5b72c439d8a6ee28c940cc953e062f186c087b89remediation_used:1/10Valid in-scope findings:
K2A-PR14-C2-F1— P1: The database file's mount can differ from the parent directory where SQLite creates-wal/-shm; a file-only ext4 bind mount under tmpfs passes current validation while WAL commits remain volatile.K2A-PR14-C2-F2— P1: All OverlayFS mounts are accepted without inspecting the writable upper layer orvolatileoption, so crash durability is not established.K2A-PR14-C2-F3— P2: A forked child that survives a killed controller retains the inheritedflockdescriptor unless it explicitly closes the store, blocking replacement-controller startup.The filesystem-topology durability defect recurs after Cycle 1's tmpfs/ramfs fix, and the fork/lock lifecycle defect recurs after Cycle 1's process guard. Per the convergence rule, the next step is a fresh read-only GPT-6 Astra
maxarchitecture-correction session, not another point fix. PR #14 remains open and unmerged; Forgejo CI #1926 for this head is green.Architecture Correction — BOUNDED_CORRECTION (Implemented)
5b72c439d8a6ee28c940cc953e062f186c087b89GPT-6 Astra (openai) · max, resolved by Agent ManagerBOUNDED_CORRECTIONd8954eeb9d8544a1b58b2003a79bb72e17a219f3valid_review_cycles=2;remediation_used=2/10The correction validates one complete native local data directory and database/sidecar mount identity, rejects file-only/split sidecars and OverlayFS/volatile storage, and uses one private SQLite connection in retained
locking_mode=EXCLUSIVEinstead of an inherited application flock. Inherited store use from another PID is rejected before SQLite access. K1 domain facts, codecs and schema version are unchanged.Local validation passed on the resulting HEAD:
make check(124 tests, lint, basedpyright, import contracts, secret scan, diff check) andmake package-check(sdist/wheel rebuild and isolated install).Forgejo Actions run #1931 for HEAD
d8954eeb9d8544a1b58b2003a79bb72e17a219f3reportsfailure;get_workflow_run(1931)confirms the result. The configured job-list endpoint returns 404 for both run number 1931 and UI run ID 18, leaving job details unavailable. This HEAD is not CI-green. A fresh Astra max review of this exact HEAD is pending.Independent Review Cycle 3 — In Progress
d8954eeb9d8544a1b58b2003a79bb72e17a219f3GPT-6 Astra (openai) · maxses_f2a386604ffeQalOMycCHq2e4Alocal; no worktree used/review-pr https://forgejo.creatidy.com/Creatidy/creatidy-kernel/pulls/14valid_review_cycles=2;remediation_used=2/10make check(124 tests) andmake package-checkpassed. Forgejo CI run #1931 reports failure; run/job detail APIs return 404, so the failure remains undiagnosed and this HEAD is not CI-green.Independent Review Cycle 3 — Completed
d8954eeb9d8544a1b58b2003a79bb72e17a219f3GPT-6 Astra (openai) · max, resolved by Agent ManagerREQUEST_CHANGESvalid_review_cycles:3remediation_used:2/10until implementation changes occurValid in-scope blockers:
K2A-PR14-C3-F1— P2: explicitly force SQLitecache=private; default connection behavior can inherit global shared-cache configuration and undermine the lifetime EXCLUSIVE ownership contract. Add a regression for a shared-cache peer/global setting.K2A-PR14-C3-F2— P2: persistence tests use pytesttmp_path, which may be tmpfs/OverlayFS and is now intentionally rejected. Provision a validated native local integration-test directory in Forgejo CI and use it for SQLite-backed tests.Nonblocking in-scope hardening:
K2A-PR14-C3-F3— P3: decoder validation does not check references/order forAttemptCancellationandProgramConclusion; add inconsistent-record negative fixtures and adapter-boundary checks without changing K1 transitions.CI run #1931 reports failure on this head; job detail APIs are unavailable, so its cause remains unverified. Local validation evidence for this head is author-reported in the PR description; the reported gates passed.
Independent Review Cycle 3 — Remediation Complete
d8954eeb9d8544a1b58b2003a79bb72e17a219f3GPT-6 Astra (openai) · max, resolved by Agent ManagerREQUEST_CHANGESK2A-PR14-C3-F1explicit private-cache mode;K2A-PR14-C3-F2configured native SQLite integration-test storage for CIK2A-PR14-C3-F3rehydration reference/order validation was hardened in the same bounded changebb657edb0562f34afad5622f2ea8159b21d6f834valid_review_cycles=3;remediation_used=3/10make checkpassed (126 tests) andmake package-checkpassed usingCREATIDY_TEST_STORAGE_DIRon a verified native mount. Forgejo Actions run #1932 for the resulting HEAD reports failure after 1s;get_workflow_run(1932)confirms the summary, butlist_action_run_jobsreturns 404 for run number 1932 and UI run ID 19, so job details remain unavailable. CI is not green. A fresh Astra max review of the resulting HEAD is pending.Independent Review Cycle 4 — In Progress
bb657edb0562f34afad5622f2ea8159b21d6f834GPT-6 Astra (openai) · maxses_f2a103b4dffeAImCB3Xl6LNE0Slocal; no worktree used/review-pr https://forgejo.creatidy.com/Creatidy/creatidy-kernel/pulls/14valid_review_cycles=3;remediation_used=3/10Independent Review Cycle 4 — Convergence Escalation
bb657edb0562f34afad5622f2ea8159b21d6f834GPT-6 Astra (openai) · max, resolved by Agent ManagerREQUEST_CHANGESbb657edb0562f34afad5622f2ea8159b21d6f834valid_review_cycles=4;remediation_used=3/10Valid in-scope blockers:
K2A-PR14-C4-F1— P1: longest-prefix mount selection can choose a hidden native descendant beneath a visible tmpfs/OverlayFS/network mount, falsely verifying durability for the database and backup paths.K2A-PR14-C4-F2— P2: Unicode whitespace in legal mountpoint names is treated as a delimiter by unrestrictedstr.split()/splitlines(), truncating the mountpoint and allowing fallback to a different filesystem.Both repeat the filesystem-topology durability defect class after earlier remediation. Per the convergence rule, route to a fresh read-only GPT-6 Astra max architecture-correction session before code changes. Forgejo CI run #1932 for this head remains failed with job details inaccessible. PR #14 remains open and unmerged.
Architecture Correction Dispatch — DISPATCH_VERIFIED
bb657edb0562f34afad5622f2ea8159b21d6f834INVALID_DISPATCH_CONFIGURATIONbefore substantive work.ses_f2a028bc4ffeZcdVFNqZ1oOng9, Agent Manager Local, no worktree.Resolved models: K2A mount topology correction: GPT-6 Astra (openai) · max.BOUNDED_CORRECTIONorGENUINE_OWNER_DECISION_REQUIRED.remediation_used=3/10; no code changes made during architecture correction.Architecture-Correction Attempt — INCOMPLETE
ses_f2a028bc4ffeZcdVFNqZ1oOng9was resolved asGPT-6 Astra (openai) · maxand performed read-only analysis at HEADbb657edb0562f34afad5622f2ea8159b21d6f834.BOUNDED_CORRECTIONorGENUINE_OWNER_DECISION_REQUIREDclassification. Preliminary/subtask notes are not accepted as the architecture result.remediation_used=3/10.Architecture-Correction Retry — DISPATCH_VERIFIED
bb657edb0562f34afad5622f2ea8159b21d6f834ses_f29fb8724ffeLRQqZJ1bUyCdkqResolved models: K2A mount topology correction retry: GPT-6 Astra (openai) · maxBOUNDED_CORRECTIONorGENUINE_OWNER_DECISION_REQUIRED; no code changes have been made.remediation_used=3/10.Architecture Correction — BOUNDED_CORRECTION
bb657edb0562f34afad5622f2ea8159b21d6f834GPT-6 Astra (openai) · max, resolved by Agent ManagerBOUNDED_CORRECTIONremediation_used:3/10Root cause: textual longest-prefix mount selection does not identify the mount that actually served an opened path, while Unicode string splitting corrupts legal mountpoint bytes. The Astra architecture reviewer determined this can be bounded within K2A and existing local-native-storage requirements; no owner decision is required.
Correction design: open the canonical data directory and existing main/SQLite sidecar children with Linux
O_PATH|O_NOFOLLOW|O_CLOEXEC, usefstatfor regular single-link files, read each descriptor'sfdinfo.mnt_id, and map those IDs to a strict byte-parsed mountinfo table. Require the actual database, existing-wal/-shm/-journalfiles, and backup staging/output to map to the validated native writable mount. Parse LF records and ASCII space delimiters as bytes; perform one-pass octal unescaping only for evidence display. Keep O_PATH probes alive across mountinfo snapshots, verify IDs/options remain stable, and retain the stable-host/no-remount assumption. O_PATH probes do not interfere with SQLite POSIX locks. Keep SQLite's canonical URI filename.No K1 semantics, schema, Issue #5 scope, or K2B behavior changes are authorized or required.
Independent Review Cycle 4 — BOUNDED_CORRECTION Implemented
bb657edb0562f34afad5622f2ea8159b21d6f834with independent LocalGPT-6 Astra (openai) · max; verdictREQUEST_CHANGESon hidden mount visibility and Unicode mountinfo splitting.BOUNDED_CORRECTION; no owner decision was required.6ed09bca50003d6a4738cc189032e263f48daa5b.valid_review_cycles=4;remediation_used=4/10.Implementation uses actual opened-path
fdinfo.mnt_idvalues, strict byte parsing of/proc/self/mountinfo, duplicate/missing mount-ID rejection, O_PATH probe snapshots, and post-open topology revalidation. Synthetic tests cover hidden mounts, U+00A0/Unicode line-separator paths, non-UTF8 bytes, file-only binds, sidecar mounts, and malformed IDs.Local
make checkpassed (133 tests) andmake package-checkpassed withCREATIDY_TEST_STORAGE_DIRset to a validated native local directory. Forgejo Actions run #1933 on the new HEAD fails after 2s; run summary confirms failure, but jobs endpoint returns 404 for run 1933 and UI run ID 20. CI remains red and its cause is not inferred. A fresh independent Astra max review of the new head is pending.Independent Review Cycle 5 — Completed and Followed Up
6ed09bca50003d6a4738cc189032e263f48daa5bGPT-6 Astra (openai) · max, resolved by Agent ManagerCOMMENT; no blocking implementation findingK2A-PR14-C5-F1recyclablethreading.get_ident()ownership;K2A-PR14-C5-F2missing docs forCREATIDY_TEST_STORAGE_DIRd79c1e7ff8232e83e95c092f6fff7ad7a258778avalid_review_cycles=5;remediation_used=5/10Local validation passed on the resulting head:
make check(134 tests) andmake package-checkwithCREATIDY_TEST_STORAGE_DIRset to a verified native directory. Forgejo Actions run #1936 issuccessfor the exact resulting HEAD after moving the test-storage environment to step scope. Cycle 6 is reviewing this head; the PR remains open and unmerged.Independent Review Cycle 6 — In Progress
a3362f768350120aac59ef21b8b720b4e213d683GPT-6 Astra (openai) · maxses_f29a96495ffeCrQQS4eht6QlgZlocal; no worktree used/review-pr https://forgejo.creatidy.com/Creatidy/creatidy-kernel/pulls/14valid_review_cycles=5;remediation_used=5/10make check(134 tests) andmake package-checkpassed with the configured native storage directory. The workflow now setsCREATIDY_TEST_STORAGE_DIRat step scope; no workflow run for this new HEAD is listed yet, so CI is pending.Independent Review Cycle 6 — In Progress
d79c1e7ff8232e83e95c092f6fff7ad7a258778aGPT-6 Astra (openai) · maxses_f299ff131ffehuur3Mbbp884L2local; no worktree used/review-pr https://forgejo.creatidy.com/Creatidy/creatidy-kernel/pulls/14valid_review_cycles=5;remediation_used=5/10make check(134 tests) andmake package-checkpassed. No Forgejo workflow run is currently listed for this HEAD; CI is pending.Independent Review Cycle 6 — COMMENT
d79c1e7ff8232e83e95c092f6fff7ad7a258778aGPT-6 Astra (openai) · max, resolved by Agent ManagerCOMMENT; no blocking findingd79c1e7ff8232e83e95c092f6fff7ad7a258778avalid_review_cycles=6;remediation_used=5/10Two nonblocking findings were checked against the exact reviewed source and are invalid/duplicate:
K2A-PR14-C6-F1— claimed recycledthreading.get_ident()transfers ownership. Insqlite_store.py, lines 191-193 create a per-thread token on the creator thread; lines 945-947 authorize by that thread-local token, not by the numeric identifier. The cycle-5 regression already simulates identifier reuse after creator-thread termination and verifies access/close are rejected.K2A-PR14-C6-F2— claimedCREATIDY_TEST_STORAGE_DIRis undocumented.README.mdlines 72-75 document the variable and native-mount requirement;.forgejo/workflows/ci.ymlconfigures it at step scope.No code change was made. Forgejo CI run #1936 for this head is green. Per the invalid-finding rule, one fresh independent Astra max review of this unchanged exact HEAD is being launched to resolve the repeated unsupported finding; remediation remains
5/10.Independent Review Cycle 7 — In Progress
d79c1e7ff8232e83e95c092f6fff7ad7a258778aGPT-6 Astra (openai) · maxses_f2992c1e8ffeC7c8MK11yiWWy5local; no worktree used/review-pr https://forgejo.creatidy.com/Creatidy/creatidy-kernel/pulls/14valid_review_cycles=6;remediation_used=5/10Independent Review Cycle 7 — Convergence Escalation
d79c1e7ff8232e83e95c092f6fff7ad7a258778aGPT-6 Astra (openai) · max, resolved by Agent ManagerREQUEST_CHANGESd79c1e7ff8232e83e95c092f6fff7ad7a258778avalid_review_cycles=7;remediation_used=5/10Blocking finding:
K2A-PR14-C7-F1— P1: the native-filesystem allowlist accepts F2FS without inspecting thecheckpointmount option. F2FS withcheckpoint=disable(includingcheckpoint=disable:<cap>as emitted in mountinfo) can acknowledge fsync/SQLite commits and then restore the filesystem to its earlier state after unmount or unexpected shutdown. This also affects backup destinations protected by the same validator.The defect recurs in the same filesystem durability-validation class after prior architecture corrections. Per the convergence rule, the next step is a fresh read-only GPT-6 Astra max architecture-correction session. No code changed; PR #14 remains open and unmerged; CI #1936 for this head is green.
Cycle 7 Architecture Correction — DISPATCH_VERIFIED
d79c1e7ff8232e83e95c092f6fff7ad7a258778atasks[]; it was stopped asINVALID_DISPATCH_CONFIGURATIONwith no review work or remediation.ses_f2985a1f4ffeXEKp082TxToOLCResolved models: K2A F2FS durability correction: GPT-6 Astra (openai) · maxBOUNDED_CORRECTIONorGENUINE_OWNER_DECISION_REQUIREDremediation_used=5/10.Cycle 7 Architecture Correction — BOUNDED_CORRECTION
d79c1e7ff8232e83e95c092f6fff7ad7a258778aGPT-6 Astra (openai) · max, resolved by Agent ManagerBOUNDED_CORRECTIONremediation_used=5/10The architecture analysis confirms normal checkpoint-enabled F2FS is compatible with the accepted local-native durability profile; public Linux v6.12 evidence does not justify removing all F2FS or requiring
fsync_mode=strict. The bounded fix is to reject the exactcheckpoint=disableoption and itscheckpoint=disable:<cap>forms wherever mountinfo exposes mount or super options. This includes primary and backup storage through the shared validator and does not change Issue #5 scope or K1 semantics. Add synthetic tests for both option locations/forms and for default/explicit-enabled F2FS acceptance.No owner decision is required; implementation and validation remain pending.
Independent Review Cycle 7 — BOUNDED_CORRECTION Implemented
d79c1e7ff8232e83e95c092f6fff7ad7a258778awith independent LocalGPT-6 Astra (openai) · max; verdictREQUEST_CHANGESfor checkpoint-disabled F2FS durability.BOUNDED_CORRECTION: retain normal F2FS support, reject bare and suffixedcheckpoint=disableoptions in mount or super options. No owner decision required.f588de5bcc0d2e8f1b7ae50618cafd8dc7d6c25d.valid_review_cycles=7;remediation_used=6/10.Synthetic regressions cover
checkpoint=disable,checkpoint=disable:<cap>in both mount-option fields, and default/explicitly enabled F2FS remaining accepted.make checkpassed (142 tests) andmake package-checkpassed with the configured native test-storage directory. No Forgejo workflow run is listed yet for this new HEAD; CI is pending. PR remains open and unmerged; fresh Astra max review is pending.Independent Review Cycle 8 — Completed
f588de5bcc0d2e8f1b7ae50618cafd8dc7d6c25dGPT-6 Astra (openai) · max, resolved by Agent ManagerAPPROVEK2A-PR14-C8-S1explicit live cross-process exclusion test;K2A-PR14-C8-S2richer completed/amended/completed and authority-withdrawal round-trips. No normal-operation defect was claimed and no remediation was required.f588de5bcc0d2e8f1b7ae50618cafd8dc7d6c25dvalid_review_cycles=8;remediation_used=6/10For this exact HEAD,
make checkpassed (142 tests; lint, basedpyright, import contract, secret scan and diff check) andmake package-checkpassed (sdist/wheel rebuild and isolated install). Forgejo CI run #1937 issuccess. Issue #5 acceptance was verified by the independent review. No Forgejo review object was submitted; this ledger records the independent review artifact. PR #14 remains open, targetingdevelop, and was not merged.kilo referenced this issue2026-10-28 20:53:39 +00:00