Skip to content

RTOP-376: Rewrite the RTC block, cite IEC 61131-3 on the example blocks, and add the CLA - #254

Merged
thiagoralves merged 5 commits into
developmentfrom
feature/RTOP-376-strucpp-library-provenance
Oct 21, 2026
Merged

thiagoralves merged 5 commits into
developmentfrom
feature/RTOP-376-strucpp-library-provenance

Conversation

@thiagoralves

@thiagoralves thiagoralves commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor
  • Rewrites the RTC block (libs/sources/additional-function-blocks/rtc.st). Its predecessor was carried over from MatIEC's LGPLv3 library, which Autonomy does not own. Breaking behaviour change, decided in review: RTC is now a set-and-run clock. On its first scan it reads CURRENT_DT() once and counts from it with TIME(), so it starts at the system date (1970 plus uptime on targets without one, such as AVR). The IN input is renamed SET: while SET is TRUE, CDT equals PDT; when SET is FALSE, CDT keeps counting from the last value set. Q copies SET. Projects that wire IN must rename it to SET. The block's hover documentation describes this.
  • PID, INTEGRAL, DERIVATIVE, RAMP and HYSTERESIS are IEC 61131-3 example blocks: their headers now cite the standard instead of MatIEC. Those five carry no Autonomy header, since their code comes from the standard. All copyright lines read Copyright (c) <year> Autonomy® and every licence identifier reads GPL-3.0-only (with the runtime exception for the library).
  • Adds the contribution setup shared with openplc-runtime: CLA.md, CONTRIBUTING.md, the PR template checkbox and a CLA check. Everyone ticks it, staff included; only bots pass without it. CLA.md is version 1.0. The README points to the runtime licensing page.

Ticket: RTOP-376 — https://autonomylogic.atlassian.net/browse/RTOP-376 (small change, no Requirements Gathering; no Cybersecurity Risk Assessment: library code, text and repository configuration only).

Testing

  • New tests/library/additional-fb-rtc.test.ts (six ST cases through g++): never set (starts within 5 s of CURRENT_DT() and counts), SET TRUE, SET held, SET released, PDT ignored while SET is FALSE, setting again. Deliberately broken blocks (no set time; a 1970 start) fail the matching cases. npx vitest run tests/library: 489 passed; npm run typecheck clean.
  • Packed and installed into openplc-editor: a project using RTC with located inputs and outputs compiled for OpenPLC Simulator, Arduino Uno, Arduino Mega, ESP32 Generic, ESP8266 NodeMCU, Raspberry Pico and Raspberry Pico 2. Every build calls CURRENT_DT() from the new RTC, AVR included.
  • Manual test by the developer on hardware of the new behaviour: passed.

Contributor License Agreement

🤖 Generated with Claude Code

https://claude.ai/code/session_01MRWeC5FUhe5ZwEEbLUGpZ6

thiagoralves and others added 3 commits October 20, 2026 15:33
…-3 on the example blocks

The RTC block was carried over from MatIEC's LGPL library, which Autonomy
does not own. It is reimplemented from its documented behaviour, unchanged
for users: the runtime clock while IN is FALSE, PDT latched on the rising
edge, PDT plus elapsed time while IN stays TRUE. New tests pin that
behaviour.

PID, INTEGRAL, DERIVATIVE, RAMP and HYSTERESIS are the IEC 61131-3 example
blocks, so their headers now cite the standard instead of MatIEC. A stale
note claiming RTC calls CURRENT_DT() is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRWeC5FUhe5ZwEEbLUGpZ6
…l request check

Contributions are accepted under CLA.md, so they can be offered under the
licences of the OpenPLC ecosystem. Submitting a pull request means agreeing
to it, the pull request template carries a checkbox, and a CLA check fails
until outside contributors tick it. The README points to the runtime
licensing page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRWeC5FUhe5ZwEEbLUGpZ6
Copyright lines and the package author name Autonomy alone. The IEC
example blocks cite IEC 61131-3, 2nd Ed. without a draft date. The CLA
is accepted by ticking its pull request checkbox, and the check runs as
a job named CLA.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRWeC5FUhe5ZwEEbLUGpZ6

