Skip to content

feat(import): declare Hermes source fidelity - #2789

Merged
Sinity merged 3 commits into
masterfrom
feature/fanout/hermes-wedge
Jul 12, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/fanout/hermes-wedge

Conversation

@Sinity

@Sinity Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

Add an additive fidelity declaration to import-explain and inspect structurally valid Hermes state.db files through the production parser.

Problem

Hermes SQLite imports had reproducible parser behavior, but import-explain treated their bytes as opaque JSON failures. Operators could not see which states, provenance fields, or runtime evidence were retained versus unavailable.

Solution

  • Add typed coverage/fidelity payloads with exact, absent, redacted, degraded, and inferred states.
  • Route valid Hermes SQLite files through the read-only production parser and describe the sqlite-backup import path.
  • Report schema/profile namespace, active/observed/rewound/compacted state counts, material-origin derivation, cost coverage, lifecycle/relationship/repository capability, and explicit span/merge absence.
  • Declare JSON fallback gaps rather than presenting it as state-db-equivalent.
  • Regenerate the import-explain CLI output schema in a separate commit.

Acceptance criteria

Bead Status Evidence
polylogue-fs1.3: v16, later schema, JSON fallback declarations satisfied Data-backed fixtures cover v16, v17 repository columns, and JSON fallback.
polylogue-fs1.3: retained-blob reproducibility stated satisfied SQLite declaration reports the existing sqlite-backup invariant; the selected parser suite exercises the retained-WAL snapshot path.
polylogue-fs1.3: message/addressing and cost coverage satisfied State counts and material-origin derivation are declared; partial and absent cost provenance are explicit.
polylogue-fs1.3: spans plus snapshot merge deferred No runtime-span ingestion/merge substrate exists on this branch. The declaration renders runtime spans and span/snapshot merge as absent rather than claiming a merge.
polylogue-fs1.11 deferred Formally blocked on polylogue-37t.11; no recall machinery added.
polylogue-fs1.12 deferred Depends on fs1.11 and the forensic consumer; no demo machinery added.

Anti-vacuity

  • test_hermes_state_db_explain_declares_v16_fidelity_and_coverage drives the production SQLite detector, parser, and fidelity projector. Removing the SQLite explain branch or state/count projection makes it fail.
  • test_hermes_state_db_explain_reports_later_schema_capability drives the parser capability map from a v17-shaped database. Removing repository-capability projection makes it fail.
  • test_hermes_json_fallback_explain_declares_missing_state_evidence drives the real Hermes JSON detector/parser route. Removing Hermes fallback projection makes it fail.
  • test_hermes_state_db_explain_marks_removed_cost_provenance_absent uses a valid state database with the optional provenance columns omitted. Removing capability-derived fidelity changes the required absent state and caveat.

Verification

  • nix develop --command devtools test tests/unit/sources/test_hermes_import_explain.py tests/unit/sources/test_parsers_local_agent.py tests/unit/mcp/test_server_surfaces.py -k 'hermes or recall or manifest' — 20 passed, 84 deselected.
  • nix develop --command devtools verify --quick — passed all 15 checks, including mypy and render-all.

Ref polylogue-fs1.3
Ref polylogue-fs1.11
Ref polylogue-fs1.12

Sinity and others added 3 commits July 12, 2026 22:56
Problem: import explain treated Hermes SQLite databases as opaque bytes and
could not distinguish retained source evidence from unavailable or derived
fields.

What changed: inspect structurally valid Hermes state databases through the
production parser, expose a typed per-source fidelity declaration, and mark
JSON fallback, cost coverage, message state, runtime spans, and merge evidence
with explicit statuses.

Compatibility: the new fidelity field is additive on import-explain payloads.

Ref polylogue-fs1.3.

Co-Authored-By: Claude <[email protected]>
Problem: the fidelity declaration read JSON capability lists as an untyped
object, which failed strict type verification.

What changed: narrow the source capability payload to a list before testing
membership.

Ref polylogue-fs1.3.

Co-Authored-By: Claude <[email protected]>
Regenerate the import-explain CLI output schema after adding the Hermes
fidelity declaration.

Ref polylogue-fs1.3.

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 737ee278-8442-4ec6-a233-df79846f5f2b

📥 Commits

Reviewing files that changed from the base of the PR and between 901825e and 4c4745d.

📒 Files selected for processing (5)
  • docs/schemas/cli-output/import-explain.schema.json
  • polylogue/sources/import_explain.py
  • polylogue/sources/parsers/hermes_state.py
  • polylogue/surfaces/payloads.py
  • tests/unit/sources/test_hermes_import_explain.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fanout/hermes-wedge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

CI triage: the GitHub Actions workflow failures are infrastructure-level. Run 29208798863 completed every non-skipped job in 2–5 seconds with an empty steps array, and gh run view --log-failed reports no job log. This does not identify a source failure in this PR. Local verification remains green: focused Hermes/import selection (20 passed) and devtools verify --quick (all 15 checks). No code change made for this external failure.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c4745d654

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

)

fidelity = (
_fidelity_payload(hermes_state.import_fidelity_declaration(sessions, acquisition_method="json_fallback"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve sqlite fidelity for state-db markers

When the input is a Hermes state-db marker JSON, dispatch does not use the JSON fallback: _lower_payload_specs lowers it as local_artifact_document (polylogue/sources/dispatch.py:688-689) and _parse_lowered_spec calls parse_state_db_payload (polylogue/sources/dispatch.py:777-778). This unconditional Hermes branch therefore reports acquisition_method=json_fallback, absent retained-blob reproducibility, and missing message-state evidence for a SQLite parse, so import-explain can give operators the opposite fidelity declaration for retained state.db markers.

Useful? React with 👍 / 👎.

Comment on lines +415 to +416
if hermes_state.looks_like_state_db_path(path):
return _explain_hermes_state_db(path, provider_hint=provider_hint)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include state.db files when explaining Hermes directories

This new state.db parser branch is only reached for candidate paths already yielded by _candidate_paths. For polylogue import --explain ~/.hermes, the CLI calls explain_import_path(path) with the default unknown source (polylogue/cli/commands/import_command.py:243), while the directory walker only yields .db files when provider is Provider.HERMES (polylogue/sources/source_walk.py:38-41), so Hermes state.db under a directory is skipped and the explain output says no supported files instead of exercising this branch.

Useful? React with 👍 / 👎.

@Sinity
Sinity merged commit 352051b into master Jul 12, 2026
3 of 15 checks passed
@Sinity
Sinity deleted the feature/fanout/hermes-wedge branch July 12, 2026 23:08
Sinity added a commit that referenced this pull request Jul 12, 2026
…789,2792,2797

d3xj, w8et, w379 (cost-honesty, PR #2776), fs1.3 (hermes-wedge, PR #2789), and
f2qv.5 (usage-convergence, PR #2797) fully satisfied — closed. cuxz
(temporal-provenance, PR #2786), th0 (test-harness, PR #2777), and fs1.11/
fs1.12 (hermes-wedge cluster, PR #2792) partially satisfied — noted with
disposition, left open per closure-discipline (no closing on partial ACs).

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant