Skip to content

feat: Apply idea strategy for chain engine. - #105

Merged
hzhangxyz merged 1 commit into
mainfrom
dev/apply-idea-strategy-for-chain
Mar 12, 2026
Merged

feat: Apply idea strategy for chain engine.#105
hzhangxyz merged 1 commit into
mainfrom
dev/apply-idea-strategy-for-chain

Conversation

@hzhangxyz

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 12, 2026 11:13
@hzhangxyz
hzhangxyz merged commit c31e5c0 into main Mar 12, 2026
28 checks passed

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.

Pull request overview

This PR updates DDSS’s Python and Node dependency versions to 0.0.19 and adjusts the forward-chaining “chain” components’ persistence logic for inferred rules.

Changes:

  • Bump apyds, apyds-bnf, apyds-egg to 0.0.19 in pyproject.toml and uv.lock.
  • Bump atsds, atsds-bnf, atsds-egg to 0.0.19 in package.json and package-lock.json.
  • Change ddss/chain.ts and ddss/chain.py to insert inferred rules into ideas instead of facts when an “idea” can be derived.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
uv.lock Updates locked Python package artifacts for apyds* to 0.0.19.
pyproject.toml Bumps Python dependency constraints for apyds* to 0.0.19.
package.json Bumps Node dependency constraints for atsds* to 0.0.19.
package-lock.json Updates resolved Node package versions/hashes for atsds* to 0.0.19.
ddss/chain.ts Changes inferred rule persistence to store Idea or Fact exclusively (introduces a behavioral break).
ddss/chain.py Same behavioral change as TS chain component (introduces a behavioral break).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread ddss/chain.ts
Comment on lines 26 to +29
if (idea) {
tasks.push(insertOrIgnore(Idea, idea));
} else {
tasks.push(insertOrIgnore(Fact, ds));

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

This change stops persisting inferred rules to the facts table whenever an idea string is derived. That breaks the documented behavior (ideas are broadcast in addition to facts) and will prevent downstream engines from seeing/processing these inferred facts; it also appears to contradict ddss/search.ts and the existing chain tests that expect inferred conclusions like "----\nb\n" to be inserted as facts. Suggestion: always insertOrIgnore(Fact, ds) and additionally insert the derived idea into Idea when present (i.e., keep fact insertion unconditional).

Suggested change
if (idea) {
tasks.push(insertOrIgnore(Idea, idea));
} else {
tasks.push(insertOrIgnore(Fact, ds));
tasks.push(insertOrIgnore(Fact, ds));
if (idea) {
tasks.push(insertOrIgnore(Idea, idea));

Copilot uses AI. Check for mistakes.
Comment thread ddss/chain.py
Comment on lines 23 to +26
if idea := str_rule_get_str_idea(ds):
tasks.append(asyncio.create_task(insert_or_ignore(sess, Ideas, idea)))
else:
tasks.append(asyncio.create_task(insert_or_ignore(sess, Facts, ds)))

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

This change makes the chain engine insert into Facts only when no idea is derived. Since str_rule_get_str_idea() returns an idea for common derived rules (e.g. parsed "a => b" becomes "a\n----\nb\n"), this will drop inferred facts from the facts table and break the system contract where engines publish new facts and (optionally) ideas. Suggestion: keep inserting ds into Facts unconditionally, and insert into Ideas additionally when idea is present (matching ddss/search.py and the chain tests).

Suggested change
if idea := str_rule_get_str_idea(ds):
tasks.append(asyncio.create_task(insert_or_ignore(sess, Ideas, idea)))
else:
tasks.append(asyncio.create_task(insert_or_ignore(sess, Facts, ds)))
tasks.append(asyncio.create_task(insert_or_ignore(sess, Facts, ds)))
if idea := str_rule_get_str_idea(ds):
tasks.append(asyncio.create_task(insert_or_ignore(sess, Ideas, idea)))

Copilot uses AI. Check for mistakes.
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.

2 participants