Skip to content

Canon: enforce reporter idempotency and record PASS evidence - #17

Merged
andreidita22 merged 2 commits into
canon-loop-scaffoldfrom
codex/implement-reporter-and-cli-modules-for-canon-loop
Oct 19, 2025
Merged

Canon: enforce reporter idempotency and record PASS evidence#17
andreidita22 merged 2 commits into
canon-loop-scaffoldfrom
codex/implement-reporter-and-cli-modules-for-canon-loop

Conversation

@andreidita22

Copy link
Copy Markdown
Contributor

Summary

  • ensure reporterWrite skips appending log entries that already exist in the artifact
  • extend the idempotent invariant coverage to guard against repeats across interleaved writes
  • capture the Canon PASS artifacts and implementation report for submission

Testing

  • .codex/selfcheck.sh runs/canon-loop-demo/meta/compose.json amr/canon.lock.json modules
  • node tm.mjs gates shipping --compose runs/canon-loop-demo/meta/compose.json --modules-root modules --emit-events --strict-events

https://chatgpt.com/codex/tasks/task_e_68f44dfe59248320a19f272e7edb3ab8

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @andreidita22, 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 significantly improves the robustness of the reporterWrite function by implementing a more comprehensive idempotency check. it ensures that log entries are not duplicated, even when multiple write attempts occur or when other messages are interleaved. Furthermore, it introduces the generation of critical artifacts, events.ndjson and implementation_report.json, upon successful Canon runs. These artifacts provide detailed evidence of system behavior and test outcomes, enhancing the overall reliability and auditability of the reporting process.

Highlights

  • Enhanced Reporter Idempotency: The reporterWrite function now prevents duplicate log entries by checking against all prior entries, not just the last one, using a Set for efficient lookup.
  • Interleaved Write Protection: The idempotency logic has been extended to correctly handle scenarios where other log entries are written between attempts to write the same message, ensuring the message is still only recorded once.
  • Canon PASS Artifacts & Report: The system now captures and generates events.ndjson (event logs) and implementation_report.json (a structured report of test results and evidence) for successful Canon runs, improving traceability and verification.
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.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request correctly strengthens the idempotency of reporterWrite by ensuring duplicate messages are not appended, even with interleaved writes. The changes to the implementation and the corresponding test updates are logical and improve the robustness of the reporter. I've identified a potential performance concern in reporterWrite due to reading the entire log file on each call, and a minor code inconsistency in the test runner. Overall, these are solid improvements.

Comment on lines +39 to +40
const seen = new Set(prior);
const alreadyLogged = seen.has(trimmed);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This new logic correctly ensures idempotency by checking the entire log history. However, it's worth noting that this approach, which relies on reading the full log file and creating a Set on every reporterWrite call, could introduce a performance bottleneck if the log files become very large. While this is acceptable for now, it's a trade-off to keep in mind for future scaling.

Comment thread modules/reporter/tests/runner.mjs Outdated
assert.equal(lines[0], spec.message);
const lines = contents
.split(/\r?\n/)
.map((line) => line.trim())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

To maintain consistency with the normalizeLines function in modules/reporter/src/index.js, it's better to use .trimEnd() here instead of .trim(). While it may not affect the outcome of this specific test because input messages are trimmed, aligning the logic prevents potential future discrepancies and improves code consistency.

Suggested change
.map((line) => line.trim())
.map((line) => line.trimEnd())

@andreidita22
andreidita22 merged commit d6b7dfd into canon-loop-scaffold Oct 19, 2025
9 checks passed
@andreidita22
andreidita22 deleted the codex/implement-reporter-and-cli-modules-for-canon-loop branch October 19, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant