bugfix(status): tighten _has_extract — stop crediting mention-in-backticks#11
Open
CryptoJones wants to merge 1 commit into
Open
bugfix(status): tighten _has_extract — stop crediting mention-in-backticks#11CryptoJones wants to merge 1 commit into
CryptoJones wants to merge 1 commit into
Conversation
…ticks
Two issues in status.companyos_status's per-project extract check:
1. Each pattern file was read TWICE per project (once for the
`Source project | \`name\`` form, once for the loose `\`name\``
fallback). On a CompanyOS with N projects and M patterns that
made status() do O(N*M) extra reads on every invocation.
2. The loose fallback (`f"\`{project.name}\`" in text`) credited any
backtick mention as an extract. Concrete failure: pattern Y
sourced from project beta has a war story that says
"Similar trick once worked on `alpha`; see that project."
status() would then report alpha as having an extract too — even
though alpha was never the source. Operators reading the morning
dashboard would skip running `socrates extract` on alpha because
the column already shows a check mark, defeating the whole point
of the third 120x deliverable habit.
Fix:
- Read each pattern file exactly once.
- Match only the canonical `Source project | \`name\`` line (with the
optional `**` bold wrapper to tolerate both render formats).
- Drop the loose backtick fallback.
Tests added (2):
- positive: status reports has_extract=True when a pattern's Source
project field matches.
- negative regression: pattern Y sourced from beta mentions alpha
in a war story → alpha.has_extract is False.
149/149 tests pass; ruff + mypy clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two issues in status.companyos_status's per-project extract check:
Each pattern file was read TWICE per project (once for the
Source project | \name`form, once for the loose`name``fallback). On a CompanyOS with N projects and M patterns that
made status() do O(N*M) extra reads on every invocation.
The loose fallback (
f"\{project.name}`" in text) credited any backtick mention as an extract. Concrete failure: pattern Y sourced from project beta has a war story that says "Similar trick once worked onalpha; see that project." status() would then report alpha as having an extract too — even though alpha was never the source. Operators reading the morning dashboard would skip runningsocrates extract` on alpha becausethe column already shows a check mark, defeating the whole point
of the third 120x deliverable habit.
Fix:
Source project | \name`line (with the optional**` bold wrapper to tolerate both render formats).Tests added (2):
project field matches.
in a war story → alpha.has_extract is False.
149/149 tests pass; ruff + mypy clean.
Self-review caveat: behavior change is observable — projects that previously appeared as 'extracted' purely because another pattern's war story mentioned them will now correctly appear as 'not extracted'. Operators relying on the old (buggy) check mark will notice. That's the intended fix; called out in case it confuses anyone.