Skip to content

fix: refine narrative schema pack#19501

Closed
BrianCLong wants to merge 1 commit intomainfrom
codex/create-hybrid-schema-for-neo4j-and-postgres
Closed

fix: refine narrative schema pack#19501
BrianCLong wants to merge 1 commit intomainfrom
codex/create-hybrid-schema-for-neo4j-and-postgres

Conversation

@BrianCLong
Copy link
Copy Markdown
Owner

Motivation

  • Ensure deterministic, enforceable narrative data model across graph and relational stores and eliminate parity gaps that lead to schema drift and validation mismatches.
  • Provide a canonical, machine-validateable provenance receipt so downstream pipelines can assert and audit evidence lineage and run metadata.

Description

  • Add/extend schemas/narrative_graph.schema.yml to include full node coverage (Artifact, Actor, Narrative, Frame, Claim, Assumption, Community, Event, Evidence), relationships, indexes, and uniqueness constraints for all primary IDs.
  • Add schemas/neo4j/narrative_constraints.cypher to create UNIQUE constraints for id properties and indexes for actor.handle, narrative.state, and frame.narrative_id to match YAML schema expectations.
  • Add schemas/postgres/narrative_metrics.sql defining narrative_run, narrative_metric, narrative_transition, and narrative_handoff tables and narrative-scoped indexes for performant metrics and transition queries.
  • Add docs/provenance/receipt.schema.json as a formal JSON Schema for deterministic provenance receipts and update docs/roadmap/STATUS.json to record the schema pack refinement delivery.

Testing

  • Executed boundary validation with node scripts/check-boundaries.cjs, which completed successfully with no boundary violations.
  • No unit, integration, or end-to-end tests were added or executed for these schema artifacts in this change.
  • Recommend running the repository validation checklist (pnpm lint, pnpm test, and make smoke) in CI prior to merge for full verification.

Codex Task

@BrianCLong BrianCLong added the codex Codex-owned implementation work label Mar 7, 2026 — with ChatGPT Codex Connector
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the narrative schema pack to ensure a deterministic, enforceable data model across both graph and relational stores. The changes aim to eliminate schema drift, improve validation, and provide a canonical, machine-validateable provenance receipt for downstream pipelines to assert and audit evidence lineage and run metadata. This enhancement provides a more robust and consistent foundation for narrative data management.

Highlights

  • Narrative Graph Schema: Extended schemas/narrative_graph.schema.yml to include full node coverage for Artifact, Actor, Narrative, Frame, Claim, Assumption, Community, Event, and Evidence, along with their relationships, indexes, and uniqueness constraints for primary IDs.
  • Neo4j Constraints: Added schemas/neo4j/narrative_constraints.cypher to establish UNIQUE constraints for all primary ID properties and create indexes for actor.handle, narrative.state, and frame.narrative_id to align with the YAML schema.
  • PostgreSQL Metrics Schema: Introduced schemas/postgres/narrative_metrics.sql to define narrative_run, narrative_metric, narrative_transition, and narrative_handoff tables, including narrative-scoped indexes for efficient metrics and transition queries.
  • Provenance Receipt Schema: Added docs/provenance/receipt.schema.json as a formal JSON Schema to ensure deterministic provenance receipts and updated docs/roadmap/STATUS.json to reflect this delivery.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • docs/provenance/receipt.schema.json
    • Added as a formal JSON Schema for deterministic provenance receipts.
  • docs/roadmap/STATUS.json
    • Updated to record the schema pack refinement delivery.
  • schemas/narrative_graph.schema.yml
    • Extended to include full node coverage (Artifact, Actor, Narrative, Frame, Claim, Assumption, Community, Event, Evidence), relationships, indexes, and uniqueness constraints for all primary IDs.
  • schemas/neo4j/narrative_constraints.cypher
    • Added to create UNIQUE constraints for id properties and indexes for actor.handle, narrative.state, and frame.narrative_id.
  • schemas/postgres/narrative_metrics.sql
    • Added, defining narrative_run, narrative_metric, narrative_transition, and narrative_handoff tables and narrative-scoped indexes.
Activity
  • BrianCLong created this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 7, 2026

Warning

Rate limit exceeded

@BrianCLong has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 17 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0e704072-93a0-46ce-8014-b92d5c3b97ee

📥 Commits

Reviewing files that changed from the base of the PR and between 68c99c3 and 6a9f750.

