Repository navigation
Verify every chained field; verifiers never migrate; harden ChatGPT ids - #51
Draft
Deep-Sixed wants to merge 1 commit into
Draft
Deep-Sixed wants to merge 1 commit into
Deep-Sixed wants to merge 1 commit into
Conversation
The P2s and P3s from the review of main at 999fe3e. - verify_ledger compared only part of what the chain commits to. record.created carries source_kind, source_id and backend, but none was compared, so hand edits to them verified clean. It now compares every field a record or replay event carries: also a record's failure or invalidation reason (against its error column) and a replay's reason, policy and platform. record.created and record.imported now chain created_at too, which observations are named by; older events leave it unchecked. source_path is checked against the archived Source its source_id names. artifact_dir is a location, not evidence, and stays unchecked (documented). - ObservationRef resolution rebuilt the observation from the row alone. It now also requires the row's source_hash, source_kind, source_id and (where chained) created_at to match the record's creation event. - The verifiers migrated the ledger they verified: opening a ledger from before the event log imported its current, possibly edited tables into a new chain and then reported ok. LedgerStore gains migrate=False, which creates and migrates nothing and raises LedgerSchemaError for a missing, foreign, older or newer ledger. python -m stele.ledger.events, stele.identity, stele.extraction and the report/sign-off/check/list commands of stele.verification use it; only `verification run`, which records runs, still migrates. - ChatGPT adapter: chunk ids percent-encode the conversation and node ids, so the "#n" suffix of a duplicated conversation cannot collide with a real id and "a:b"+"c" cannot collide with "a"+"b:c" (UUIDs are unchanged). A non-object author is MalformedExportError instead of AttributeError. The docstring and docs no longer claim transform() holds one conversation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QRK7hqAaNLkH2JhWanY5VM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the two P2s and the P3s from the review of main at 999fe3e. Each was reproduced against main before the fix.
P2:
verify_ledgercompared only some of the fields the chain recordsrecord.createdchainssource_kind,source_idandbackend, butverify_ledgernever compared them with the table. Hand edits to any of them verified clean.source_kind(file → tree, which makes replay ask the archive for the wrong Snapshot kind),source_id,backendorsource_pathleftverify_ledger(...).ok == True.error.reason,policyandplatform.source_pathis checked against the archived Source thatsource_idnames.artifact_diris deliberately not checked. It says where the run's output was on disk. That is a location, not evidence. The docs say so.created_at: observation references are named by the record's creation time, which the chain never recorded.record.createdandrecord.importednow chain it. Records created before this change have their creation time on the row alone, and the docs say that too.created_atwhere chained, to match the record's creation event.P2: the verifiers migrated the ledger they were verifying
Every verifier opened the ledger with
LedgerStore(...), which migrates on open.python -m stele.ledger.eventswas pointed at a schema-6 ledger whose record had been flipped from invalidated back to sealed by hand. It migrated the ledger to schema 8 and chained the edited tables asrecord.imported. Then it reported"ok": true, and that false certification was written into the ledger for later verifications to trust.LedgerStore(..., migrate=False)creates and migrates nothing. It raisesLedgerSchemaErrorfor a missing, foreign, older or newer ledger, and the message says why.stele.ledger.events,stele.identity,stele.extraction, and thereport,sign-off,checkandlistcommands ofstele.verification.verification run, which records runs, still migrates.P3: ChatGPT adapter
#<n>suffix for duplicated conversations could collide with a real idX#n, and"a:b"+"c"could collide with"a"+"b:c". A collision made the dispatcher reject the whole export. Conversation and node ids are now percent-encoded in chunk ids. UUIDs, which ChatGPT uses, are unchanged. Metadatanode_idstays raw, since extraction anchors point intomappingby it.author: a message whoseauthorisn't an object crashed withAttributeError. It now raisesMalformedExportError.docs/adapter.mdclaimed the adapter never holds more than one conversation. That holds foriter_chunks(), not fortransform(), which the dispatcher calls. Both now say so.Tests
tests/test_event_log.py:tests/test_identity.py: an observation rebuilt from an editedcreated_atorsource_idis refused.tests/test_chatgpt_adapter.py: the two collision cases, UUID ids unchanged, and the malformed author.test_event_log.pypinned the old, coarser messages and now expect the new ones.🤖 Generated with Claude Code
https://claude.ai/code/session_01QRK7hqAaNLkH2JhWanY5VM
Generated by Claude Code