@Gustavohsdp Gustavohsdp 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.

Review summary

The RTC rewrite is behaviourally equivalent to the previous block (edge detection, PDT latch, CDT = PDT + elapsed, Q := IN), the CLA workflow reads the PR body through env (no script injection), and the five IEC example blocks match the MatIEC originals apart from formatting and the header.

Validation run by the reviewer (Linux, node:22-bookworm + g++): npx vitest run → 104 files, 3474 passed / 7 skipped; npm run typecheck clean; npm run lint 0 errors. On macOS the g++-based tests fail at link time (tapi error: malformed file), which is a local toolchain problem and also hits suites this PR does not touch.

Findings (details inline):

Severity Where Problem
required README.md:274 The OpenPLC Runtime licensing link returns 404: LICENSING.md only exists in openplc-runtime#225, which is still open and targets development, not main.
required tests/library/additional-fb-rtc.test.ts:25 The IN = FALSE case only checks a delta, so the epoch base of CDT is not pinned. A mutant that uses DT#2000-01-01-00:00:00 + TIME() passes all six cases.
nit libs/sources/additional-function-blocks/rtc.st:2 Only rtc.st gets an SPDX/copyright header; the other five .st files in the same library have none. The holder also reads "Autonomy", while CLA.md names "Autonomy Logic Inc.". Is that intentional?
nit libs/sources/additional-function-blocks/rtc.st:9 The inline descriptions of IN, PDT, Q and CDT were dropped, and they were the only per-variable documentation for this block.
nit .github/workflows/cla.yml:22 author_association can report CONTRIBUTOR for members whose org membership is private, so they would have to tick the box too. Harmless, but worth knowing.

Note (outside this PR): ci.yml only runs on pull_request to main, so PRs into development, this one included, get only the CLA check and no lint, typecheck or tests in CI.

Comment thread README.md
Comment thread tests/library/additional-fb-rtc.test.ts
Comment thread libs/sources/additional-function-blocks/rtc.st Outdated
Comment thread libs/sources/additional-function-blocks/rtc.st Outdated
Comment thread .github/workflows/cla.yml Outdated
thiagoralves and others added 2 commits October 21, 2026 12:01
… staff

Licence identifiers name GPLv3 only, matching the CLA's GPLv3 commitment.
The CLA is versioned and staff tick it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRWeC5FUhe5ZwEEbLUGpZ6
RTC reads CURRENT_DT() once on its first scan and counts from it with
TIME(), so it starts at the system date (1970 plus uptime on targets
without one). While SET is TRUE, CDT equals PDT; once SET is FALSE, CDT
keeps counting from the last value set.

BREAKING CHANGE: the IN input is renamed SET. While SET is FALSE, CDT no
longer falls back to the runtime clock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRWeC5FUhe5ZwEEbLUGpZ6
@thiagoralves

Copy link
Copy Markdown
Contributor Author

Review follow-up:

  • Behaviour change (7edb04a): the RTC block is now a set-and-run clock and no longer matches the old block. It starts from CURRENT_DT() on its first scan (1970 plus uptime on targets without a system date), the IN input is renamed SET, CDT equals PDT while SET is TRUE, and it keeps counting from the last value set once SET is FALSE. Projects that wire IN must rename it to SET. The PR description and the hover documentation describe this.
  • CI note (ci.yml only on PRs to main): outside this PR's scope, so not changed here. Library tests and the type check were run locally and are listed in the description.
  • 04049ed: licence identifiers are GPL-3.0-only (with the runtime exception for the library), copyright lines read Autonomy®, CLA version 1.0.

@thiagoralves
thiagoralves merged commit fcccfbd into development Oct 21, 2026
2 checks passed
@thiagoralves
thiagoralves deleted the feature/RTOP-376-strucpp-library-provenance branch October 21, 2026 21:36
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.

3 participants