Skip to content

refactor(concerto-analysis): rename declaration comparer - #1571

Open
sadSanta-07 wants to merge 2 commits into
accordproject:mainfrom
sadSanta-07:refactor/declaration-comparer
Open

sadSanta-07 wants to merge 2 commits into
accordproject:mainfrom
sadSanta-07:refactor/declaration-comparer

Conversation

@sadSanta-07

Copy link
Copy Markdown

fixes #1152

Summary

  • Rename class-declarations.ts to declaration.ts
  • Rename the comparer factories to declarationAdded, declarationRemoved, and declarationTypeChanged
  • Preserve the existing report keys for backwards compatibility
  • No behavior changes

Context

The existing comparison flow already passes getAllDeclarations() to compareClassDeclarations(), so map and scalar declarations are handled by the generic declaration comparer for additions, removals, and type changes.

Map- and scalar-specific comparers remain responsible for their type-specific changes. Adding the declaration add/remove comparers to those specialized hooks would duplicate the existing findings.

This PR therefore only resolves the TODO by generalizing the comparer naming without changing comparison behavior.

The file was renamed to declaration.ts to match the TODO text.

…p with DateTime values

Signed-off-by: pechkas <iffcogc34@gmail.com>
Signed-off-by: pechkas <iffcogc34@gmail.com>
@mira-accord-project

Copy link
Copy Markdown

Thanks for the PR, @sadSanta-07. Renaming the comparer file and its exports to match what it now covers (resolving the old todo in class-declarations.ts) is a tidy clean-up. Sorry it has waited 28 days for a reply.

One thing to check: the diff also includes changes to packages/concerto-core/src/serializer/jsongenerator.ts and its test, which look identical to the ones in your PR #1547 and have nothing to do with the rename. Rebasing onto main so this PR contains only the concerto-analysis rename would make it much easier to review and merge.

The Concerto maintainers have been asked to review. We aim to give a first review within a few working days, though I can't promise a date.

Drafted by an Accord Project agent, reviewed by a maintainer.

@mira-accord-project mira-accord-project 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.

Thank you for picking this up, and for explaining on #1152 why you kept the report keys unchanged. The rename in concerto-analysis itself is clean: the factories are renamed consistently, index.ts is the only importer, and the report keys are untouched, so there is no change for consumers.

The thing to fix before this can merge is scope. The PR also changes packages/concerto-core/src/serializer/jsongenerator.ts and its test, which looks like the map-value serialisation change from #1547 plus some whitespace reformatting. On top of that, the branch is currently conflicting with main. Rebasing and dropping the concerto-core changes should resolve both, and leave a small, easy-to-review rename that touches only packages/concerto-analysis. After that, a maintainer's approval and a green CI run are what remain.

Nothing blocking; some suggestions below. Findings: 1 should-fix, 2 nit.

  • nit · conventions · packages/concerto-analysis/src/comparers/declaration.ts: The sibling files in this folder are plural (map-declarations.ts, scalar-declarations.ts, model-files.ts), and #1152 proposed declarations.ts. You mentioned on the issue that you're happy to change it, so consider declarations.ts for consistency, unless a maintainer prefers the wording of the TODO. The new file also ends without a trailing newline, which the original had, so please add one.
  • nit · hygiene: #1152 asked for the add/remove/type-change comparers to cover map, scalar and enum declarations. Your reasoning, that compareClassDeclaration already receives getAllDeclarations() so registering them again would duplicate reports, is sound, but it narrows the scope and a maintainer hasn't confirmed it on the issue yet. The open PR #1498 also touches map and scalar comparison in the same package. It would help to have a maintainer confirm the direction on #1152 before this merges.

Automated review by Mira, an Accord Project agent, at 8618168. Findings are labelled blocking, should-fix or nit; a maintainer makes the final call.


// don't serialize System Properties, other than $class
if(ModelUtil.isSystemProperty(key)) {
if (ModelUtil.isSystemProperty(key)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

should-fix · correctness

This PR is a rename in concerto-analysis, but it also changes map-value serialisation here, plus whitespace-only edits in this file and its test. Those changes come from #1547. In this branch visitMapDeclaration no longer has the if (mapDeclaration.getValue().isRelationship()) { value = this.processRelationship(...) } branch that main has. If this file is taken as it stands, or the current conflict is resolved in the PR's favour, relationship handling for map values would silently be lost. Mixing the changes in also means the rename can't be reviewed as a no-behaviour-change refactor. Suggested fix: rebase on main and remove every change under packages/concerto-core, so the PR only touches packages/concerto-analysis. The DateTime-in-map fix can go through #1547.

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open with no activity. Remove the stale label or comment to keep it active. Only items with maintainer engagement are auto-closed.

@github-actions github-actions Bot added the Stale label Nov 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Generalize class-declarations comparers to handle all Declaration types

1 participant