📒 Files selected for processing (5)
  • docs/provenance/receipt.schema.json
  • docs/roadmap/STATUS.json
  • schemas/narrative_graph.schema.yml
  • schemas/neo4j/narrative_constraints.cypher
  • schemas/postgres/narrative_metrics.sql
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/create-hybrid-schema-for-neo4j-and-postgres

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 and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several new schema files to define a narrative data model across different data stores. The changes are well-structured and provide a solid foundation. My review includes a few suggestions to enhance data integrity, validation, and consistency. Specifically, I've recommended adding a pattern for span in the JSON schema, ensuring all properties are required where appropriate in the YAML schema, completing the index definitions, and adding ON DELETE CASCADE to foreign keys in the SQL schema for better referential integrity.

"type": "string",
"pattern": "^sha256:[a-f0-9]{64}$"
},
"span": {"type": "string"}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The span property is currently defined as a generic string. To improve data validation and clarity, consider adding a pattern to enforce a specific format, such as character offsets (e.g., '120:184'). A description would also be helpful for consumers of the schema.

Suggested change
"span": {"type": "string"}
"span": {"type": "string", "pattern": "^\\d+:\\d+$", "description": "A pointer to a segment of the input artifact, e.g., character offsets '120:184'."}

Comment on lines +23 to +25
hash_algo: {type: string}
hash: {type: string}
size_bytes: {type: integer}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The properties hash_algo, hash, and size_bytes within the integrity object are not marked as required. If an integrity object is provided, it's likely that all its properties should be present to be meaningful. Consider making them required to ensure data completeness.

          hash_algo: {type: string, required: true}
          hash: {type: string, required: true}
          size_bytes: {type: integer, required: true}

Comment on lines +158 to +170
indexes:
- label: Artifact
props: [artifact_id]
- label: Actor
props: [actor_id, handle]
- label: Narrative
props: [narrative_id, state]
- label: Frame
props: [frame_id, narrative_id]
- label: Assumption
props: [assumption_id]
- label: Claim
props: [claim_id]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The indexes section appears to be incomplete. To maintain consistency with the defined constraints (which imply indexes on primary IDs) and the explicit indexing of other properties, it would be clearer to list all intended indexed properties. The current list is missing indexes for Community, Event, and Evidence nodes on their respective ID properties.

indexes:
  - label: Artifact
    props: [artifact_id]
  - label: Actor
    props: [actor_id, handle]
  - label: Narrative
    props: [narrative_id, state]
  - label: Frame
    props: [frame_id, narrative_id]
  - label: Assumption
    props: [assumption_id]
  - label: Claim
    props: [claim_id]
  - label: Community
    props: [community_id]
  - label: Event
    props: [event_id]
  - label: Evidence
    props: [evidence_id]

);

CREATE TABLE IF NOT EXISTS narrative_metric (
run_id TEXT NOT NULL REFERENCES narrative_run(run_id),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To improve referential integrity, consider adding ON DELETE CASCADE to the foreign key constraint on run_id. This ensures that when a record in narrative_run is deleted, all corresponding records in narrative_metric are automatically removed, preventing orphaned rows.

  run_id TEXT NOT NULL REFERENCES narrative_run(run_id) ON DELETE CASCADE,

);

CREATE TABLE IF NOT EXISTS narrative_transition (
run_id TEXT NOT NULL REFERENCES narrative_run(run_id),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For better referential integrity, it's advisable to add ON DELETE CASCADE to the run_id foreign key. This will automatically clean up related narrative_transition records when a narrative_run is deleted.

  run_id TEXT NOT NULL REFERENCES narrative_run(run_id) ON DELETE CASCADE,

);

CREATE TABLE IF NOT EXISTS narrative_handoff (
run_id TEXT NOT NULL REFERENCES narrative_run(run_id),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To maintain data consistency, please add ON DELETE CASCADE to the foreign key constraint for run_id. This will ensure that deleting a narrative_run also deletes associated narrative_handoff records, preventing orphaned data.

  run_id TEXT NOT NULL REFERENCES narrative_run(run_id) ON DELETE CASCADE,

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

🤖 Auto-approved by Mega Merge Orchestrator

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

🤖 Auto-approved by Mega Merge Orchestrator

@BrianCLong
Copy link
Copy Markdown
Owner Author

Temporarily closing to reduce Actions queue saturation and unblock #22241. Reopen after the golden-main convergence PR merges.

1 similar comment
@BrianCLong
Copy link
Copy Markdown
Owner Author

Temporarily closing to reduce Actions queue saturation and unblock #22241. Reopen after the golden-main convergence PR merges.

@BrianCLong BrianCLong closed this Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex Codex-owned implementation work queue:blocked

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant