Skip to content

feat(graph): preserve integrity and temporal evidence - #252

Merged
toddysm merged 8 commits into
mainfrom
feature/graph-integrity/250-25e59c6f
Oct 28, 2026
Merged

toddysm merged 8 commits into
mainfrom
feature/graph-integrity/250-25e59c6f

Conversation

@toddysm

@toddysm toddysm commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Scope

Closes #250. Implements the three approved integrity requirements of parent #232; parent closure remains gated on a separate inventory close-out PR. Start inventory PR #251 is already merged.

  • Diagnose unresolved occurrence references against the complete input set, independent of file order, with file/field/target/remediation context. Default indexing retains permissive placeholders but emits visible warnings; strict CLI/service validation rejects missing evidence before graph writes or CLI rebuild deletion.
  • Preserve full deployment observations via deterministic RUNS.eventId, including time/source evidence. Identical replay stays idempotent. Shared deployment query, CLI, HTTP and artifact details expose retained events.
  • Extend tag history and artifact details with UTC observation-derived validity bounds and explicit ambiguity; order by real instants. Repeated targets share windows, unknown ends stay null, and latest conflicting observations no longer arbitrarily resolve to one digest.
  • Reject old derived RUNS schemas with explicit rebuild guidance; no source-schema migration or fabricated recovery of missing history.
  • Add read-only graph CI, regressions, configuration support through existing Helm config, and architecture/user documentation. No chart defaults or registry fixture workflows changed.

Validation

Testing mode: hosted, normal GitHub Actions and Copilot review authorized.

Tested source: 25b68e6c2caea50ece38f59299708c88619d6e9b on Python 3.12/macOS arm64 with the real LadybugDB engine.

  • python -m pytest --import-mode=importlib -q apps/python-app/libs/cssc_graph/tests apps/python-app/services/graph-service/tests: 117 passed, no skips (87-test baseline; 30 added cases).
  • mypy --python-executable .venv/bin/python --follow-imports=silent with library path configured: 8 changed production files clean.
  • Ruff: no additional diagnostics compared with main; unrelated existing style diagnostics left unchanged. New files formatted with Ruff.
  • actionlint 1.7.12: new workflow clean. ShellCheck at warning severity: all three workflow scripts clean.
  • Helm lint passes; template with config.STRICT_REFERENCES=true emits the expected operator setting without changing chart defaults.
  • Seven relative documentation links resolve; git diff --check and staged safety scan pass. No credentials or private keys in source/evidence.
  • Existing Starlette/httpx deprecation warning remains unrelated.

Self-review: assessed correctness, reference-policy boundaries, append-only/idempotent identity, timestamp ambiguity, old-schema behavior, user-facing contracts and safety; no remaining findings at the tested head. Source-documentation templates/editor diagnostics are unavailable, so repository docstrings, CLI type/syntax checks and execution tests ground the assessment.

The approved normal merge will trigger existing dashboard-image publishing and graph-event recording. No manual deployment or registry-fixture runs are requested.

Current-head evidence after review corrections

Tested/pushed source: b226351304bdcf9f489d3fc2b984a85614b31344.

  • Hosted graph run https://github.com/toddysm/cssc-framework/actions/runs/40743174744 passed 123 tests, with the native engine required (no skipped suites), and validated all 12 committed schema/example files.
  • Required CodeQL passed: https://github.com/toddysm/cssc-framework/actions/runs/40743170518.
  • The same 123 local tests and all 8 production-file type checks pass at this exact head. Syntax checks, workflow diagnostics, seven relative docs links, and baseline-aware Ruff comparison remain clean for this change.
  • All five initial review threads have individual fix-SHA replies and were resolved afterward. Fresh current-head Copilot review remains a merge gate.
  • Timestamp handling now preserves exact RFC3339 fractions, lowercase t/z and leap-second ordering without narrowing schema acceptance.
  • Deployment history retains the complete source payload, not just its hash/run URL. Queries return the source evidence, with HTTP regressions for runAttempt/issueUrl/workflow distinctions.
  • Database opens, including read-only CLI commands, reject legacy history schemas with actionable rebuild guidance. No migration or source-file changes are hidden in that guard.
  • No hosted CI failure or retry-cap escalation so far. The earlier baseline evidence is historical and superseded by this current head.

Final validated head and review disposition

Tested/pushed source: f2b2478617b7302cc2544eabca8d86306409c46b.

  • 146 hosted real-engine graph/HTTP tests passed, with no skipped suites: https://github.com/toddysm/cssc-framework/actions/runs/40749957490. All12 committed schema/example files validated.
  • Required CodeQL passed: https://github.com/toddysm/cssc-framework/actions/runs/40749957352.
  • Copilot completed exact-head review and recommended approval, with no active issues: https://github.com/toddysm/cssc-framework/actions/runs/40749989409. All inline threads have fix-SHA replies before resolution; summary-only concerns received individual fix/disposition comments.
  • 146 local tests, ten production-file type checks, syntax checks, workflow/schema and ShellCheck diagnostics passed. Seven documentation links resolve; no new Ruff diagnostics versus main; final safety scan/self-review has no remaining findings. Existing unrelated Starlette deprecation/style findings remain disclosed.
  • Corrections from review enforce a shared timestamp-validation/query contract, exact fractions and valid offset/leap structure; preserve full deployment source evidence; surface legacy/startup diagnostics; and batch history retrieval into two database calls including seed resolution, measured against10 occurrences.
  • Documented evidence limits: timestamp structure is not an external announcement/event verifier; inferred tag windows are not proof of continuous registry validity; full-history queries retain the safety read guard and are not a paginated inventory API.
  • No runtime dependency manifests or chart defaults changed. No manual deployment/registry fixture actions. No hosted CI failures, bypasses, fabricated statuses or protection changes.

This final evidence supersedes the earlier historical source-head counts. Parent #232 stays open until the separate inventory close-out PR merges.

Report unresolved input references with opt-in strict CLI/service validation, preserve idempotent deployment observations, and expose observation-derived tag intervals with explicit ambiguity. Add graph CI, regressions and user/architecture documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 28, 2026 18:03
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T18:06:06.552099Z 25b68e6 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 25b68e6c2c

ℹ️ 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".

Accept schema-valid lowercase UTC and leap-second notation, retaining arbitrary fractional precision for tag grouping, bounds and deployment ordering.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

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.

🟡 Changes recommended

Deployment history loses distinguishing source evidence, timestamp handling misorders or rejects valid observations, and legacy database reads fail without actionable rebuild guidance.

4 open issues
What changed in this PR

This PR strengthens the file-backed supply-chain graph with reference diagnostics and observation history, addressing #250 while leaving #232’s inventory close-out separate.

Changes:

  • Adds complete-input reference checks, permissive warnings, and opt-in strict CLI/service validation.
  • Adds deployment event identities and history queries, plus observation-derived tag intervals and explicit ambiguity.
  • Adds regression coverage, read-only hosted CI, and integrity/rebuild documentation.
File Description
docs/​guides/​observability/​querying-the-supply-chain-graph.md Documents validation, history queries, intervals, and rebuild procedures.
docs/​architecture/​observability/​supply-chain-graph.md Updates implementation status and integrity semantics.
apps/​python-app/​services/​graph-service/​tests/​test_app.py Adds HTTP, readiness, and configuration regressions.
apps/​python-app/​services/​graph-service/​src/​graph_service/​indexing.py Validates before replacement and exposes reference diagnostics.
apps/​python-app/​services/​graph-service/​src/​graph_service/​config.py Adds strict-reference configuration.
apps/​python-app/​services/​graph-service/​src/​graph_service/​app.py Adds the deployment-history endpoint.
apps/​python-app/​libs/​cssc_graph/​tests/​test_integrity.py Covers reference checks, event identity, intervals, and compatibility.
apps/​python-app/​libs/​cssc_graph/​README.md Summarizes integrity features and links the query guide.
apps/​python-app/​libs/​cssc_graph/​cssc_graph/​references.py Adds file-addressed, complete-input reference diagnostics.
apps/​python-app/​libs/​cssc_graph/​cssc_graph/​queries.py Adds deployment history, tag intervals, and ambiguity-aware resolution.
apps/​python-app/​libs/​cssc_graph/​cssc_graph/​indexer.py Adds deployment event hashing and reference preflight checks.
apps/​python-app/​libs/​cssc_graph/​cssc_graph/​graph.py Adds RUNS.eventId and initialization-time compatibility checks.
apps/​python-app/​libs/​cssc_graph/​cssc_graph/​cli.py Exposes strict validation, warnings, and history output.
.github/​workflows/​validate-graph.yml Adds read-only graph tests and schema-validation CI.

Review effort: Balanced

Persist complete deployment source payloads in the derived graph and expose them through shared/HTTP history. Reject incompatible schemas at read-only opens with rebuild guidance, without silently migrating the database.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

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.

🔵 Needs a closer look

Deployment records discard distinguishing source evidence, legacy database reads can fail without rebuild guidance, and startup indexing failures omit actionable diagnostics.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Log strict-reference diagnostics during startup

apps/​python-app/​services/​graph-service/​src/​graph_service/​indexing.py:89

On startup, create_app catches this exception and logs only its traceback; IndexingError's message contains the error count, not these diagnostics. Since /readyz also returns only a generic 503, a strict-reference failure leaves the service unready without emitting the file, field, target, or remediation anywhere in startup output. Please log the formatted diagnostics before raising, so operators can identify the missing evidence without invoking POST /index/rebuild.

4 resolved since last review

Review effort: Balanced

Copilot AI left a comment

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.

🟡 Changes recommended

Compatibility checks can produce an uncaught CLI traceback for older databases, and strict-reference startup failures lack actionable diagnostics identifying missing evidence and remediation.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Log actionable strict-reference diagnostics on startup failure

apps/​python-app/​services/​graph-service/​src/​graph_service/​indexing.py:89

On a strict-reference startup failure, the logged exception reports only the validation error count, while /readyz returns a generic 503. Operators cannot identify the missing evidence from either surface without calling POST /index/rebuild. Log the formatted file, field, target, and remediation diagnostics before raising so startup failures are actionable.

Review effort: Balanced

Catch legacy compatibility failures when entering the index context and log complete strict-reference diagnostics before startup rejection. Cover both paths with execution regressions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@toddysm

toddysm commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Fixed the additional startup-diagnostics concern from the latest review summary in d52d45f. GraphIndex logs every formatted file/field/target/remediation diagnostic before raising the startup error; the strict-service regression captures the logs and asserts all four details. The user guide documents this operator-facing error path. This summary concern had no inline thread to resolve. All 124 local graph/HTTP tests and eight-file type checks pass at this head.

Copilot AI left a comment

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.

🔵 Needs a closer look

Human assessment is needed to evaluate a timestamp-validation gap that can admit malformed observations and cause HTTP 500 responses across multiple read endpoints.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Register the shared exact RFC3339 parser as the schema date-time checker so optional jsonschema extras cannot silently disable validation. Reject malformed timestamps before graph writes or query-time failures, with CLI/service regressions and no runtime dependency changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@toddysm

toddysm commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Fixed the latest review summary’s timestamp-validation gap in ce0facc. I reproduced the actual root cause: the installed jsonschema FormatChecker had no date-time checker because optional format extras were absent, so even not-a-timestamp was accepted.

Schema validation and queries now share one exact RFC3339 parser, explicitly registered as the date-time checker without new runtime dependencies. Malformed timestamps are rejected with file/field diagnostics before indexing; accepted lowercase UTC, exact fractions and leap notation remain queryable. New CLI/schema/service regressions prove failures occur before DB creation/readiness rather than at read endpoints. All 132 graph/HTTP tests and ten production-file type checks pass. This was a summary-only concern without an inline thread.

Copilot AI left a comment

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.

🟡 Changes recommended

The timestamp parser accepts and normalizes invalid timezone offsets, allowing malformed evidence through schema validation and potentially creating false simultaneous tag conflicts.

1 open issue

Review effort: Balanced

Enforce RFC3339 offset hour/minute ranges before datetime parsing can normalize invalid offsets. Cover malformed offsets and both valid signed boundary values.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

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.

🔵 Needs a closer look

Human assessment is needed because leap-second validation can accept invalid timestamps, potentially distorting observation validity bounds.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Reject impossible leap-second placement after timezone normalization, retain real historical leap notation, and document the distinction between structural timestamp validation and external event/schedule verification.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@toddysm

toddysm commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Addressed the latest review summary’s leap-marker assessment in 41810b2. The parser now rejects leap notation unless the UTC-normalized time is23:59 at the last day of a month. New invalid-placement tests include midday, wrong minute/day and an offset that moves the marker away from UTC midnight; valid tests use the real 2016-12-31 leap and its offset-equivalent spelling. All145 graph/HTTP tests and ten production-file type checks pass.

The guide now states the remaining evidence boundary explicitly: schema validation checks timestamp structure, not whether an external authority announced an insertion or whether the recorded event actually occurred. No remote schedule lookup or unverifiable future-event attribution is introduced. This summary concern had no inline thread.

Copilot AI left a comment

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.

🔵 Needs a closer look

Human assessment is needed to evaluate the scalability and request-blocking risks of per-occurrence deployment queries executed while holding the graph lock.

No open issues 🎉

Review effort: Balanced

Fetch all resolved occurrence history in one parameterized projection instead of a per-occurrence query loop, while retaining the rebuild read guard and full evidence. Add a real-engine constant-query-count regression.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@toddysm

toddysm commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Assessed and addressed the latest summary’s per-occurrence query/lock concern in f2b2478. Deployment history now uses one parameterized graph projection for all resolved occurrences instead of N database round-trips. A real-engine regression with10 occurrences measures exactly2 calls (seed resolution + one history query). The existing read guard remains necessary to prevent concurrent rebuilds closing the store mid-query.

The guide explicitly records the remaining boundary: this history journey returns retained evidence and is not a streaming/paginated inventory API, so cost scales with returned history. That matches the existing history-query contract; no silent truncation or new unapproved pagination semantics were introduced. All146 graph/HTTP tests and ten production-file type checks pass. No unresolved inline findings remain.

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues remain for the graph-integrity changes.

No open issues 🎉

Review effort: Balanced

@toddysm
toddysm merged commit 1415ccd into main Oct 28, 2026
5 checks passed
@toddysm
toddysm deleted the feature/graph-integrity/250-25e59c6f branch October 28, 2026 19:01
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.

Graph integrity: diagnostics, deployment history and observed tag intervals

2 participants