Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ddss/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ async def main(session: async_sessionmaker[AsyncSession]) -> None:

def handler(rule):
ds = str(rule)
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)))
else:
tasks.append(asyncio.create_task(insert_or_ignore(sess, Facts, ds)))
Comment on lines 23 to +26

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.
return False

chain.execute(handler)
Expand Down
3 changes: 2 additions & 1 deletion ddss/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ export async function main(sequelize: Sequelize): Promise<void> {

const handler = (rule: Rule) => {
const ds = rule.toString();
tasks.push(insertOrIgnore(Fact, ds));
const idea = strRuleGetStrIdea(ds);
if (idea) {
tasks.push(insertOrIgnore(Idea, idea));
} else {
tasks.push(insertOrIgnore(Fact, ds));
Comment on lines 26 to +29

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.
}
return false;
};
Expand Down
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"docs": "vitepress build"
},
"dependencies": {
"atsds": "^0.0.18",
"atsds-bnf": "^0.0.18",
"atsds-egg": "^0.0.18",
"atsds": "^0.0.19",
"atsds-bnf": "^0.0.19",
"atsds-egg": "^0.0.19",
"commander": "^14.0.3",
"mariadb": "^3.5.2",
"mysql2": "^3.19.1",
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ readme = "README.md"
authors = [{ email = "hzhangxyz@outlook.com", name = "Hao Zhang" }]
requires-python = ">=3.11"
dependencies = [
"apyds~=0.0.18",
"apyds-bnf~=0.0.18",
"apyds-egg~=0.0.18",
"apyds~=0.0.19",
"apyds-bnf~=0.0.19",
"apyds-egg~=0.0.19",
"prompt-toolkit~=3.0.52",
"sqlalchemy[aiosqlite,aiomysql,postgresql-asyncpg]~=2.0.45",
"tyro~=1.0.3",
Expand Down
Loading
Loading